Arduino + NRF24 simple tutorial and range test

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello everyone in this video I'm going to show you simple setup with these n RF 20 for wireless communication modules with Arduino these modules are very popular because they're very cheap there are several models of this module and two most popular are this high power module with external antenna which costs around three dollars and the other one has on board PCB antenna and goes for about a dollar on eBay in this video we'll be using this high power module which has declared range of 1,100 meters or 1.1 kilometers these modules use 2.4 megahertz frequency range and can be configured to operate at 125 channels you can configure them using 4 different power levels from minimum to maximum also they can use three different data speed levels 250 kilobits per second 1 megabit per second and 2 megabits per second for more information about these modules please check online also there are plenty of tutorials available online for setting these modules in worries and more complicated configurations like sensor networks peer-to-peer communication or mesh in this video I'll be using very simple Arduino sketches just to give you an idea of how they operate and the test range to see if they really can achieve one point one kilometer as declared by specifications one important thing to highlight is they operate at 3.3 volts according to specification the highest voltage ADIZ can accept is 3 point 6 volts Arduino has 3.3 volt output pin but when using these high power modules you will have issues with transmitting or receiving because Arduino cannot deliver power needed for stable operation one solution is to solder capacitor between voltage input ground but much better solution is to use these base modules base modules are also cheap about one dollar for a pair on eBay they have 3.3 volt regulator so they can accept input voltages from 5 to 12 volts and when using these you need to power them from 5 volt output pin from Arduino this is a nice feature as you can use variety of input voltages and the light regulator will step down higher voltage to 3.3 volts so it will be safe to operate NRF 24 module and you will not accidentally fry them another great feature of base module is that it has set of onboard capacitors and these capacitors will help will help stabilize current when transmitting or receiving and this is mandatory when using high powered and RF 24 modules without stable power supply you will only have issues so I highly recommend using these base modules when using simple version of n RF 24 module the one with on board PCB antenna configured to operate at minimum power level you could power it directly from 3.3 volt output pin on Arduino but the range you'll get is just a few meters now for the setup this is Arduino Uno which is already connected to the base module here is voltage input and the ground voltage input VCC is connected to the five volts on Arduino and the ground is connected to the ground on Arduino other pins on the base modules are sieeping is connected to the pin 7 CSM pin is connected to the pin 8 SC K pin is connected to pin 13 mo pin is connected to pin eleven and the m1 pin is connected to the pin twelve on Arduino all right i RQ pin on base module is not connected because it's not needed for our operation when you want to connect it to our dinner you just put the NRF 1224 module to the base module and it should work also the other one this is the receiving unit the receiving unit is collected just in the same way as the transmitting unit and what I added here is a little buzzer and the buzzer is connected in a way that the plus sign and the buzzer is connected to the pin to an Arduino and the minus is connected to the ground on Arduino now we will see the sketches for the receiving and the transmitting unit okay before writing sketches for our transmitter and receiver we need to install a library we will be using in this video we will use RF 24 library by TMR h20 to install this library in Arduino IDE click on sketch include library manage libraries in library manager click on search text box and type RF 24 in filtered list of libraries find RF 24 library by TMR age 20 and click install I already installed this library but it will only take a few seconds for you by installing this library he also have many code examples which you can study by clicking on file examples and scrolling down to bottom you will find our F 24 submenu with those examples okay first we will go through transmitting unit sketch headers we need to include our SPI dot H n RF 24 L 1 dot H and RF 24.8 then we declare RF 24 object with name radio which is connected to pin 7 and 8 also we need to set addresses of our n RF 24 modules but since we will not be using bi-directional communication we only need one address in setup function we first start our radio by calling radio dot begin method then we set the address for a receiver which we declared earlier also we will set power level of our transmitting unit to maximum if you recall there are four different power levels you can configure since we will be testing maximum range we will set this to highest power level possible and this is max available power levels are min low high and Max friller on we will also set data rate to 250 kilobits per second there are three levels of data rate 250 kilobits per second one and two megabits per second love is data rate of 250 kilobits per second combined with maximum power level will give us highest theoretical range possible as this is transmitting unit and we won't be used by directional communication we will stop listening functions of the radio by calling stop listening method loop function is very simple we will send array of characters every 2 seconds to our receiving unit and that's it just upload this sketch to transmitting arduino with an RF 24 module and it's ready to go code for receiving unit is very similar with few differences again included header files and declaration of RF 24 radio object are the same here we need to declare pin at which our buzzer is connected and that is pin number 2 in setup function we need to configure our buzzer pin to output mode also the address for reception of data from transmitting unit needs to be the same as in previous sketch but this time we use open reading pipe method with that same address power level and data rate are also the same because this is receiver we need to call start listening method on our radio object in loop function we first declare empty array of characters with named text which will hold our received data then we check if data has arrived if that is true we will store data in our text variable although this step is not really necessary I declare another variable named trans data of type string and cast received data in text array to a new string variable this is to check if data received is the same as it should be but as NRF 24 has error checking embedded this is not necessary it's just a precaution if data received is okay we will send a tone of 1000 Hertz to buzzer on pin 2 for half a second and then stop the buzzer if you recall we configured our transmitting sketch to send data every two seconds so while in range receiving unit will make half second buzzing sound every two seconds and that will be method of simple field range testing okay so this is our test setup now we're gonna power it up to see how it works this is the sending unit it's working and this is the receiving unit and this unit will make a buzzing sound every two seconds for half a second so we got the signal it's working and now it's time for the range testing for testing the range of this setup I picked up nearly ideal conditions straight road with clear line-of-sight receiving and transmitting units were around one and a half meter above ground with this setup I managed to achieve 1070 meters of stable communication between 2 and RF 24 units without data loss you can get a few tens of meters more but about this line I started to get the data loss at around 1,200 meters no data was coming through so the cleared range of high-powered NRF 24 module is well within specification
Info
Channel: Tehno Manik
Views: 250,094
Rating: 4.9095449 out of 5
Keywords: Arduino, tutorial, NRF24, NRF24L01+ PA/LNA
Id: 57pdX6b0sfw
Channel Id: undefined
Length: 12min 37sec (757 seconds)
Published: Fri Sep 08 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.