Follow-up: Arduino and High Power nRF24L01+ Data Transceiver

Поделиться
HTML-код
  • Опубликовано: 26 окт 2024

Комментарии • 77

  • @iforce2d
    @iforce2d 10 лет назад +1

    I've been experimenting with these modules quite a bit recently and managed to get pretty good range. Using the high-power one with a clover-leaf antenna as the transmitter, and a normal one as the receiver, I get a rock-solid connection up to about 400 meters. This is purely one-way, 250kbps, auto-ack disabled, and clear line-of-sight. The throughput is about 260 packets per second. Unfortunately after 400 meters the road at my test location curves around a little and some trees get in the way. Not much happens until I get to a slightly clearer patch around 700 meters, where I can still get 250 packets per second if I hold the receiver juuust right, but it can just as easily be zero if I hold it juuust wrong.
    Unfortunately the curve of the road doesn't let me get any further without solid obstructions. I would like to measure the furthest distance possible that still gives a decent packet rate, but living in Tokyo it's extremely difficult to find anywhere that has more than a few hundred meters of straight-line visibility. I also got a second high power module and an antenna for the receiver and so I will try those together next time.

  • @iforce2d
    @iforce2d 10 лет назад +6

    As noted by other commenters, this is a two-way link so the problem is likely due to the receiver still being a weak PCB antenna. The documentation for the write() function states:
    "This blocks until the message is successfully acknowledged by the receiver or the timeout/retransmit maxima are reached. In the current configuration, the max delay here is 60ms."
    I would guess that the sender is almost never receiving any ACKs from the receiver. It is merely sending the data and waiting the 60ms, then giving up, sad and lonely. The receiver for its part, is dutifully sending an ACK for everything it receives, but those ACKs never arrive.
    Hence there is only ever one data available every 60ms. The receiver loop runs faster than 60ms so you get all those "No radio available" messages which is not really true at all. If it said something more like "No data available right now" it might be more accurate. Or even better, just take that println out completely.

    • @superdau
      @superdau 10 лет назад

      Yes, that should be the reason. I think there's an option to set the transmitter to a "no ack required" mode. At least the NRF24L01 can do it. I haven't looked much into the library, but I guess the option should be accessible from there, too.

    • @JulianIlett
      @JulianIlett  10 лет назад

      Yes, I think that's exactly what's happening. I'm now sending an incrementing integer and also the boolean (as an integer, 0 or 1) returned by the write() function (for pass/fail). This is helping to understand what's going on. But I'm not fully understanding this yet. Adding delays to the Tx loop shuts down transmission altogether - not sure why. Also, the packet size is 32 bytes, but maniacbug is sending integers. How is he doing this? 2 bytes per integer? What if I want to send floats or strings? Still too many questions!!

    • @iforce2d
      @iforce2d 10 лет назад

      Julian Ilett Yes, an int in Arduino-land is two bytes.
      To send anything more complex than what can fit in 32 bytes (a single float should be ok) you will need to code up a higher-level network manager.
      Although I am still a newbie when it comes to electronics stuff, experience from countless hours debugging situations like this for UDP connections comes in handy here.
      Not sure why a delay in the sender loop would shut everything down though!

    • @superdau
      @superdau 10 лет назад

      Julian Ilett
      I had a good evening today and got two NRF24 working as a bidirectional serial bridge ;) . What you punch in on one end comes out the other. I started with one of the examples (called "RF24->Transfer") of the library. I think it's only in this version of the library github.com/TMRh20/RF24 though, which is an update of maniacbug's (just be aware that the configureable pins 9&10 are set to 7&8 in the examples of the new library; I changed it in the code to be on 9&10 like on the tutorial page I sent a while ago). Can't say if you need to use the new one for it to work. But pretty much the only thing that is left of it after I had my go at it is the initialization of the radio ;) .
      I've pasted the code here: pastebin.com/2y4NyzCd . Flash it to two Arduinos and ground pin 2 of one of them (that just switches around the read and write address). Open two terminals and you should be good to go (I stripped out all newlines though, so the normal serial monitor could be alittle bit annoying).
      The most important thing to know here is the difference between byte arrays (that's what the radio library wants), char arrays (your typical C++ strings, needs to be null terminated) and String objects (the things you can convert to upper/lower, get the length of aso.) and how to cast beween them. I've added a few comments in the code.

    • @iforce2d
      @iforce2d 10 лет назад

      Julian Ilett I set up an example that sends a struct instead of individual primitive variables, which is a handy way to send multiple variables together. You can change the layout of the struct without needing to change any of the code that does the writing and reading: forum.arduino.cc/index.php?topic=260197.0
      Like superdau's example for strings, this is also limited to the 32 byte packet size. Sending a single coherent message spread across multiple packets is quite a different thing, since you would basically be implementing a TCP protocol yourself. Not impossible, but not really fun either (see 'countless hours' mentioned in my earlier comment), and would waste a lot of the minimal space available for code.

  • @philbx1
    @philbx1 10 лет назад +1

    Hi Julian,
    Yes, that's something I found many years ago while trying to connect 2 Olimex boards by simple 433mHz modules.
    Delays are a must, unless the data is driven by interrupts.
    I should try do the same now with my Arduino Nano clones, but my lack of motivation, excess of winter and flu's have taken
    over for a while.

  • @larryd6801
    @larryd6801 4 года назад

    My understanding is the board with the large antenna has a LNA and a PA, the other does not. You should have used the board with larger antenna as the receiver i.e. left it in the shop. The one without larger antenna should be outside (as the transmitter). Of course, the test should have used two boards both with the larger antennas. Thank you very much for doing these reviews!

  • @JulianIlett
    @JulianIlett  10 лет назад +1

    Morning all - and thank you all for your suggestions. It's FIXED!! Update video coming soon.

    • @SydKahn
      @SydKahn 10 лет назад

      Actually the loop should just bypass the radio part if there is no data

    • @donovanpl
      @donovanpl 10 лет назад

      Julian Ilett Was this fixed and did you upload a follow up video?

  • @lhxperimental
    @lhxperimental 10 лет назад +2

    You should use same radio type on both sides. I believe, there would be some ACK packets being sent from what is logically the receiver. So the "receiver" needs to be of a better grade too. Also, the antenna on the bigger raido is much better than the PCB antenna on the smaller radio. For a proper test use identical radios on both sides.

    • @JulianIlett
      @JulianIlett  10 лет назад +1

      I'm thinking the same thing now

  • @callumkingunderwood
    @callumkingunderwood 10 лет назад +1

    Come up with a few ideas.
    Firstly I've heard of some of the chinese vendors including a 433MHz antenna instead of 2.4ghz, this will cause transmission errors. Quite a few wireless routers or wireless cards will have a 2.4ghz removable antenna on them so you could always switch them out temporarily and see if that makes a difference of if you have a spare SMA connector you can usually find out the wire length required for any specific frequency online and make a custom wire antenna.
    Would be interesting to see what happens if the big antenna is left on the receive end and chip antenna on transmit to see whether the big antenna receiving allows a bit of extra sensitivity for the lower power chip antenna in the distance. And again, external antenna on both transmit and receive would be interesting.
    I have a few cc1101's on the way. Looking forward to trying them out.

  • @klaernie
    @klaernie 10 лет назад

    There are some things you didn't try yet: switching the sender/receiver around and trying to receive with the high power one (on the assumption that it also has a nicer input attenuation). Also try to lower the transmission speed over the air on both modules. As each bit in the transmission gets longer in time it should be easier for both modules to make out the difference between the high and lows on the radio band.
    I noticed something similar on my RS485 link which was sporadicly failing at 2MBit/s but quite consistently good at a 10th of that, but practicly rock-solid at 38.4KBit/s.

    • @donovanpl
      @donovanpl 10 лет назад

      That would be equivalent to changing the transmission speed; the radios can run at 2, 1 mbs, or 250kbs. What speed is he transmitting/receive speed at? Remove the delay and try lowering the transmission/receive speed. BTW, I need to know how to do this.

  • @dirtylabrat958
    @dirtylabrat958 9 лет назад

    I think I agree with others that have suggested these units, being 2 way may be communicating with each other and the signal still suffers from having to wait for the lesser powered transceiver.
    Instead of the delay, why not just put a sanity check in to ignore the failed packets/connection. I would be interested in seeing how many successful packets are transferred, ignoring the failed data, compared to the original transceiver.
    Also, I have a couple different antennas for video transmission and have found that there is often a big difference if I switch these out on the transmitting and receiving sides. Maybe it was more reliable because the original antennae were more similar originally? It looks like the range is definitely being extended though, even with only one side being upgraded.

  • @beehive808
    @beehive808 10 лет назад

    Julian
    Try bumping up the baud rate to 57600 or 115200, and remove the delay. That work for me.

  • @tobortine
    @tobortine 10 лет назад +1

    Before you fixed the problem I was wondering if it was a synchronisation problem, i.e the receiver not processing the received signal fast enough. Do you have two of those high power transceivers ? Would be interesting to see if they respond better in pairs.

    • @JulianIlett
      @JulianIlett  10 лет назад +1

      I only have one of the high power tranceivers, but I reckon the high power transmitter is capable of much greater range. The next step will be to put an nRF module into my wearable display project. Then I can set off down the road and check the range properly.

  • @droker123
    @droker123 10 лет назад

    Hi Julian,
    Excellent video as always, you mentioned in your first video on the module that you were not going to connect the interrupt pin. Could you use this to know when data is ready to be read in?

    • @JulianIlett
      @JulianIlett  10 лет назад

      Dean Roker Of course, but polling works just as well in these simple programs

  • @DevSagar19
    @DevSagar19 9 лет назад

    I suggest you to use high power nRF modules on both ends with a delay of 75 milliseconds. I hope that would be fine...

  • @gwilsonmail
    @gwilsonmail 10 лет назад +1

    Julian, is that a two-way capable radio link? Or is it simple a slave to master transmitter?

    • @callumkingunderwood
      @callumkingunderwood 10 лет назад

      they are capable of 2 way comms

    • @JulianIlett
      @JulianIlett  10 лет назад

      The modules are certainly bi-directional, but I get the feeling these simple sketches are using them for one-way transmission only

    • @gwilsonmail
      @gwilsonmail 10 лет назад

      It looks to me like one way, that was why I had this question. After all you have a low-power transmitter in one direction and a high-power one in the other. There's no way the LP one could reach the shed.
      Interesting project. I appreciate your work.

    • @aptsys
      @aptsys 10 лет назад

      Graham Wilson
      They are capable of bi-directional data transfer. Don't forget the high power version has a LNA in addition to the power amplifier, so the receive sensitivity is increased. It would be interesting to measure the RSSI of these ebay modules as the PCBs look very poor.

    • @callumkingunderwood
      @callumkingunderwood 10 лет назад

      Julian Ilett yes but that goes for sketches demonstrating serial usage aswell quite often yet that is bidirectional :P
      I think the modules may actually be half duplex though, ie they can transmit or receive but only 1 or the other at any 1 time. If you want to send a single byte and its in the middle of receiving a byte you do have to wait a moment for that byte to finish receiving before broadcasting your byte and while broadcasting your byte the module will be deaf to incoming bytes.

  • @shutdahellup69420
    @shutdahellup69420 6 лет назад +1

    i highly doubt the high powered transmitter was underpowered, i read somewhere that the antenna one needs about 200mA and the arduino can't supply that amount, so maybe thats the problem idk ;-;

  • @gughim
    @gughim 8 лет назад

    Hi, have you ever tried to use a Mega with theese modules? I'am having problems with it, with no clue of what the problem is...

    • @_who_cares_1123
      @_who_cares_1123 7 лет назад +1

      TheItalianGamer The MOSI, MIS and SCK Pins on the Mega are at other positions. Dont know where but i think 51-53.

    • @rasheedmalik6594
      @rasheedmalik6594 5 лет назад

      @@_who_cares_1123 Mega is not able to source ample amount of current to these PA+NA nRFL01+ modules especially the chinese. the requirement is 200mA min but port can source 150mA only AFAIK. Use external battery and join the GND of Mega and Battery and nRF. Also add 10uF cap between GND and VCC of nRF module

  • @pfeerick
    @pfeerick 10 лет назад

    I haven't watched your first video yet, so I don't know what your code looks like, but it's possible you're actually checking the Rx for data faster than the Tx is sending it... A better test would be a sequential number increment, then you'd find it if it is really loosing packets. btw, the big capacitor fixed issues I had both with normal and high-power versions of these, so I use a large buffer cap on all my boards now... regardless of low/high power or tx/rx.

    • @JulianIlett
      @JulianIlett  10 лет назад

      I am now sending a sequential number and also a pass/fail indicator from the boolean returned from write(). Slowly I'm starting to get my head around what's going on.

  • @lonniehowell2360
    @lonniehowell2360 10 лет назад

    Question. What power bank are you using for the arduino? (the black rectangular one)

  • @yaghiyahbrenner8902
    @yaghiyahbrenner8902 10 лет назад

    Expecting continuous successful data transfer at high speed data transfer rates at long distances doesn't make sense to me. Normally, if an expected payload is not delivered, a automatic retry is used with a ring buffer to build and re-construct the data effectively, doesn't this chip come with this technology? or is the software library handling this scenario?

  • @danielwiegert6067
    @danielwiegert6067 10 лет назад +1

    Btw, sending and recieving antenna should have the same polarization (angel on the antenna, en.wikipedia.org/wiki/Antenna_(radio)#Polarization) If you are into some diy home automation or sensor with Arduino, check out www.mysensors.org , complete library with everything and many examples. they are based on cheap Arduino with nrf24l01+ and some cheap sensors or actuators. Check it out! freeware ofc.

    • @danielwiegert6067
      @danielwiegert6067 10 лет назад

      Any also, lower the transmitting rate from standard 1Mbps to 250Kbps. much better range that way.

    • @danielwiegert6067
      @danielwiegert6067 10 лет назад

      My range between 2 nrf24l01 with PA (amp, + ext antenna) I get ~800meters

  • @raybright5805
    @raybright5805 9 лет назад

    Julian - Any follow up on improving range ?

    • @JulianIlett
      @JulianIlett  9 лет назад +1

      Ray Bright No, not done that yet - see +iforce2d - he's done lots of range tests.

  • @JoopMedia
    @JoopMedia 10 лет назад +1

    Hey Julian, good vid, keep meaning to grab some of those for a play... Take a look at one of my instructional videos (on my personal channel) FPV Antennas 101 - Polarization, Diversity & Gain Patterns it will give you some clues as to how to get the most out of those little units. Consider Circularly polarised antennas to avoid multipath interference. Check out the video I linked above and you'll see part of your prob, you've got omni directional / linearly polarised antenna trying to communicate with the PCB type antenna on the RX. Polarisation mis-match will be hitting your dB like a bitch ;) great vid as always bud

  • @jenishngl
    @jenishngl 9 лет назад

    can you share the arduino sketch for NRF24L01+??

  • @RaoulRacingRC
    @RaoulRacingRC 10 лет назад

    Could you send me your code? I am just new to the nRF24l01+, but cant find easy code to test my arduino's. I am trying to use the RF24 library. Or is there a better and easyer library?

    • @dparson
      @dparson 6 лет назад

      Way easier library: github.com/dparson55/NRFLite

  • @Kintepro
    @Kintepro 7 лет назад

    Not bad for being through a wall and still having a weak receiver.

  • @GGGatzy
    @GGGatzy 8 лет назад

    do you still have the code for this? thanks

  • @rasheedmalik6594
    @rasheedmalik6594 5 лет назад

    i guess the receiver gets overloaded(excuse my layman statement please). i also used the delay(50) in the loop and it started receiving correct data :)

  • @TheSuperjamesson
    @TheSuperjamesson 10 лет назад

    Is there any kind encryption by chance?

    • @JulianIlett
      @JulianIlett  10 лет назад

      ***** No mention of it in the data sheet

  • @miniwarrior7
    @miniwarrior7 8 лет назад

    with that amplified transceiver I made it out 1 km, receiver on a 3 story windowsill

    • @miniwarrior7
      @miniwarrior7 8 лет назад

      I eventually made a sketch to track how many packets I was missing, and tried different ack modes on vs off

  • @jusb1066
    @jusb1066 10 лет назад

    poking into a hole wouldntmake a difference, you need to get down to the water table, so only a long rod or buried water pipe would be a ground, so your wire was doing nothing!
    , im gonna go with mismatched antennas as the guess, if you had a second with the larger antenna, it may solve it?
    , of course the delay is reducing the data speed by a huge amount, i wonder if its wave interference with the larger antenna either not the right length at all?

    • @JulianIlett
      @JulianIlett  10 лет назад +1

      Yes. I nearly edited that bit out because it felt a bit stupid even when I tried it. I really am an RF numpty.

  • @deepumb678
    @deepumb678 7 лет назад

    can i get the code for both aurdinos

  • @mayankanand1379
    @mayankanand1379 7 лет назад

    hey can u provide the code please....

  • @dominikkrajca7320
    @dominikkrajca7320 10 лет назад

    Hello. Can you please do a review of XIAOMI 10400mAh power bank?

    • @JulianIlett
      @JulianIlett  10 лет назад

      Dominik Krajča I'm tempted to get one

  • @TornTech1
    @TornTech1 10 лет назад +1

    Hi Julian!
    Another brilliant video!! I listen to a podcast by flitetest.com where they discussed antenna construction for 900mhz video links, topics covered DIY antenna construction and they mentioned a video;
    vimeo.com/8826952 - It is titled Antennas 101 - Polarization, Diversity & Gain Patterns, an interesting watch which may give you some insight into maximizing your range.
    Keep the videos coming! very informative! your channel is becoming one that I look forward to seeing new uploads on!!
    Torn.

  • @donpgibson
    @donpgibson 9 лет назад

    Thanks for the video. I was having the exact problem you display with my project. Works 100% at PA_MIN and near 100% fail at higher power levels. My NRF2401 module is supplied with its own power from a regulated supply and I have added a 47uf capacitor across the pins with no change to performance. However by chance, I discovered that if I cup my hand over my circuit board with the, antenna poking out ,as a shield from the antenna, my high power performance goes to 100%. I can watch the change in performance change as I move my hand on and off the board. This suggests to me that RF is getting into the circuit at higher power levels disrupting the radio. I plan to add a shielded box around my circuit board (a Faraday cage of sorts) with the antenna poking out the side. I hope this may work for others. 73s de KJ6FO

    • @180jacob
      @180jacob 8 лет назад

      did you ever find a solution, I'm having exactly the same problem and observing the same results

    • @180jacob
      @180jacob 8 лет назад

      did you ever find a solution, I'm having exactly the same problem and observing the same results

    • @donpgibson
      @donpgibson 8 лет назад

      +Kevin Schreiber Thanks for sharing the article Kevin. Looks like good advice and the simple method of shielding looks promising.

    • @180jacob
      @180jacob 8 лет назад

      I eventually ended up using kapton tape to insulate and then copper foil soldered on to shield, works well but looks ugly so I have just bought some that already have a shield

    • @180jacob
      @180jacob 8 лет назад

      +Kevin Schreiber haven't received them yet but as soon as I do I will do a test, I use them on my quadcopter for control and telemetry. a number things effect range such as data rate and whether you are sending data both ways using ack payloads but I will try a range of conditions. the one I have bought is this E01-ML01DP5
      s.aliexpress.com/63muaAj2 it looks very well made and ebyte do a range of rf products that all recieve good reviews, it claims 2100m but we will see when I test it.