#73 nRF24L01 Send (and receive) data with your Arduino!
Vložit
- čas přidán 25. 08. 2024
- New! ralphbacon.blog
Use your Arduino to transmit (and receive) data reliably with this easy-to-use module.
The nRF24L01 module achieves this beautifully - and with the excellent RF24 library from TMRh20 we can do just about anything you might think of.
However, in this absolute beginners' guide, we just scratch the surface but still managed to produce a useful transmit and receive sketch (originally taken from the above library but simplified even further).
The nRF24L01+ boards (but available in many places):
www.amazon.co....
The breakout board that prevents power-related issues:
www.amazon.co....
The library I use is very mature, s/he has several others too. See his/her homepage here, choose the RF24 library as I showed in the video.
github.com/TMRh20 or a copy from here:
github.com/Ral... or here
github.com/nRF... (thanks Ed19601)
Note that there are several good nRF24L01 libraries available out there. If you use another one bear in mind that the pin connections will be different. I chose the one above as it seemed to give us Arduinites a decent interface to the nRF24L01 module without too much mucking around.
My sketches (one for receive, one for transmit) even though both do actually transmit anyway (remember that each module will automatically acknowledge receipt of data unless you specifically switch off that capability - why would you do this?).
IMPORTANT NOTE: thanks to the Eagle Eyes of Arduinite viewer whitefields5595 please remember that pin 10, although not connected to the nRF24L01+ in this demo must NOT be used as a general purpose IO pin - it remains the standard CS pin of the SPI bus - and if that doesn't mean much just remember to leave pin 10 on your Uno or Nano unconnected whilst running this sketch!
------------------------------
DOWNLOAD HERE
------------------------------
github.com/Ral... --- click the Download button and choose the zip file, unzip and place each sketch in its own folder (of the same name as the sketch) in your usual Arduino sketches folder.
If you like this video please give it a thumbs up, share it and if you're not already subscribed please do so :)
My channel is here:
------------------------------------------------------------------
/ ralphbacon
------------------------------------------------------------------
How can I remember this? Memory tip: "See" Ralph Bacon, geddit?
Oooh, Mr. Ralph, THANKS SO MUCH!! I've watched a lot of tutorials on YT and not a single one has given me code that works, until I found your video. You've now erased hours and hours of frustration that I've accumulated from my other attempts. Great job with this video, Mr. Ralph! I will definitely check out your other videos. Excellent teaching style. Thanks again!!
Glad it helped! And you're Welcome! Glad you got it working.
Thank you so much for this video! My class really appreciates the content you put out (our teacher showed us this video) and we are looking forward to your future videos.
I'm glad it helped you and your classmates, GingerSkips! And thanks to your teacher for pointing you to this channel, great to have you along for the Arduinite journey. Thanks for posting.
For the integrated Nano3/nRF24L01 modules, you need to use CE=10 and CSN=9. This is opposite from what's given in all online examples I've seen. It caused me endless confusion until I followed the traces on the board to the pinout of the chip! People need to get in this habit and stop posting confusing information!
You know how it is, Cut & Paste from one example to another.
I tried during a whole month to have some success with the nRF2401 modules, I almost abandoned Arduino programming for my dissilutionment, until, mr. Ralph Bacon appeared in my CZcams browsing. The first moment, the sketches worked, and he explained here why you make the regular mistakes we make with these modules! Thanks, Mr. Bacon, and may you have good health to keep teaching us as you do.
I'm very glad it helped you, Pedro, thanks for letting me know of your success!
Ralph--great video! My grandson and I watched it, put together a couple of NRF24L01 circuits, put a send sketch on his laptop and the receive sketch on my laptop and it worked flawlessly the first time. We really appreciate your help. Thanks, Randy
Hello Arduinite! I'm currently on vacation 5,000 miles away from home so I'll have to be brief with these comments until my return, mid-July.
That's great new Randall, and I'm pleased you're sharing the fun with the younger generation too. Brilliant!
there are dozens of these nrf tutorials that I have looked through (and tested many). This was the one that made it all work. Excellent Job . thank you so much for sharing. Well done!
Wow! that's great news, Jeffrey, although I cannot take all the credit. Albert Einstein famously said "Make it as simple as possible but no simpler". So I do. Once Arduinites have grasped the simplest example they can build on that all by themselves, usually. So thanks for endorsing my "simple" approach (my brain can't handle complex anyway!), appreciated.
Great Sir, I have watched so much videos and non of them worked for me. I thought it maybe due to the noise but your single code worked for me and my wasted days are paid off. Thank You Sir.
Glad it helped!
Fantastic tutorial! Very easy to follow and the sketches loaded up and ran without any issues. Thank you!
Great news!
Thank you! Your video helped me to sort it all out. The tip to open two separate instances of the IDE: Wow!
And I'm very glad about that, Thomas, if this channel helps in any way then I have succeeded. Thanks so much for posting.
By far the best NRF24L01 tutorial on YT, can't believe how frustrating this can be. Hope I am up and running tonight with your assistance, thanks!
Let's hope you're successful, do let us know!
I've got the library installed fine and the transmitter code uploads fine to my Uno! However, the code fails to upload to my pro micro (other example sketches and ones I have written upload to this pro micro fine, but I just bought it)- is the code incompatible with a Pro Micro? Because I was have space constraints with the transmitting device. Thanks for the help, I feel confident with some fiddling I will finally get it!
If you have selected the correct board / CPU / speed etc then it should upload. I choose the Leonardo board for my Pro Micro (from Sparkfun) and my computer even says these on the COM port allocation - check there too, see how it identifies itself. Take care with this board, as it's easy to brick it (I did a video on that too). TBH I'd try a Mega if you can't get this working, you can get one for about £5 / $6.50 from the Far East these days, which will sort out your memory constraints.
I just received my NRF24L01 modules that I ordered off of ebay 4 months ago, so I'm quite anxious to give them a try. Your tutorial is a fantastic jumping off point. Thanks!
Yes, indeed, Tony, just follow my video *exactly* and you will have no issues. And if you have not yet bought the (very cheap) adapter plates for these modules do so *now* as it sorts out all the power issues that people stumble over! Great to hear from you.
AFTER 1,000,000 TRIES, WITH 100,000 PIECES OF CODE, THIS IS THE FIRST ONE THAT WORKED. THANKS. I have never had a harder time with a piece of code and devices. How ridiculous this took so long. It must have been just a combination of many things. I can now finally do stuff. Great tutorial. Subscribed. Thumbs up. Thanks.
I can feel your relief from here, Jeff, and it is so rewarding that I can help people get their projects off the ground. Thank you so much for posting this, it's feedback like this that keeps me going! One caveat: are you using the plug-in adapter boards for this device? If not, do yourself a huge favour and get them, they are really cheap (even on Amazon) and stop any power supply-related problems down the line. Thanks again for posting, great to hear from you.
Absolutely I am using them, thanks. I tried one time for 3 weeks using the high powered versions and I could never even get them working. This time I bought the normal versions, plus the adapters, plus your code, and finally it worked. Now that I have this working, I will go back and test the high powered versions. You do a really great job with your videos. It is the clear thinking and clear explanations that people appreciate. I need to check out some of your other projects. I see one there with EEPROM basics. That was another hurdle I had to get over as well. None of this stuff is simple when you combine all the hardware, software, and gotchas. I don't have a youtube channel but I do have some really cool projects related to some of your stuff. I may send you some links someday so you can check them out. ...because most people I know are just not interested. They just don't get it.
Some people "just don't get it" in the same way that I just don't get sport. Really. I just don't care about football, rugby, tennis, golf... the list goes on. I probably watch about 5 minutes of sport a year on the TV. I just don't get it. People are different I guess, thank goodness, imagine if there were more of me! But keep going, Jeff, because you *do* get it.
Really clear tutorial and has encouraged me to pick these back out of my electronics bin. Thank you.
Glad it has inspired you to re-try these devices, Terry, they're pretty easy to set up (usually!). Thanks for posting, good to hear from you.
Thank you so much for explaining this so clearly, i even learned how to properly add to library.
You have made my day.
That's great news, Mark, it's not often I get to make someone's day. You may have seen the humorous quote: "I can only please one person per day. Today is not your day. Tomorrow doesn't look good either." How WRONG that is, as you have proved! Seriously, I appreciate the post and it's great to hear from you.
Ralph S Bacon
Keep up the good work. I'm definitely guided by your footsteps for this rf project.
nothing compares to British education - great learning resource that actually works mate! thanks!
Glad it helped, Noli, thanks for posting.
So i commented 2 days and some hours ago that PA+LNA modules were not working. What i had done was i had plugged the antenna into a breadboard to kind of understand better(although it was harder to understand), then the breadboard forwarded the connections to arduino uno, effectively using 2 cables. Turns out my code wasnt working properly because the wire length does matter, cuz we are in the Microseconds. Thanks SIr and the guy who commented about using shorter wires down in the same video!!!
Does the module not just have a standard IPEX connector, or something else where you connect the antenna directly?
Mine certainly have an IPEX connector (I chose them because of this) so no wires to solder at all - precisely because of the issues I knew could be lurking which you have discovered (and fixed 👍)
idk what ipex means but it could mean 8 pins that are easily connectable, in this case, unlike cameras that need to have an adapter board. I thought it would be easy for me to connect the antenna to the breadboard and remember the configuration 1,3,5,7,2,4,6,8 pins and wire that way.@@RalphBacon
The IPEX connector is a tiny gold circular connector on board (only about 3mm diameter), to which an aerial cable snaps into: bit.ly/ipex-and-cable
But I have also used this type where the antenna screws directly into the module: amzn.to/3GBdxZu
Just easier than trying to wire up an antenna.
@@RalphBacon oh i have an old remote with 2 ipex connectors, it has a fulhan microprocessor which is a chinese company, i couldn't find any documentation for it. But these have screwable antennas here.
Hello Ralph, thank you for a great tutorial .It worked straight away for me . this is an excellent platform for newbies to start from ,very simple and easy to understand .This can be the basis of many projects. Well Done! Keep those videos coming.
Glad you liked the video Steve. +Raad Yacu (see below) reminds us all that the data length is limited to 32 bytes at a time. I will have to look at the libraries for this device to see how they get around that (probably multiple transmits). Thanks for posting!
Such a good video, I was about to quit trying to program these antennas, but this video saved me, thanks.
Great to hear! They are very good modules (but be aware - and beware - that there are fakes out there, always get original Nordic devices).
@@RalphBacon thanks for the answer, and i'm sad to announce that mines might be fake cause I tryed every tutorial out there, copy and pasted the code. But no signal reveived or sent. I will buy some new ones thanks for telling me. Btw I got the ones sold by WayinTop, they are the only on amazon( the ones with the antenna).
This is the only useful tutorial for beginners on CZcams. Bless you man!
You are most welcome Asaad Iftikhar, I'm glad you like the video. Nice to hear from you.
Thank you for explaining everything down to the smallest details. Made working with these modules so much easier. Getting your example up and running made first, helped me see what goes on in the software. Thanks again, Bob. Subscribed to your channel.
Glad you liked it Bob, and thanks so much for subscribing too. I do like these nRF24L01+ modules, they are very powerful, especially the ones that have an external antenna (not needed for most home use unless you live in a castle). Great to hear from you.
I love your videos! The best I have found. Keep it up! I also like how you keep on uploading too.
You are most welcome MiniminerX, I'm glad you like the videos. Nice to hear from you.
I found this tutorial very clear to understand well explained in layman's terms for us beginners i look forward to viewing more of your tutorials in the near future, Thank you very much Ralph . Mark
Thanks for your kind words, Mark, I'm very glad you found it clear and easy to understand - especially for beginners. That is the whole point of my CZcams channel. Great to hear from you.
**READ**
Ok, to try to save everyone the headache I had when trying to replicate this tutorial, follow these steps.
1. DELETE all other RF24 libraries you have on your computer, they're not all the same even if they have the same name and seem to have similar functions.
2. Down Ralphs's folder (includes a wiring schematic, sketches shown in the video, and the library) provided in his description.
3. Add RF24 library from downloaded folder in step 2
4. Open Ralph's sketches and see if they're working as shown in the video. If they are, then tweak to fit your own design.
I spent a lot of time trying to make this example work on a different library (same name) I had installed on my computer. It almost worked, but the data got stuck sending it back to the master.
Thank you so much Ralph for helping with this excellent, concise and organized tutorial.
Thanks for posting this, it will sure help everyone who tries to follow this demo, that's for sure.
It's definitely helping me! I couldn't get it to work even after I soldered a 10uF capacitor to the NRF module. :) I will follow your instructions and hopefully I'll be ok. :)
I just did that and it doesn't work: I'm not quite sure why. I tried another code and that other one works. Could it be something about the module I'm using? Maybe it's a cheap brand and it may not be reliable? Is there a way that I can do a step by step check?
@@Taran72 BIG OOF
@@alexliu694 : I'm learning....just asking a question. :) By the way, since I added this comment I managed to resolve all the issues I had. :)
Transmission of multiple variables
As a give-back to the channel, here is the code to use if you want to transmit multiple variables. It uses structures in C. Note each variable can be any data type and all can be different (int, float, unsigned long). However the max size of the whole package is 32 bytes = 256 bits
TRANSMITTER ...
// Top of file, in declarations, before SetUp
typedef struct{ //declare the structure for transmission
int A0; // 16 bits
float Temp; // 32 bits
unsigned long Heartbeat; // 32 bits
// add next one(s) here, but keep total struct package size to 256 bits (= 32 bytes)
} xfer; // name of the structure above
xfer TXpackage; // TXpackage is a type of structure xfer
void loop(){
// read the sensors and put the elements into the structure
TXpackage.A0 = analogRead(A0);
TXpackage.Temp = sensors.getTempCByIndex(0); // Read Dallas18B20 on OneWire
TXpackage.Heartbeat = millis()/1000; //used as a heartbeat to confirm transmission
// add the next one(s) here
radio.write(&TXpackage, sizeof(TXpackage));
---------------------------------------------------------------------------------------------------------------------------------------
RECEIVER ...
// Top of file, in declarations, before SetUp
typedef struct{ //echo the structure so variables can be received in the same order
int A0;
float Temp;
unsigned long Heartbeat;
} xfer;
xfer TXpackage;
radio.read(&TXpackage, sizeof(TXpackage));
Excellent contribution, whitefields5595, very useful and easy to follow using a struct, an underused data structure that is so easy to use.
Thanks for contributing this.
Makes life a lot easier, thanks
Channel 124 is a good one for me here in Grenoble, France. Thanks for the tip, Ralph!!!
Fantastic! Well away from microwave ovens!
@@RalphBacon Default channel gave short range (2 meters). I live in a WIFI jungle. Channel 124, 2 brick walls, 2nd floor, and my birdnest breadboard yields 0/100 CRC errors. Waiting for LNA with antenna to top this score.
just built the above circuit and really made up as this is my first success on arduino wfi using nrf24lo1 thanks alot
Well done, John, so glad it worked for you. Thanks for posting.
Excellent Video, Ralph. The R24 looks to be a Godsend. They appear to have encapsulated a LOT of admin and distilled the developers contribution to be no more complicated than using Serial. As to dupont cables: positively the worst plasticine I have ever tried to use. Keep up the good work Ralph. Brilliant channel!
You're too kind Michael (but I'll take all the praise I can get)!
Yes, I like these little RF24 units. I was going to use them to monitor my water tanks et al in the attic but I think I might use an ethernet enabled Arduino instead (my next video, oops, spoiler alert). BTW I like dupont cables (I have dozens, all lengths and configurations) but if you ever strip the insulation hoping to use them as real cables to wire stuff up with, then -- don't! They only have about 6 strands in them! OK for breadboard lash-ups but no good for real project work.
Thanks for posting, good to hear from you.
Thanks for the heads up on stripping Dupont wiring. I have found similar results when trying to strip the cables that come with "wall wart" power supplies. It is almost as if the insulation is just sprayed on to copper strands as fine as human hair.
Your thoughts on using ethernet instead of the RF24 units are interesting. I was thinking of using the RF24s in place of ESP2866 wifi units.; having the various nodes communicating with a base which is also in circuit with just one ESP8266. The base would thus handle the IOT & time-of-day admin for all the nodes; including buffering node data, should the WiFi router (or the ISP network) go down temporarily. Do you suspect the reliability of a network of RF24s?
I don't suspect the reliability of a network of RF24s but you can only use about six, I think, without creating a mesh. But the same chap who wrote the RF24 library I used also has a library for that. I suspect it's a bit more work for you but you can read up about and then decide. I like the idea though, of a network all controlled by an ESP8266 hub. Your house will be truly part of the IoT movement!
Ralph, thank you soooo much for this video, found your channel this weekend...... have been wrestling with these little blighters for for ages, couldn't get anything working, this has re-kindled a project idea I have had a for a while... thanks.... keep up the good work!
Welcome Tony! Yes, once you have a demo it all becomes very simple, does it not? I'm hoping your interest extends beyond nRF24's and into all things Arduino, in which you have definitely found a channel for you! Enjoy (and subscribe if you think this is for you). Good to hear from you.
Thank you for this video. I am using this to confirm all the NRF24L01 I ordered are functioning.
Yes, indeed, shiister, this would be a very good sketch to prove that the units work as expected. Thanks for suggesting this and for posting.
This video was super helpful in getting my self balancing robot and remote controller to work. I would have spend days sorting it out otherwise! Thanks Ralph!
Glad it helped!
Ralph, just subscribed after watching this video. I am working on getting analog sensor information back to an Arduino in the sun room that runs my irrigation. I didn't want to lay cable to the sensors to cover the 30 feet or so, so I ordered 2 of these to do the trick. Your video helped a great deal as my garden irrigation project is my first one! Just have to now learn how to send the data from the sensors back to the main Arduino. Thank you again for the well thought out presentation.
Hello Arduinite! I'm currently on vacation 5,000 miles away from home so I'll have to be brief with these comments until my return, mid-July.
I'm so pleased it helped you, Lawrence (Larry?), really I am. Remember that although I have called one a transmitter and one the receiver, they BOTH send data to each other in my demo, it's just the transmitter that initiates the whole process.
Ralph - I hope you enjoy holiday, and thanks for the reply. I am awaiting the modules to regulate the 5v to ease the hookup. I certainly do remember that both units talk to each other. Once the modules come, I will start trying to get the soil moisture sensor and the rain sensor to transmit back to the main unit. One idea I had to prevent, or at least slow the corrosion of these sensors, was to power them on only when I need a reading, about once every half hour. Lots to figure out still!! Larry
Yes, exactly what I do for my rain sensor. Power it up, take a reading, power off. No noticeable corrosion after several weeks. But mine are not buried in damp soil so your mileage may differ!
Excellent explanation. I've just reproduced at my lab with two Arduinos Pro Mini and it is working very well.
Excellent news, Julio. Did you use the adapters to plug in the nRF24L01 modules? If not, get some (they are very cheap, I got mine from Amazon) and prevent lots of problems due to the power being insufficient at anything above Minimum Power Level!
Thank you very much, this really got me understanding the NRF24L01 and its up and running great.
Hello Arduinite! I'm currently on vacation 5,000 miles away from home so I'll have to be brief with these comments until my return, mid-July.
Glad it helped you, Steven, that's what this channel is all about!
Dear Ralph, Firstly Congratulations and thank you so much on a brilliant piece of work on nrf24l01 module. I have been watching a lot of videos with respect of IOT and especially on Arduino and trust me this was so simple and easy to understand am very sure Albert Einstein, would be super proud of you.
I am yet to lay my hands on this both the Arduino & nrf24l01 and will keep you posted on the results that I get.
Thank you once again for your efforts, God Bless.
Best Regrads
Zubin.
Glad you found it useful and easy to follow. I think Mr Einstein would say that I could have made it even simpler but, hey, it's a good starting point. When you order the nRF24L01 modules DO remember to order the adapter plates too. Makes everything much easier (and safer) to wire up.
Dear Ralph,
I finally managed to build the solution at home and it worked just as expected. I did mess up with the Pins initially as I was doing this exercise by looking at 2 different videos, but then it was good to make a mistake and I realized that using a wrong pin the Transceiver looped into itself. I am yet to receive those adapter plates that you mentioned, they are on their way. Thank you once again for your efforts and time that you took to post this video.
I shall keep you posted on my next work that I plan to do on this. I plan to extend this exercise to switch on and off a relay to switch on and off a bulb. Till then Good Bye and God Bless.
Thank You very much for this tutorial. I finally menaged to get this thing working :)
Hey Ben, I'm trying to interpret your post's meaning:
1. After a lot of trouble following your video, Ralph, I FINALLY got it working anyway.
2. I've had this unit in my box of components for ages and now thanks to your video, Ralph, I've FINALLY got it working.
I'm hoping it's #2, especially as you are good enough to post your thanks here, which I humbly accept. Good to hear from you (and I knew what you were saying but it's Sunday afternoon so a bit of humour is OK here, right?).
Yes it is :) Now I can move on with my project. I subscribed your channel and hope you will keep up the good work.
The video helped, I had stayed away from the nRF24L01 as they seemed to complicated. Thanks I plan to order some and give it a try.
That's great news Robert! Let's face it, if you replicate exactly what I had in the video (with or without the adapter although I recommend those too, especially for anything other than low power usage) then it's going to work. So you have a working prototype that you can then enhance it to suit. Glad you feel inspired, thanks for posting.
Thank you for the tutorial. I’ve watched a bunch but this is the first which I’ve followed. Worked a treat.
The only error which I ran into was I used an external power source and forgot to ground a board. Obviously worked straight away once I realised the problem.
Again, thank you.
Glad it worked, Chris, I hope you're using the adapter boards?!? Cheap and save a lot of heartache.
Ralph S Bacon I am not. Not been doing this long but a lot of parcels are starting to arrive from China ha. I’ve ordered one today. Couldn’t find one for a Pro Mini, so will make something similar on perf board. Cheers
I was referring to the adapter boards for the nRF24L01+ modules.
If you use them bare (like I did in my video, I know, bad example) you have to wire them "from underneath", easy to get wires crossed (don't ask me how I know this) and the power for the 3v3 module cannot be successfully supplied by the 3v3 pin from the Arduino unless you're using the lowest power possible (like my demo).
Once I got the adapter boards it was *so* much easier to wire up and all power issues disappeared because you supply the adapter board with 5v not 3v3 and the Arduino has enough 5v current to go around!
Ralph S Bacon I did use the adapter boards but I want to use them within a project with everything powered by 3.3V. So I was considering not using the adapters. So I’m glad you mentioned that, as it probably wouldn’t work. I’ll have to supply the Pro Mini with 5V and take a supply from the source for the nRF24L01+
Yes, I also tried a number of NRF24L01 transceiver project some worked but soon after they stopped for no apparent reason. I am quite sure it had to do with interference from other channels so the key difference here is the line: // Use a channel unlikely to be used by Wifi, Microwave ovens etc
radio.setChannel(124); I just started it an hour ago and it's still going!
Thank you so much !
You are most welcome Jacob Endure, I'm glad you like the video and found a solution. Nice to hear from you.
Cool, several years ago, I purchased a lot of these, ten I think it was for not a lot of cash. Back then everyone said solder a capacitor on so I did that after they arrived, then put them in my storage bin, where they have lived, untouched by human hands ever since. You see, right after that, we were introduce to the ESP8266 which was much easier to play with and includes a micro-controller on board. So it is, when I need to communicate, I just do it over wifi, or if need be, go to the ESP32 and use Bluetooth which is so much easier now in its version 5 on my new Christmas/50th Anniversary gift from my wonderful wife. Since it was a combo, and since my old laptop has given up the ghost, I opened it early and am typing on it now. Man what a difference, I love the instant on with the solid state drive, the 4K display is so sharp I now see all the blemishes on the talking heads on FOX News, and as I say the Bluetooth works much better with very quick connect and very few dropped audio to my hearing aides.
Oh dear. That is very bad news for me then, Jerry, With a 4K UHD screen you will see all the flaws and artifacts in my videos too! I don't think I will record in 4K just yet - not without a soft focus filter over my camera, anyway!!!
I have several of the power adapters shown at 4:26. They can be used without a breadboard by using the 8 connectors on top; 2 each 5v & 3.3v plus 4 ground pins. Stick the pins on the bottom in a piece of non-conductive foam to protect them.
A great way of using those power adapters, Art, thanks for pointing this out. A clever piece of lateral thinking, that they don't *need* a breadboard to work! Thanks for the post, others will doubtless find it useful too.
Ralph, Followed this and it all works OK, so thanks. I bought the bare bones NRF24L01 board in Jan 2018 which may not have been available when you first made this video. The board terminates in 8 holes in a line (not breadboard friendly though as pitch is small), but I wanted minimal size.
I soldered wires onto these pins and connected as follows
nRF pin 1 is TOP RIGHT if you hold it with the pinouts uppermost and chip facing you ....
nRF24L01 pin Arduino pin
1 VCC 3.3 V from external source
2 GND GND
3 CE 7
4 CSN 8
5 SCK 13
6 MOSI 11
7 MISO 12
8 IRQ GND note the IRQ is not used here so tied to GND for safety
I did not add any external capacitors or other componentry. If you add this to your next update others will benefit.
Interesting development there, whitefields5595. Is it one of these (from AliExpress): www.aliexpress.com/item/2PCS-2-4G-nRF24L01-RFID-Wireless-Transmission-Module-2dBm-1mW-2-4GHz-wireless-adaptor-100m/32848645230.html
I notice that you are supplying 3.3v from "an external source" - as long as it's not an Arduino then that will prevent a lot of power-related issues that everyone seems to have (who does not use a 5v adapter board). Thanks for the heads up.
Ralph, yes it is similar to the one in your link. I traced the terminations back to the chip. It is not a good idea to use the Arduino as a power supply, and you have pointed this out. I think you should stress it every time as newcomers may become complacent. One of the first things to go wonky is the Arduino's A/D converter. The adapter boards you use are as cheap as chips ;)) so there is no excuse for not doing things correctly. You have to do it right in the project, so start the way you mean to go on. Of course, none of this high moralising is a result of experience as I would never dream of doing it..
Ha ha! Of course not, we all do it right first time every time, right? That said, my video shows that I didn't use the adapters for the demo, but I was irritated by the wiring from below and as Amazon were doing them cheap as chips it seemed obvious to try them out. Cranking up the power was then fault free. Thanks for the update, I will take note of these new offerings.
Today, I connected together a couple of nRF24L01 with adapter boards using two nano arduinos on breakout boards. One unit had a pot and the other nano had a servo connected. Servos cause current surges and need a 10uF 25v cap and without it, the servo doesn't work. I fitted a tantalum cap to both nRF24L01 boards between GND and VCC near the xtal and the servo worked really smoothly. I followed Howtomechatronics video. Dan does say a cap is needed. Hope this helps anyone having problems with the nRF24L01.
Excellent, thanks for sharing that useful tip, Binary box.
Couldn't be any clearer than this. Thanks :)
Glad it helped!
Very clear and simple. Big thanks for making it. Btw, it would even better if you put the wiring section at the end of video to the front. Tks!
True, sze Henry, true, and hindsight is a wonderful thing. I think we all should have more of it! But I'm glad you like the video, they are really quite wonderful modules, especially when used with their adapter plates. Thanks for posting.
IT WORKS!!! I've been trying multiple tutorials. Yours was the only one that worked for me. Could you try doing an NRF24 network next?
You sound surprised, Aaron! No more than me, really. 😱
But I'm not going to do a (mesh) network though, sorry, as I have no need and it just seems like an overly complicated way to send data around! There is a demo sketch in the stuff I put on my GitHub so you could always have a go. May the force be with you...
Thanks for posting, good to hear the positive feedback.
Very clear tutorial, Thank you.
Glad it was helpful!
Hello from India.... Thank you very much Sir for the great tutorial ...I am planning to make water level indicator for water tank in my house which is on first floor and should send data at ground floor... So planning to use this transceiver..your tutorial is great help.
That sounds like a great way to use this device, Sameer. Good luck with your project.
Nice! I didn't notice there was an option to send audio using an rf24. Gotta explore that in the future.
Sending audio is tricky. Here you have just 32 bytes max to send in a single packet. Given that a simple .mp3 will have some 4Mb for a quality CD track, that's a LOT of packets. There's probably a better way to send audio, probably BT.
Oh my ears are happy. There are some great tutors on youtube and i can't take that away from them but whiny American accents drive me insane. Even the accent of a southerner is music to my Leeds ears ;-) Great tutorial, Subscribed.
Wow, thank you! Nice to have you along, Andy. 208 videos and counting. If you look at the PDF file link in all my video descriptions you can search for topics or keywords - I use it all the time!
@@RalphBacon No worries. Hope you're having a great Christmas. While i'm here, could you tell me if it's possible to somehow create a network bridge with an NodeMCU V3? I've built a central heating controller which communicates with a number of ESP8266-01 modules sending temp data. I am fairly new to this stuff but finally managed to get them communicating using a NodeMCU as a soft AP webserver. The clients connect, send temp data and then sleep. Is it possible to also have the access point connected to my local LAN? I'm using the remote XY android app to show temp readings and change setpoint which is currently running on a single NodeMCU with DHT11 and control relay directly attached and connected to my WiFi as a client. My aim here is to have the temp sensor in a different location to the relay. A point in the right direction would be massively appreciated. I also have a couple of ESP32's but haven't really looked at them yet.
I have a 1/2 dozen of these and never used them. My plan was to have 1 in each greenhouse ( 3 at the moment ) to transmit temp, light level and such back to the main house and to the IOT thing. ( Mobile App thing ) Perhaps it's about time I started getting familiar with these devices. Thanks for the kick in the ass to get me going.
Indeed, Darrell, consider this an Arduinite kick in the ass!
Now that you have an ultra-simple demo to follow, I reckon you'll only have to change the amount of data to transmit. If you make a fixed string size (temp + light level + humidity + whatever) as a string or char[ ] then you will have no trouble doing this. It's how I did it in my 433Mhz rain sensor project a while back. In some ways I wish I had used this nRF24 device if only because it guarantees reception (or tells you it failed). That said, my rain sensor project has worked beautifully ever since I installed it so maybe I have a (new) solution looking for a problem (and what's wrong with that? heh heh!).
Anyway, I hope this has fired you up to get that greenhouse project underway ready for the Spring 2017 (assuming you live in the northern hemisphere).
Spring will be here any day now as I live on Vancouver Island In Western British Columbia. Although for a known mild climate this year winter is sticking around much longer than usual. Global warming my ass.
I shamefacedly admit to having to look up that location, Darrell, but having discovered it is in Canada, no wonder it's cold! I think UK weather is sometimes weird but at least we don't have bears wandering around . Now if you could just slip a nRF24 on a collar round a bear's neck to track him that would be a good project...
USB setup. Only needed once. COMxx? xx is what I found available as nano units plugged in.
TX is port COM51.
RX is port COM14, set by device manager, advanced settings.
1. Unplug both TX and RX from USBs
2. Start TX program (node_1). Make sure COM51 selected
3. Plug in TX (com51)
4. Start Serial - It should give 'THIS IS THE TRANSMITTER CODE...'
5. Start RX program (node_0). It will say port is COM51. Make sure COM14 selected
6. Plug in RX (com14)
7. Start Serial - It should give 'THIS IS THE RECEIVER CODE...'
8. Should all be working. Fail? Back to the top and try again after closing both Arduino IDE programs.
Best of luck!
Now to do some serious stuff and programming, after this distraction.
Great info, Neil, the Arduino IDE can be very picky about all this (which is another reason why I tend to use the Eclipse IDE). Thanks for posting.
@@RalphBacon
For serious work I use the Atmel IDE which handles Arduino stepping forward. Once there, there is no going back, easily. It also shows the shortcomings of the Arduino IDE when it comes to correct c++ structure and conventions. Handles c modules properly, too.
I've had some bad luck with the Dupont cables, many fail and some come without continuity from the pack. I am ordering a set that one can make them and includes a special plier. Too many obstacles here, but I am persistent to overcome obstacles.
I've got the metal pins and sockets and the shrouds (plastic headers) and the correct pliers (not cheap). Whilst I can now make some wonderful cables, Pedro, it is a fairly slow process! But sometimes you need a quality cable. Dupont is only OK for breadboard use, not a permanent project.
Works well Ralph thanks, didn't initially though but my nano's 3.3v output is 3.5v and i suspect there is noise on the line, scope not to hand at the moment) A 47uf on each nrf sorted for now until i use the adaptors.
Oh, yes, do get the adapters, Emmett, it just makes using these great transceivers so much easier. Glad you got it all going without them though! Thanks for posting.
hey, one thing i discovered while working with the nrf24l01 pa lna is that my jumpers where to long, they were about 10cm an that was to much, i soldered everything to a perfboard and now it's working but i got me a lot of grey hairs till i figured this out, winding gnd around mosi and miso should work too
Interesting, thanks for the heads up!
Great video thanks !
Glad you liked it!
I am going to try to apply this.
Indeed, Jan, go for it. BUT please take note of the following, to avoid some of the "speed bumps" that others have come across.
1. Use the adapter plates for the nRF24L01 boards! They avoid all sorts of power issues that manifest themselves, and make it easier to connect the device using Dupont cables (as the cables are on TOP of the board not underneath it).
2. Use the EXACT same sketches that I have used (one as the 'master' transmitter, one as the 'slave' receiver that also transmits back a reply.
3. Use the exact same nRFL01+ transceiver modules that I have used - others have discovered that different modules won't, for example, allow you to transmit at 250kbps (and who knows what other differences there might be!).
And do let us know when you have it all up and running! Good luck.
Just for people struggling on this something I did to fix everything was replace the library for RF24. I noticed I had a bunch of SPI.h files and the folder itself was like RF24-something so I deleted the folder and downloaded the zip from ralphs page and everything worked.
Glad to hear it, Ryan! 👍
sir, iam always getting the " No acknowledgement of transmission - receiving radio device connected? No response received - timeout! " message . what may the reason....
Hey Abhin Raj! Well, according to some people here you need a *stable, low noise power supply*. And you must test on the low power setting first. You can change the speed setting to
radio.setDataRate(RF24_250KBPS);
I'm assuming you're using the two sketches I used in the demo otherwise unaltered? Are you using adapters (5v) or connecting up the nRF24L01 units directly to 3.3V?
You can get adapter plates for $.50 or less, postpaid, on AliExpress.com -- Bangood looks to be almost always way overpriced. You can also get the same two boards with SMA connector and antenna at AliExpress for $1 less than you paid. Or you can go on Ebay and pay 5x to 10x the same price as buying direct from China. The only advantage I've found to using Bangood is occasionally/rarely they have something that AliExpress doesn't offer. Thanks for all your great videos.
Do you know what Art? I too have found Banggood to be quite expensive lately. I put it down to the value of the British Pound dropping but even looking at the $ prices makes me think you are absolutely spot on. And AliExpress is like a mini-eBay in itself, the service is good and the prices competitive. I've bought some stuff from AliExpress but Banggood (and Gearbest) were always convenient but now... well, your experiences seem to coincide with mine. Interesting that you point this out, not just for me but others too who read this, why pay more when you don't have to? Thanks, too, for the encouragement, it's great that my Arduinite viewers like my videos. Great post, appreciated.
@@RalphBacon Unfortunately Ali Express does not accept Paypal, unlike Banggood. And somehow I always feel better when using Paypal rather than sending out my credit card details.
Good day, Ralph.
Simply the best ever tutorial on the nRF24L01+ I’ve tumble upon as of yet .. AND IT WORKED THE FIRST TIME !!
Superb explanations and I WILL follow you since my objective is to make a Weather Station as mentioned in your video. I said to myself « This guy just read my mind !! .. Yes, YES !! Teach me how to send Strings variables over this module … ‘Master’ ! » Hahaha!
My Weather Station is complete. I’m using DS3231 RTC for time reference and a BME280 for Temperature, Humidity and Pressure. Also using a CdS Cell to read illumination .. just for kicks and .. why not ? For the present time, I display this info on a minuscule SD1306 OLED Display on the exterior station. I plan on using a small 2,4 inch TFT display and graph the information for the last 48 hours on the interior part of it. I’m not there yet, since I still have to learn how to work the TFT.
My main concern for now, is sending Strings to the other side. I’ll try to find the information on your other videos before seeking your help on that specific point. I hope to find it soon.
Until then, I wish you a good day and keep on the good work.
Best regards,
Daniel Lachance .. aka « Uncle Dan ».
Glad you found it useful Daniel!
Now, strings are an uncommon thing to pass around; much more useful is a flag or integer that means the same as a string. What are you doing with strings, Oncle? Remember you only have 32 bytes in a packet to transmit.
Good Day, Ralph. It was with great pleasure that I read your reply, and I thank you for doing so.
Actually, I could get away with pushing long integers values through that Pipe. The actual informations I want to transfer is Year, Month, Day, Hour, Minute, Second. The rest of the informations are mainly of float type, since they have two decimal values. They are Temperature, Humidity, Atmospheric Pressure and Degree of Illumination. It would look like this (I added the comas to separate the values) :
« 2019, 06, 19, 15, 24, 00, 25.34, 45.39, 1003.84, 19.35 »
I kind of tweaked your Code a bit but with mixed results. I guess I need more tutoring on ways of passing data in the Pipe. Hahaha! Last night, while loosing sleep on the matter, I thought about shoving the info into an Array of [11] cells, and finding a way of passing it through the Pipe one [cell] at a time. This is still under work. Any help from your part would be well appreciated.
Until next time we chat, I wish you a very good day and, like I said before, keep on the good. work !!
The way to do it is not with an array, but with a struct. A struct simply defines a group of otherwise unrelated variables both on the sending and receiving side. You have 32 bytes max available to send in a single packet with the nRF24L01 so you could reduce that by, for example, sending 19 instead of 2019 as the year (two bytes saved). If you need further help, find my email address in the About tab on my channel and I'll send you an example. Don't lose sleep on this!
Hi again ..
Well, I thought sending the temporal data at first, the the environmental data as s second burst. This way, I can't bust that 32 bytes barrier .. But I just can't see how the « struct » works. (Yes, you can call me 'Green'). Hahaha !
Thanks for the helping hand, Ralph. I greatly appreciate it. Have a nice day.
If you find my email address in the About tab I'll send you a quick example.
Masterful, thank you very much!
You are most welcome Fogata, I'm glad you like the video. Nice to hear from you.
The weird thing about using these PA + LNA modules is that the receiver side works properly, its not an arduino issue, but the transmitter side doesnt. For some weird reason, shorting the two pins with your finger makes the output of com3 go mad, which is very very weird.
another weird thing that the arduino at the receiver side is doing is that when i short gnd and vcc on the receiver side, the transmitter side stops outputting on the serial monitor, please make a video on this sir
All I can say is that the PA+LNA versions work just fine "on my machine"! I don't recommend shorting GND and VCC under any circumstances, are you sure you meant that?
@@RalphBacon Sir i do know what happens when you short vcc and gnd, but for some reason it does make it work, still i find it weird. Let's see on the weekend, i hope i can get the antennas to work, I'm buying the no antenna module to see if they work
Thank you so much from your lenson !
Thanks for your post, Thuan Duong, good to hear from you.
Very nice!
Thank you! Cheers!
Yes it does the random numbers communication is perfect
also the pulses from the digital potentiometer I can see them on the transmitter also the pulses. on the receiver side I see the random numbers produced but nothing of the potentiometer. God bless you thank you
OK Demetrios, that is good (I asked because some viewers are having difficulties in getting that demo sketch running, probably as a result of noisy power issues or frying their nRF24L01s by using 5 volts).
What you need to do is read the potentiometer value via the analog port (you suggested A1) then transmit that *instead of* the random number. However, in my demo sketch I am only transmitting ONE BYTE - which can contain a maximum value of 255 whereas the analog value can be from 0 to 1023. So for test purposes only, you can *map* the analog value to a range of 0 - 255 like this (which I have demonstrated in other videos):
char getPotValue() {
int potValue = analogRead(A1);
return map(potValue, 0, 1023, 0, 255);
}
Which means, take the potentiometer value and constrain it from its value of between 0 and 1023 to the new range of 0 and 255.
I'll leave you to experiment but this should be very straightforward (and help on the *map* command is on the Arduino.cc web site too).
Good luck!
Just found your channel and I have a question. I bought 433 MHz modules but they interfere with my weather station and they are very sensitive to noise. I need to transmit a RS-232 signal (5 bytes) from a PC to an Atmel microcontroller. Is this possible using these modules?
Hi Thor! Yes, I've found the 433Mhz modules are pretty dumb inasmuch that they interfere with one another as well. You can certainly transmit data from your PC to an Arduino but I have only done this using two Arduinos (one transmitter, one receiver) and using Python on the PC to send data via the standard USB to the transmitter Arduino (all simple stuff). No RS-232. Do you need that or is it just a communications protocol you thought might be required? This is reasonably straightforward, so much so others might benefit with a video on how to do it... let me know exactly your requirements.
Hi Ralph. Thanks for your answer. I'm a modelrailway enthusiast and would like to have small scale 1:87 trucks driving, just like they have at Miniatur Wunderland in Hamburg. If you don't know this please check out their website. You can also find lots of videoes on YT. I control my trains from a PC using homemade MS VB software. Partly using industrial I/O and partly RS-232 communication. My experience is that USB and VB 6.0 is unreliable. In Hamburg they use IR to control their vehicles but I can't get the range I need and therefore thought of radio communication. My plan is to put a receiver in each vehicle and send commands to each vehicle. Each vehicle will have an AtMega 88 to control it's functions as well as receiving data. Each vehicle will have it's own unique address, hence 5 bytes. 1 address byte, 3 bytes data and 1 byte checksum. I'm an electronics engineer so I can make my own hardware, I can develop SW for Atmel and program chips using the Atmel STK-500. I haven't tried using STK-500 with Arduino but it should be possible. Hope this gave you an idea of my project.
I don't know about USB and VB6.0 being unreliable as I stopped using VB6 about 10 years ago and now it's just a dim and distant memory!
If you used a more recent programming language (Python seems to be the "in-thing" right now) you would have no problems using USB. Python (to me) is a strange mixture of C-like syntax with Visual Basic included (from someone who has never programmed in Python). But you could use the Python "Processing" IDE that is *very* similar to the Arduino IDE (see processing.org/reference/environment/) which I also demonstrate briefly in my video #76 which reads in some Arduino-generated data.
Just some thoughts. Once you have cracked the reliability of USB to Arduino then this project is very do-able. Thanks for letting me know the background, a very interesting project you have there.
Hello Ralph, this is the best explanation about nrf24l01! Just one question. How do you send more the one variable in one package? Thanks.
Hi Gustavo! The way I would do it is to send either a concatenated fixed length string of several variables, or, if you can't be sure of the length, separate them with a delimiter such as a "|". Convert all the variables to strings if you do it this way. Then reconstruct them at the receiving end. I might be tempted to use a struct to do this.
I think you are limited to 32 bytes of data though... will have to check this.
I found it easy enough to plug the black board power supply into a 6 way and a 2 way female pcb header. The nRF24 plugs up into the supply and overhangs the prototype pcb.
You're talking about *not* using the standard adapter plate, David? Can you just expand on what you're doing here as I didn't fully grasp how you're powering the nRF24L01, it would be useful not just to me but others reading your post too.
Ralph S Bacon I am sorry not to be clear. The power supply board I am referring to is the Black Socket Adapter Board www.amazon.co.uk/dp/B00NJCB7FS/ref=cm_sw_r_cp_apa_awLXzb5ACAMN0. This can be plugged into a couple of socket headers at the edge of a pcb. The radio board plugs up into the adapter board and overhangs the edge of the pcb. .
Ah, yes, all is clear now. Those adapter boards are the same ones I use, and yes, they can easily be plugged into a couple of socket headers on the main PCB, good idea. In fact, on that topic, I'm definitely in favour of having things 'unpluggable' for ease of maintenance or eventual replacement, it makes the whole process so much easier. Thanks for clarifying, David.
Ralph S Bacon I am very keen on pluggable modules after soldering a TFT display to a prototype board and then changing my mind. I find it is good to be able to swap out modules too to fault find. I have two sensor units sending data to my display and data logging hub. To keep it simple the hub has a NANO for the radio coms and another for the screen and SD card. I don't think the radio on SPI and the display on the same SPI bus will work without messing with the libraries. Would you agree?
If the libraries (and modules) follow the SPI standard then, yes, they should play nicely together (NB: nicely, adj, constantly fighting to see who is boss). No really, as long as the CS pin is kept high for the module not being used, and LOW for the one that is, then they should work together. That's the whole point of a shared bus, right? Back on Planet Earth, they may not work together at all. I've seen libraries that just put the SPI CS pin LOW and keep it there!!! But that could be corrected of course. If you have a Logic Analyser then it would be simple to see what each bit of code does to the SPI bus (and something on my wishlist). I guess you could try it, you may be pleasantly surprised. Or you may think, what the hell, another $2 Nano and I avoid all that potential pain!
These are great nRFs easy to use but no SOC. newer ones have both. Just be aware that you can only transmit 32 bytes of data. Also receiver can go up to 5 or 6(not sure of the number of the top of my head ) kind of like Xbee
But then it's more of mesh network I am talking about
One more thing is possible to use Struct to send diff kinds of data as one block
Great video Ralph
Hi Raad! The author of the RF24 library even has one for audio so I guess he gets round the 32-byte limit (perhaps he just transmits 32-byte chunks, I haven't looked!). He also has a library for that *mesh* network you mention. But frankly, I think most Arduinites will just want a fairly simple system and for that purpose these cheap (but very clever) units really do fit the bill, don't you think?
Thanks for pointing out those caveats, it's this sort of information sharing that makes the Arduino collaboration so very powerful - and ensure we buy hardware with both eyes open!
And I'm glad you liked the video, I'm hoping it was as simple as could be so beginner Arduinites could follow it!
I do agree - keep it simple is my motto for sure
I run into trouble with these when I hooked them up to ESp8266. The power the ESp8266 was giving out was not enough to power the nRF, so I used the capacitors.
Again, enjoyed the video. Keep them coming
Hi Ralph, a nice simple explanation of these little modules. I bought two over a year ago and never did anything with them. Time for a project I think. Have enjoyed watching several of your videos. Can we see more of Benny the Cat?
Ha Ha! Benny is definitely getting star-struck, Michael, there will be many opportunities I'm sure where Benny will set me straight. Glad you liked the video and even better that you are now enthused into getting this little beauties working (I've just ordered a set of 10 from Amazon UK for the SAME price as they were selling for in China - not sure how they managed this but I've now got them delivered today). I can see many uses for these going forward. Thanks for posting and I'll let Benny know too. :)
Thank you so much 😊👍
You are so welcome!
Hi Ralph! Thank you for taking the time to make this video. It has been a tremendous help for me in learning how these little modules work. As an absolute beginner to this kind of technology though, i still get kind of lost when it comes transmitting data of different types and sizes. I'm looking to transmit an array comprised of 5 values from one arduino nano to another. Could you please explain a little more in depth as to what I would need to do to make that work and why? Thank you so much!
I'm pretty sure that you can transmit up to 32 bytes of data in one go (concatenated as a simple string). Hmm, maybe I should talk about this when I do my video on the Benny IN/OUT indicator (using my TFT screen but also a couple of nRF24L01s too). Thanks for the prompt, I'll include that info.
Thank you sir! I have it figured out now (:
@@romanhuante pls tell me how. I wanna send multiple values too.
Thank god they made multiple instance IDE.This code reminds me inter service communication with pipes.
Very clean. I'll test it. Ugh I just looked at the code - it is bad... Just don't call stop listening at the beginning if it is a transmitter role. Ideally both mcus should have two roles - each one pinned to interrupt
Well, you know, Browarus, the demo sketch is just that, a demo, and if I were using this for real the code would look quite different, I'm sure. But it's just enough to get people going (I hope) so don't be too stern with me :) But thanks for posting, and I hope you enjoyed the video (and demo code) anyway!
Thank you so much Ralph but I wouldn't do it with infra red . As you probably noticed it will be the receiver which will be implanted and to perform a task it needs to adjust frequency and amplitude of stimulation and this can be done with a transmitter and with a digital potentiometer and behave like an oscillator. Thank you as I have at least piqued your interest on my project. God bless you.
You did more than pique my interest, I have ordered one of the digital potentiometer chips but I will (probably) just use it as a simple volume control, controlled by infrared. At least it will demonstrate the possibilities. However, it will take several weeks to arrive from China so I must be patient!
Dear Ralph, I am happy for your interest and you are welcomed to join in, after all I am a lousy programmer(LOL) I know that I am waiting to hear from the Eurostars, but I hope and pray that will go through. I have intrigue the interest of worldwide Medical device manufacturers and all of them came to London for a conference but all of them wanted proof and FDA pass. Now we are near as I have partners for almost every discipline except a programmer and as it is very huge this project ($30 billion per year)it is better I end up having 5-10% than 100% and no partners. If I know your address I could sent you the digital potentiometer and from its data sheet I stole the program that I am using but please shhhhh don't anything to anyone about my infringement and can work as an oscillator. As always you can email me at demetrios@nevadatechnology.co.uk privately and may God bless you and family and the your cat.
Mine just sends 1 and sometimes 128 and response is 0 how can i fix it??
You must do TWO things, Almir:
1. Use the power adapter boards, they are very cheap and solve a LOT of power-related issues.
2. Use my _two exact_ sketches with no modifications of ANY kind.
Then we KNOW they will work and you can modify to your heart's content - you will always have a good point to get back to.
Hello,
Love the video.
What is that development board you are using?
That would be an Arduino Nano plugged into an expansion board, a bit like this UK one (but I bought mine from cheap China):
shop.pimoroni.com/products/multifunction-expansion-board-for-arduino-nano-uno?variant=39363470983251
The reason the IDE jumped from 1.6 to1.8 is because at the time of the split between European 'Arduino' and USA 'Arduino', one of them (USA i think) launched a 1.7 version already
Well, Ed, there had to be some reason and it sounds like you found it. As from Arduino IDE 1.6.6 the C++ compiler is version 11 so there are some useful (compiler-related) improvements, such as namespaces which I will be trying out later. That way we can define 'global' variables which are constrained to the current sketch. See much more here: hackaday.com/2017/05/05/using-modern-c-techniques-with-arduino/
Thanks for raising this Ed.
tnx for the link. Interesting
Thanks for the excellent tutorial, I was very quickly able to get the setup to work with the nRF24L01 modules with the built in aerial, However when I went to swap them out for the PA/LNA modules with the aerials it didn't work - is there any modification I need to get those longer range modules to work? Thanks again
Glad you got it working but odd about the longer range modules. Mine just used the "standard" IPX connector (as found on some ESP32 modules) and I used the same aerials that I would for an ESP32.
The IPX connectors are a bit stubborn so make sure they are connected properly. Unless you have the screw-on type which accept the ESP32-style aerials too, directly.
Try getting the BT module(s) working with a simple two-way Arduino sketch to prove the modules are behaving in the manner you expect.
Good explanation is there any library available for Black Pill ? I mean STM34F401CC or STM32F411CE ?
It looks like the standard libraries for the STM32 should work - but I'm guessing. This video is a good intro though:
czcams.com/video/b1123kz_3MM/video.html
good video.
Thank you Mostafa 👍
Thank You for the Tut
You're welcome!
Hey Ralph, Can you please post video about a base node and then child nodes connected to it.. And how to establish connection between them
Nope. 😲 My Bin Lid monitor has THREE (battery-powered) child nodes (slave devices) all transmitting to one (permanently powered) base unit. They all transmit at different, random times but the base unit seems to cope very well. See this video for more details:
Video #221 czcams.com/video/eLnfiYkxCQ4/video.html
Later videos expand on this project so take a look or keep tuned!
I appreciate the video, but my NRF's aren't communicating with each other. One is saying "THIS IS THE RECEIVER CODE - YOU NEED THE OTHER ARDUINO TO TRANSMIT
" and the other one is saying "No acknowledgement of transmission - receiving radio device connected?
No response received - timeout!
"
I'm not sure what I did wrong. Can you please help
There are some actions you definitely need to take, Shiven:
1. Get the adapter plates. It simplifies the power supply and the wiring is done from the top too. They are cheap: amzn.to/38AUltF
2. Double and triple check the wiring. With the adapter plates it's a lot simpler.
3. Ensure the devices are within 30cm of each other with my sketches as I use minimum power. Once you got it working you can increase this.
4. Swap the devices over and see if you get the same error(s).
Try these in the order I have listed them - it will work if you have not changed my sketches.
Thank you very very very very much
You are most welcome rahul gupta kodarapu, I'm glad you like the video. Nice to hear from you.
Is there a spesific reason why you generated a number to 254? Im trying to send large numbers such as 1000, but it caps out at 250
I'm assuming that the variable holding your value is just a small integer (char or uint8_t) which can only hold up to 255. To take larger values you need a two-byte integer (int or uint16_t).
Hi, Ralph (or anyone who can help), I'm getting this weird error where my receiver is sending out a response which is just counting up by one all the way up to 254 and then it will reset and start again at 0 and go back up. The transmitter, on the other hand, says there is no acknowledgment of transmission along with the timed out error. I tried switching which Arduino the transmitter and receiver are on but it gave the same error. I'm currently powering both radios from the Arduino's 3.3v. Thanks in advance for any help!
Here's my take on this issue, Vithuran:
1) you're powering the nRF24L01s from the 3.3v, something that has caused much misery to many Arduinites. I know it worked in my demo but maybe the boards you have are subtly different. Do yourself a favour and buy the adapter boards. If you live in the UK, Amazon do them for the same price as you can get them for in China (for a pack of 5). In the States maybe the same. Whatever, even from a Far Eastern warehouse, get them and power from 5v. Yes, really.
2) The "receiver" sketch only does something when it has received something from the "transmitter". Check your (dual, as shown in my demo) Serial Monitor (debug) windows and see what is being sent, when and by which module. If you are using my sketches, without alteration, they will work if your power supply to the nRF24L01s is correct, and *your wiring too*, of course!
How do you feel about that advice? More money spent but very little of it for a huge problem (probably) solved...
Alright I'll look into the adapter board, thanks for the advice!
Hi Ralph!
first of all thank you for sharing this video with us.
I would like to ask you a question; is it possible to receive data on the spatial position?
Do you mean where the other system is positioned, like a GPS signal? If so, then no, although you could install a simple GPS module and send the coordinates back to the initiator, I guess.
Hello Ralph! First of all nice video! I am curious to know can we use Arduino Uno for this project?
Yes you can! I'm pretty sure the video shows the Arduino controlling the nRF24L01 devices?
@@RalphBacon Yeah thanks!
Sir, could you please cover a tutorial using Nrf24L01 driving Seven segment using keypad remotely. Thanks
That's not how it works, Clark! I've done a video on the keypad (membrane), I've done a video on a seven segment display (and I have one planned for an alphanumeric display, but that's for the future) and I've done more than one video for the nRF24L01+. If you built all those demo sketches and circuits you would know how to do what you want. No shortcuts, I'm afraid!
@@RalphBacon Thanks for your quick reply Sir. I think I know how.
At the beginning of the video I think you said MIN TX POWER was equivalent to 10M range....at the end it seems more like 30cms.....
I probably mumbled something incoherent, Graham. On the absolute minimum power (whatever that is called) it has a range of about 30 cm and it's OK for testing on a workbench.
I have been using these a lot over the last few days running on 2 Arduino Pro-Minis (8Mhz 3.3V) both on batteries via 3.3V regulator. The Tx code tends to hang up. The Rx code seems OK. I put a 10uF electrolytic across the 3.3V input on both Tx and Rx chips and all is well with the world. There may be a synchronisation issue with the WiFi chip during the Tx pulse.
Most issues seem to centre around the 3.3v power to the modules, especially if users are powering them directly from the (cloned) Arduino board's 3.3v pin which can severely limit the amount (and quality) of power available. The solution that always seems to work is the use of adapter boards so you can power them from 5v and let the on-board regulator take control. You've sort of done a similar thing but I'd still lean towards a proper adapter board which is designed to give enough current even for full power transmissions (and you can then connect the cable from the top too). But this is undoubtedly very useful information, Whitefields, given the large number of queries on this topic so thanks for posting. PS there is a post under this video that details the cloned chips' centre frequency is *not* what it should be - another source of potential problems, maybe?
Ralph, I was not clear enough above. I want a low weight, compact portable WiFi so I am running on one single 18650 Li-ion cell to power each my Arduino pro-mini and associated nRF. The power supply to the nRF is via a low drop out (80mV) 3.3 V regulator www.ti.com/lit/ds/symlink/lp2951-n.pdf. I have the 10uF capacitor near to the nRF board. All works well, but I will be lowering the voltage down to 3.0 as the data sheet of the (original!) nRF gives a range of 1.9 > 3.6V. The Pro-Mini has its own on-board regulator so the battery goes straight to this, at least for now. I started off using the adapter boards (see post below) but eventually Arduinites are going to need a specific power supply for their projects so I use these regulators which are made for the 3 common TTL voltage levels. So far reliability is perfect, but I'll let you know how things go at 3.0V which I need to get the most out of the battery. fyi a video or 2 on low voltage / wearable projects would be useful. Thanks again.
Hi
Do you know what version of the library you had at the time, it seems to have updated and the code doesn't work anymore.
It should be in my GitHub for this video: github.com/RalphBacon/nRF24L01-transceiver
Great project, I have a need for a Garage Door monitor. I have two doors and sometimes ( Not very often, but once is too many) I forget to close the door after I came in. It would be nice to be able to have a display inside showing the position of the doors. It is an attached garage so the doors are about 30 feet away from living area ( through a wall). I would also appreciate an idea ass to how to tell if the garage is not fully closed. What type of sensor to use?
I have really appreciated your videos and they come across ( at least to me) in a very understandable manner and you explain everything important like where the specific library you use is located.
Hi AdaBill, I'm glad to like the videos! As a (wireless) garage door monitor this would be ideal. You can also use a Hall Effect transistor that responds to a magnet to determine whether the doors are *fully* closed (not left ajar). I've done a video on those too. Even a microswitch would be OK (like I used in my stepper motor project). Anything that could connect to an Arduino that then sends out the correct status via the nRF24L01. Sounds like a nice project. Let us all know when you get it working, right? Thanks for posting!
Thanks again, I went back and looked at video #55 and I'm in the process of ordering some hall effect sensors to try it out.
Good video.
Nice to hear that MDF Rescuer, I hope you enjoy the other videos too.
This is Clear and the best explanation.
Is it possible to do "Master-less serial or parallel communication between multiple arduinos through Nrf24L01?
I'm working on a project that will have more than 10 arduinos.
I'm looking for a way to have any of the arduinos broadcast a stream of data to any of the other arduinos at any time. when two or more arduinos are in range, they must automatically connect and start communication. it should be two way communication.
You probably need a *mesh network* (and Google can be your best friend here). There is an example, I believe, in the library used in this demo. I didn't go down that route as it's more advanced but may be what you need. I hope this helps.
I have problem the node 1 always print "No response received - timeout!" and cant receive anything from node 0, how can i fix this?
Are you using the adapter plates that allow you to power the devices from 5v? If not, do that first.
Does the transmitter send out the value OK?
Does the receiver receive that value OK?
Does it try and send something back?
Is that failure part of the auto-acknowledgement? (The transmitter will expect a 'received' type message behind the scenes - is that the one it is complaining about?).
Swap over the two modules to see if the same problem persists.
Thank you for the very clear & helpful video!! I was wondering if you could help me troubleshoot! I have done the project exactly how you have done it and followed every step correctly. However, I am still not able to get the transmission across to the receiver. My transmitter serial will say that there is no acknowledgement and that it has sent the number, but has not received it. My receiver serial will just say that this is the receiver code. I have tried changing the channel that I am on and matching both of them so they are on the same channel. I have even tried to increase and decrease the transmit power. I checked to see if I am getting proper power to the module and I am. One weird thing was that I have the adapter, so I should be able to supply from the 5V, however, when I do so, the transmitter serial will basically keep resetting and showing "no response received" and the "timeout". So, I keep it on the 3.3V supply, regardless of having an adapter and external antenna. I am wondering if it could be the antennas that came with the module, but I have even tried swapping those out as well. I am sorry that this was such a long reply, hopefully, I missed something that you caught. Thank you so much for any feedback!
No, it's not the antennas if you're running this on a workbench.
If you have the adapters, and have plugged them in the right way round (so they extend the adapter plate making it long, not on top of it) then you MUST use 5v, as the board has a 5v to 3v3 regulator.
Apart from the adapter plates, the most common problem is the pin wiring. Easy to get them muddled up so you need different colours for each, and write down the colours. Ideally, *keep the colours the same as I have in the pictures* on my GitHub:
github.com/RalphBacon/nRF24L01-transceiver/tree/master/DupontWiring
The transmitter will show the number it transmitted. The receiver, if it received it, will show the same number, increment it by 1 and send it back, at which point the transmitter will display it.
If the transmitter gets no (auto) acknowledgment of the number transmitted it will show the "time out" message. Check the wiring and modules - I've had fakes in the past that just didn't work properly.
In the meantime, you need to triple check the wiring, it's easy to get it wrong. I have to say at this point, Gurdeep, that my two sketches most certainly do work, and I've recently used them (adapted) for my storage bins and they "just work".
@@RalphBacon Hello Ralph, thank you so much for your detailed reply!!
Yes, I have triple and quadruple checked my wiring, everything was just not working. I actually tried out another CZcamsr’s sketch and that wouldn’t work either.
I believe I probably have fakes, so I will get new ones and try them out again!
Thank you again for your reply!
Great tutorial. What do you think about encapsulating data for mesh networking with these?
There are some code examples in the library that deal with mesh networks but I have to admit I've never needed one so have not experimented (yet).
Feeling very stupid now... I was feeding the NRF24L01 HOLDER with 3.3v and it has a 5volt Input!!! Sorry for the false Alarm.:-(
No need to feel stupid, Paul, I've done the same. The unit itself only requires 3.3 volts but the adapter plate (holder) has an onboard 5v linear voltage converter which also makes it much more stable if fed with a decent 5v supply (the one from the Arduino is OK for low to moderate power, a separate one may be required if using the highest power setting). Keep experimenting, these are nice little units. Thanks for posting the fact you've sorted out your minor oversight (it will make everyone else reading this feel very superior until they too make a simple error!)
I have been using Bluetooth but the range is limited,.I think this is a great solution to this problem. where can i get a copy of your simplified code?
I believe the simplified code (Master/Slave) is in my GitHub:
github.com/RalphBacon/nRF24L01-transceiver