#38 Advanced Tutorial for NRF24L01 and Arduino #2 Reliable Connections

Поділитися
Вставка
  • Опубліковано 1 сер 2024
  • In this video I continue with the software part: establish a protected to-way communication with acknowledgements and defining data structures. I show how you can test the performance of a connection and give you some hints for increasing the range of the devices.
    This communication system is used in my robot to transfer commands in one direction and telemetry data in the other.
    The software used for this episode is on github: github.com/SensorsIot/NRF24L0...
  • Наука та технологія

КОМЕНТАРІ • 139

  • @DavidFeliz
    @DavidFeliz 5 років тому +6

    I love all your videos, but this is definitely my favorite!. Super clear information about rf communication.
    Thank you very much for all your teachings and professionalism!

  • @alanpowell328
    @alanpowell328 7 років тому +2

    Andreas, many thanks for this tutorial - and obviously the code as well. I am just about to start experimenting with nRF24L01 modules and have been reading a lot of words and watching a lot of uTube. Your tutorials have worked in bringing all together for me. A Merry Christmas and a Happy New Year to you and your family. Alan

    • @AndreasSpiess
      @AndreasSpiess  7 років тому

      Merry Christmas and a Happy New Year to you, too. Hope you have fun with the NRF. It is a nice little thing...

  • @jix177
    @jix177 8 років тому

    Very interesting series. I have a level sensor in the heating oil tank in my garden which transmits data back to two receivers in the house, and I often get problems with the connection, you have given me a few ideas to improve this.
    I have indeed found that using the amplified unit and larger antenna at the transmitter has helped - the traffic is one way only without acknowledge.
    Thanks for sharing!

    • @AndreasSpiess
      @AndreasSpiess  8 років тому +1

      +jix177 I hope it will work for you. Maybe you use a similar setup like mine to test the connection and find the right "spots" for the antennas or a free channel. After that, you still can go on with the one way transmission...

  • @ericlayton3300
    @ericlayton3300 5 років тому

    Ditto.....Thank you for investing your time to produce a pair of excellent NRF24L01 tutorial videos! Very well presented!

  • @deangreenhough3479
    @deangreenhough3479 8 років тому +13

    Great follow up video. I see another rabbit hole I'm about to disappear into for an unspecified amount of time😀

  • @michaelmoss5476
    @michaelmoss5476 5 років тому +1

    I build a Halloween Haunt each year and the NRF24L01 along with your video will come in handy as I upgrade to a more automated system with less wires all over the place.
    Great video -- Thank you.

    • @AndreasSpiess
      @AndreasSpiess  5 років тому

      You are welcome. Still some time till the next Halloween ;-)

  • @nurpurwanto4234
    @nurpurwanto4234 8 років тому

    I really enjoy your guidance, clear spoken language (as I am not a native English speaker). Subscribed!

  • @matt-jn7no
    @matt-jn7no 4 роки тому

    This video helped me so much with the struct package, thank you so much

  • @MrPaulyoutoobing
    @MrPaulyoutoobing 3 роки тому

    Appreciate your videos! Thank you for making them.

  • @slaredo3283
    @slaredo3283 4 роки тому

    Thx a lot Andreas!
    I spent too many time looking for something like that!
    So helpful to my school project! :D
    Again... thank you a lot!

  • @bocahangon1192
    @bocahangon1192 4 роки тому

    This is what I need.. thanks for the great explanation

  • @matthewvgrogan
    @matthewvgrogan 7 років тому +4

    definitely the best info out there!

  • @mehdiwadoud8098
    @mehdiwadoud8098 6 років тому +1

    I don't consider myself as a follower but a student, caus you are a great teacher Sir

  • @luismorales5606
    @luismorales5606 4 роки тому

    Thank you so much, best tutorial ever, awsome!

  • @jankowalski2191
    @jankowalski2191 6 років тому

    Very helpful! Great job! :-)

  • @kennyprayogo
    @kennyprayogo 4 роки тому +1

    Thanks dude! Really good explanation especially about the ACK. I'm currently working on my final project involving the RF24 and is tempted to try the RF24Mesh feature. Maybe you could make a video about it too! (if you're also interested of course haha).

    • @AndreasSpiess
      @AndreasSpiess  4 роки тому

      The NRF24 is quite an old chip. So I do not plan do do more with it.

  • @chuxxsss
    @chuxxsss 8 років тому

    Thank you I have been trying to find a way to program my arduinos after first seeing mysensors video on controlling a relay. I see you are an amateur radio operators as well. Need antenna theory in the production.

    • @AndreasSpiess
      @AndreasSpiess  8 років тому

      There are a few channels around which are dedicated to hamradio. So, I will not add another one. But you will see combinations of microcontrollers and radio.

  • @jesuishalil
    @jesuishalil 8 років тому

    I thought every message could be 32 bits =^) Much more versatility than I expected.

    • @AndreasSpiess
      @AndreasSpiess  8 років тому +2

      +Flo wey No, 32bits would only be two 4 bytes which would be really small compared with the overall message size. 32 bytes is still not a lot, but for my application it was sufficient.

  • @charlietame1892
    @charlietame1892 6 років тому +2

    I agree with all the positive comments about your content and presentation... some "So called" tutorials on here make you want to hurt the presenter :)
    Thanks for your time and efforts Andreas, great job.

  • @thibaultjn
    @thibaultjn 6 років тому

    Thanks VERY much!!!

  • @pedrocavaglieri
    @pedrocavaglieri 6 років тому

    Perfeito!!!
    Obrigado

  • @Ed19601
    @Ed19601 7 років тому +1

    very interesting. I have ignored the nf24l01 but recently bought two nf24l01+ high power modules. the ones with the rubber ducky antenna. works well but I noticed the auto knowledge not to work in 1mbps and 250kbps. would only work in 2mbps. going to try your software to see if the issue is with my software or with my modules

    • @AndreasSpiess
      @AndreasSpiess  7 років тому +1

      These are cheap little things and good for point-to-point connections...

    • @Ed19601
      @Ed19601 7 років тому

      Andreas Spiess indeed. in spite of the auto acknowledge issue I could bridge 300-400 meter. maybe more but I didn't try that

  • @MrLunarpulse
    @MrLunarpulse 8 років тому

    a Great video! Thanks. I was curious about the hardware set up you showed in the video. Could you share the schematics of the nrf01+ and micro pro mini or more pictures of them please? Also the customized antennae are impressive.

    • @AndreasSpiess
      @AndreasSpiess  8 років тому

      +myoungki Jung I just posted the eagle files here: github.com/SensorsIot/NRF24L01-Board-with-Arduino-Mini-Pro. I am not sure if they contain errors. They are quite old...
      For antennas I would look at: ua-cam.com/users/8bitandrewmcneil
      This is a great channel!

    • @MrLunarpulse
      @MrLunarpulse 8 років тому

      Thanks very much. I will learn this and apply the style to my project. this will definitely accelerate my development. Thanks again!!

  • @JakeAndDaddy
    @JakeAndDaddy 7 років тому

    I've got a few of these and some pro mini's to set up temperature sensors. I'll use an ESP???? as a receiver and connect to an mqtt broker.
    I can then use openHAB to turn up my nest heating as the thermostat room is normally too hot.
    If I ever get time. Baby boy takes up most if it.

    • @AndreasSpiess
      @AndreasSpiess  7 років тому +1

      This is good if you do not have Wi-Fi where your sensors are. Otherwise it might be better to use an ESP also for the sensors. Unless you have a special need (power saving for example)

  • @noweare1
    @noweare1 6 років тому

    Thank you for the video. How are you using printf statements in the arduio IDE ?

  • @manudevappa4900
    @manudevappa4900 3 роки тому

    thank you so much one of the best tutorial. can you explain nrf24l01 + pa +lna, how to get a better transmission?? antenna pointing directions...

    • @AndreasSpiess
      @AndreasSpiess  3 роки тому +1

      These boards just have more power and a better receiver. The rest is the same. You have to try how far they go and if they are of use in your situation.

  • @JulioSalim
    @JulioSalim 6 років тому

    Excellent Andreas, I'd love to see your explanation on using XBee modules in a MESH IoT network. Any plans on that?

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      So far I never used Xbee or mesh. We will see. I have an idea with mesh, but not on Xbee...

    • @JulioSalim
      @JulioSalim 6 років тому

      Who knows you can also touch the OpenThread someday. It seems to be an excellent option for IoT applications. I learned that the new Particle boards will be leveraging thread in an Adafruit's Feather form-factor. Seems very cool! Thank you!

  • @perkleinschmidt6798
    @perkleinschmidt6798 4 роки тому

    Hello Andreas, nice video and still valid. Fun of learning programming, electrotechnic and playing around with MC's I am following your channel. I'm building me a DIY RC Transmitter/Reciver and did order a NRF24L01+ PA LNA SMA mit Antenne. In your video at approx 13:27 your speaking about λ/4 ground plinth antenna and would like to know your calculations, length of your 3 extra annetnas and where you did solder it on the PCB of the nRF24L0I. I did see in an calculation of 868mhz A. Vertical Monopole Radiating Element (λ*0.25)*vf=82.1mm and B. Radials (λ*0.28)*vfActual =91.9mm with Velocity Factor 0.95. but if I look at your video the B looks shorter then 91.9mm (I don't know your A length and MHz) so long sprach short would love to hear something here or perhaps you have made a video in the past or you know about a video/url. I could not find so much how to do it. Thanks Per

    • @AndreasSpiess
      @AndreasSpiess  4 роки тому

      The element on 2.45GHz should have a length of about 2.9 cm and the radials 3.3 cm ( m0ukd.com/calculators/quarter-wave-ground-plane-antenna-calculator/ )

    • @perkleinschmidt6798
      @perkleinschmidt6798 4 роки тому

      @@AndreasSpiess Hi Andreas, thanks I used the same URL. Last question the 3 Radials on which pins on the nRF24L0I do you solder them? Thanks in advance. BR Per

  • @xienjougao3131
    @xienjougao3131 4 роки тому

    i like your TOTORIAL

  • @shubhamsaxena508
    @shubhamsaxena508 7 років тому

    hey can i put setchanell function in loop code and change channel while runnig programe. so that i can send data for two nrf set at different channel?

    • @AndreasSpiess
      @AndreasSpiess  7 років тому

      But how would then the receiver know that the sender changed the channel?

  • @sumantamajumdar6505
    @sumantamajumdar6505 5 років тому

    Sir thanks for this outstanding tutorial, I have learned a lot from your videos. thanks for sharing knowledge.
    this is my first request to you to do a video about antenna modification of nrf24l01 PA LNA module. I am not able to find any information about the modification you did and its benefits on the internet.

  • @RahulKumar-zs2wv
    @RahulKumar-zs2wv 6 років тому

    Hi ,how can i use nrf24l01 for many to one communication i.e i want multiple nrf24l01(node side) data will comes to one nrf24l01(gateway side) ?

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      Maybe you have a look at the radiohead library. It has addressing features and should support the NRF24 chips

  • @JDI4DAVID
    @JDI4DAVID 6 років тому

    When you openReadingPipe(1,pipes[1]) are you not naming the receiver end of pipe 1? When you openWritingPipe(pipes[1]) are you not simply defining the address label which should be attached to the next message? Are your pipes[ ] actually addresses?

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      I have to admit, I do not remember the details. I just remember it took me a while to understand the concept of pipes and I had to consult the datasheet extensively. If I remember right, the pipes are a sort of address to distinguish between different devices on the same channel and also the direction.

  • @rasheedmalik6594
    @rasheedmalik6594 5 років тому

    i waited the complete video tat ur gonna make reliable connections of the hardware....
    also y did u use radio.PowerUp() in the setup
    also wot about using 10uF cap between VCC and GND?
    also what power source did u use to power up the nRF chip for PA_MAX?

    • @AndreasSpiess
      @AndreasSpiess  5 років тому +1

      This is an old video and I do not remember the details. :-(

  • @priyabratasaha5385
    @priyabratasaha5385 8 років тому +1

    Great video. I found it best in this topic among other videos on youtube. Working on a project very similer to your one. I got a clear idea about RF24 arduino codes now. but I need a little help.
    I am a beginner in arduino platform. Don't know all the functions and definations. Some of those in your sketch is not clear to me. Specially starting with "#".
    So I am listing those below. Some of these seems to me that the function works same as another basic function which I understand well. In such case I'm attaching my well known basic functions.
    Sl. Function used. Can I use instead? other question
    1 #define NEO_PIN 6 int NEO_PIN = 6; Are they same?
    2 #define COUNT 10 Is a pin? looks same as previous,
    what is the difference?
    3 #define DATARATE radio.setDataRate Does the Same work?
    RF24_2MBPS (DataRate);
    4 typedef enum { } Can't understand.
    5 roleDef;
    roleDef role;
    6 #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
    RF24 radio(48, 53);
    #else
    RF24 radio(9, 10);
    #endif
    Thank you for the 2 videos. If you have a little time to response to my request, I will be greatly thankful to you.

    • @AndreasSpiess
      @AndreasSpiess  8 років тому +1

      Your questions are very general and show me, that you should first develop your Arduino programming skills. Maybe, this is not the project to do that because it is quite complicated. I did not start with these kind of projects.
      A few hints:
      Google for "constants and arduino" and you find informatiion about the #define statement and its differences to variables
      Google "(__AVR_ATmega1280__" and you find the explanation about this constant
      Google "enumeration and arduino" and you find the information about the enum statement
      Google "SPI pins Arduino uno and "SPI pins arduino mega" and you find th info concerning the pins 9,10,48,53 (arduino-info.wikispaces.com/Nrf24L01-2.4GHz-HowTo)
      All three questions are not easy to answer and it will take time till you understand. Good luck!

    • @priyabratasaha5385
      @priyabratasaha5385 8 років тому +1

      +Andreas Spiess
      Thanks a ton.
      It seems really hard to understand these.
      Thank you again for your reply.

  • @kamalkamalesan92
    @kamalkamalesan92 2 роки тому

    THANKS

  • @sconosciutosconosciuto2196
    @sconosciutosconosciuto2196 5 років тому +1

    8:15 well yes but how can I read the data? I need to create the same struct on the other arduino?

  • @eddddddd459
    @eddddddd459 5 років тому

    Hi. I have a question. Can i use the same transmitter to transmitted 2input (switch1 and switch2) to give output of the same receiver (LED1 and LED2)

    • @AndreasSpiess
      @AndreasSpiess  5 років тому

      You have to solve this problem with your Arduino sketch.

    • @eddddddd459
      @eddddddd459 5 років тому

      @@AndreasSpiess can i have some example of the arduino sketch to solve this problem. i have done it but my switch1 and 2 controlling the same LED

  • @yxhankun
    @yxhankun 3 роки тому

    can you demonstrate nrf24l01on stm32f103 under arduino?

  • @KapalikKhanal
    @KapalikKhanal 5 років тому

    Great video but i have a question. Can we send a picture ? I was trying to encode a picture into a txt file and send it using nrf. But i don,t know how to do it. Please HELP.

    • @AndreasSpiess
      @AndreasSpiess  5 років тому

      You can only send 32 bytes. Not enough for a picture.

  • @veyselaksoy6558
    @veyselaksoy6558 6 років тому

    Can you use these to inform them each other? Means that use a button for one side and if you push this button , other nrf24l01 side which has a LED will get information to switch on its LED.After that if we use a button which is in other Nrf24l01 , this will cause to inform nrf24l01 to do something.I hope you understand .d

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      Ass you see I use 2-way communication.

    • @veyselaksoy6558
      @veyselaksoy6558 6 років тому

      Andreas Spiess ok, i misunderstood.Thank you.

  • @yxhankun
    @yxhankun 4 роки тому

    TX
    struct Telemetry{
    char* compass_bearing;
    float azimuth;
    float altitude;
    float temperature;
    float Speed;
    double Longitude;
    double Latitude;
    byte Time;
    float voltage;
    float rpm;
    float pressure;
    };
    Telemetry data;
    .....
    radio.write(&data, sizeof(Telemetry));
    ...
    RX : radio.read(&data, sizeof(Telemetry));
    Are my data sent in the package too long? My telemetry TX RX is NOT working in the transmission & receiver.

    • @AndreasSpiess
      @AndreasSpiess  4 роки тому

      Maybe you calculate the length of the structure?

  • @billysbikes8671
    @billysbikes8671 4 роки тому

    can you do this with the NRF24L01 network library?

    • @AndreasSpiess
      @AndreasSpiess  4 роки тому

      I do not know, I never used it.

    • @billysbikes8671
      @billysbikes8671 4 роки тому

      @@AndreasSpiess ok no worries i just made it check if the correct data was received from the right node and that seems enough for my situation. love your videos :)

  • @bsgmz
    @bsgmz 7 років тому

    Hi I have a question. I want to use nrf24l01 and 5110 lcd together, but i cannot do that. When i activated one of them. It will work perfectly, but when i use them together, only nrf24l01 works. I am using nrf24l01p library for dual communication. Can you build like that, or explain in comment?
    Thanks

    • @AndreasSpiess
      @AndreasSpiess  7 років тому

      which pins are you using for the communication?

    • @bsgmz
      @bsgmz 7 років тому

      nrf24l01 -> 7,8,11,12,13
      5110 lcd -> 2,3,4,11,13
      I tried other pins but it doesnt work

    • @AndreasSpiess
      @AndreasSpiess  7 років тому

      Maybe you google "nrf24l01 5110 arduino". I got these two where it seems to work:
      www.instructables.com/id/Arduino-Wireless-NRF24l01-Battery-Voltage-Monitor-/
      www.instructables.com/id/Nrf24l01-With-5110-and-3-Sensor-Plantation-Control/

    • @bsgmz
      @bsgmz 7 років тому

      Thank you very much.

  • @alimurad4468
    @alimurad4468 6 років тому

    I am unable to recieve structures on the reciever module. the code runs smoothly and the radio available check goes through yet i am unable to recieve the sent data using the radio.read command. help me out please

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      I cannot do any remote diagnostics. But I am sure you will find the problem. Maybe you start with a very simple example.

    • @alimurad4468
      @alimurad4468 6 років тому

      @@AndreasSpiess indeed I started with simple examples like sending integers and those are working fine. I'm having trouble with sending structures though. Can you provide a program that transmits structures and one that receives structures.

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      My self balancing robot uses structures:; github.com/SensorsIot/Self-Balancing-Robot/blob/master/Robot14/Robot14.ino

  • @santhoskumar2592
    @santhoskumar2592 3 роки тому

    Sir can we use nrf24l01 as wifi module

  • @damedaE90
    @damedaE90 6 років тому

    @Andreas Spiess Beschäftige mich gerade auch mit dem NRF, ich blick nur noch nicht ganz durch, wie du die gewünschte Frequenz definierst. Habe mich etwas eingelesen und mittlerweile die Library auch schon etwas weiter durchforstet.
    Wie genau wird die zu verwendende Frequenz festgelegt?
    Edit: Habs gefunden, viel einfacher als Frequenzen in HEX o.ä. umzurechnen...
    Vielleicht hilft es irgendjemandem weiter ;)
    setChannel(NUMMER);
    void RF24::setChannel(uint8_t channel)
    {
    const uint8_t max_channel = 125;
    write_register(RF_CH,rf24_min(channel,max_channel));
    }
    Der NRF arbeitet im ISM frequency band at 2.400 - 2.4835GHz und teilt diese 126 Kanäle dementsprechend auf die 83,5 MHz auf, wenn ich das soweit richtig verstanden habe.

    • @damedaE90
      @damedaE90 6 років тому

      Fast richtig: f_OP ist von 2.400 GHz bis 2.525 GHz => 125 MHz => 126 Kanäle

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      Du musst die Kanalnummer nicht in hex angeben. Eifach das 0x weglassen und Arduino weiss, dass du eine dezimalzahl meinst

  • @electricfieldtv709
    @electricfieldtv709 6 років тому +1

    8:33 in my project the receiver can't receive messages from 6 pipes at the same time, they need different time min 1500 us for 32 bit payload, i just think why not we use only one address for receiver, note: add the id pipe in payload, what do you think about this sir? Sorry for my English

    • @AndreasSpiess
      @AndreasSpiess  6 років тому

      This is an old video and I do not remember the details. So I cannot answer your question.

  • @_gekyumeman4127
    @_gekyumeman4127 3 роки тому +1

    everybody gangsta until he talks about transmitting refugees in the 1982 Lebanon war.

    • @AndreasSpiess
      @AndreasSpiess  3 роки тому

      ??

    • @_gekyumeman4127
      @_gekyumeman4127 3 роки тому

      @@AndreasSpiess I'm talking about what you say at 3:15

    • @AndreasSpiess
      @AndreasSpiess  3 роки тому

      Aha. But what does "everybody gangsta" mean? I am no native English speaker :-(

    • @_gekyumeman4127
      @_gekyumeman4127 3 роки тому

      @@AndreasSpiess No problem, it's an internet meme. It's a popular format of comments meaning that everybody seems tough until [insert something sad/heroic/badass] happens.

    • @AndreasSpiess
      @AndreasSpiess  3 роки тому +2

      Thanks for the explanation. I always learn from my viewers :-)

  • @farukz.9904
    @farukz.9904 4 роки тому

    Hello ı would like to know can ı send 2mb payload 10 - 15(second) by nrf24

    • @AndreasSpiess
      @AndreasSpiess  4 роки тому +1

      No

    • @farukz.9904
      @farukz.9904 4 роки тому

      @@AndreasSpiess can you recommend another communication model to do that task please. Thanks for helping

    • @AndreasSpiess
      @AndreasSpiess  4 роки тому +1

      Wifi

    • @farukz.9904
      @farukz.9904 4 роки тому

      @@AndreasSpiessthanks

  • @aloklakhera866
    @aloklakhera866 2 роки тому

    It would be helpful to learn if you shared the code also.

    • @AndreasSpiess
      @AndreasSpiess  2 роки тому

      I do not understand :-(

    • @aloklakhera866
      @aloklakhera866 2 роки тому

      @@AndreasSpiess I mean link to download your code?

    • @AndreasSpiess
      @AndreasSpiess  2 роки тому

      If it is not in the video description I do not have it.