💬 Connecting the Radio


  • Mod

    @manul it would indeed be amazing, but the radios consume so much power when listening that it is no use to sleep the mcu.

    The smartsleep feature is the best alternative so far. documentation: https://www.mysensors.org/download/sensor_api_20#sleeping



  • Hi,
    I'm interested in using long range sensors based on LoRa and I saw on this forum that LORA radios should be supported with the RFM95. But I did not see any explanation or advice on hardware, pins, etc.
    Could anyone confirm that the type of radio to attach on the gateway and the sensor is like:
    link to aliexpress RFM95 radio

    I see the chip mentioned is "RF96", but I did not see that name on the forum..(it was SX1276 I think), so I don't know.
    Regarding frequency, I uderstood from other websites that in France, the frequency should be 868MHz, correct ? No risk to interfere with EnOcean/Zwave devices ?

    I see also that these RFM95 radios have many more pins than the NRF24L01 : should I use the same pins than for NRF24 and leave the others unused ?
    and then in the sketch, use the #define RFM95 statement ? Is it all that simple ?

    And then I install the RFM95 as a second MySensors gateway on my network (for instance as an ethernet gateway) ?

    br,
    Ricorico94



  • Hi ricorico94,
    If you are interested in LoRa and how to connect the radio have a look at www.thethingsnetwork.org



  • Hello!
    I would like to use NRF24+PA radio, but when I try to use it instead normal NRF24 radio in MQTT-gateway it just dont work. I cant make connection between sensors and gateway.

    Normal radio works just fine, but the range is a bit short for me.

    I tried the low power setting also, but no help.

    What should I do to make it work?

    I use Domoticz as my controller.


  • Mod

    Welcome to the MySensors community @mattiman !
    Could you post the debug logs of the node and the gateway? That's usually the quickest way to get a hint on what is wrong.

    If you haven't already, you can also look at https://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help/ which has recommendations on the most common problems and how to troubleshoot them.

    People have also been helped by this: http://blog.blackoise.de/2016/02/fixing-your-cheap-nrf24l01-palna-module/



  • Hi
    I use Arduino Pro Mini 5V and i want user radio RFM69HW. I must use logic level converter from 5V to 3.3V to connect radio or i can only reduce power from 5V to 3.3V to VCC ?
    On this page is nothing describe that i must use logic level converter,...but some users on this page write that i must use:
    https://www.openhardware.io/view/268/RFM69HW-interstitial-board-for-Arduino-Pro-Mini#tabs-comments

    Now i have connected only with reduce power to 3.3V but my Arduino not working still time. Only some minutes to test...


  • Mod

    It was already answered to you in another topic and if you read in the openhardware project it is clearly stated that it is meant for pro mini 3.3v. If you connected it to a 5v pro mini you most likely fried the RFM69 module.



  • I connect to 5V Arduino but i use AMS1117 to step down power 5v to 3.3V and radio still working.



  • I have two of my nodes using rfm69hw and mini pro 5v 17mhz. I only step down the power line to 3.3v, the comms lines work just fine with 5v. I also remember reading somewhere that this is actually the case, even though the datasheet says the opposite.


  • Mod

    I'd follow the datasheet and don't take the risk of frying the radio.



  • They've been working for more than 6 months now as part of a test run and are not yet fried.

    There is other people around reporting the same with at least the rfm69HW. I remember someone stating that the new models are more robust in this regard than older models, in spite of the manufacturer not yet stating 5v tolerance in the data pins.

    In fact the datasheet never mentions 5v intolerance, and it does never actually mention a max voltage for the data pins, only for Vdd.

    It seems like the board does something with the voltages in the data pins anyways, since if it was using the definitions of the logic levels (as a percent of Vdd) as they appear in the datasheet, it should not be able to communicate at all with a 5v arduino when powered at 3.3v and no logic level shifter on the data pins - but it does.

    This doesn't mean this is good practice, directions in the datasheet are there for some reason and my nodes will eventually get a logic level shifter when they finally go into their final case. But reality is it seems at least RFM69HW can tolerate 5v for months without being fried.


  • Mod

    still I would not advise someone to go ahead and use them without a level shifter as I would not take responsibility to damage someone else hardware 3.3V is still able to talk to 5V, depends on how large is the tolerance zone around the 2.5V grey zone of the arduino



  • I would not expect anyone to put or take responsability on anyone for a piece of advice. I think we are here to help each other by sharing information and our own experiences.

    The full picture should be more than clear at this point for anyone reading this and other threads, but I will clarify once more. Best practice is using the rfm69 family with a logic level converter when connected with a 5v arduino, given that as of today the manufacturer's datasheet is not 100% clear on this area. From a problem solving perspective, keep in mind, however, that should a converter not be in place for any reason, the setup might or might not work, so if it doesn't don't discard it as a cause but don't take it for granted at 100%. And even if it works, do plan for adding a converter.


  • Plugin Developer

    @hek @mfalkvidd RFM95 radio part connection details are missing.



  • Is it possible to change any of the radio pins 9, 10, 11 to something else? The reason is that I'd like to use 4 PWM pins and currently I only have pins 3,5,6 available on my Pro Mini.


  • Mod

    @maghac yes. Redefining for example the nss/cs pin is possible as described on the connecting the radio page.

    For more exact i structions we'd need to know which radio you are using.



  • Thanks - I use NRF24 radios.

    I found MY_RF24_CE_PIN which I redefined to pin 8 which worked absolutely fine.

    The problem I have now is that now cannot use the Newbie PCB anymore 😰 😉


  • Mod

    @maghac doh!
    How about using a software pwm library instead? I have not tried any, but I have seen this before: https://github.com/Palatis/arduino-softpwm


  • Hardware Contributor

    @maghac cut the trace with a small knife and re-attach it with a wire.



  • @mfalkvidd Maybe I'll give that a try.

    I think FOTA will fail as the bootloader will try to initialise the radio with the default pin, right? Then I'll need software pwm or recompile my own bootloader.


  • Mod

    @maghac or go for dual optiboot



  • @gohan But then I would need additional hardware to use DualOptiBoot?

    Anyone have any quick instructions on how to build a new custom version of MySensorsBootLoader using MY_RF24_CE_PIN = 8 😉

    I have access to ArduinoIDE on Windows or a Ubuntu 16.04 box.


  • Mod

    @maghac yes, an spi flash chip. It is not a bad solution since the firmware is transferred during normal node operation and if it fails nothing bad happens.


  • Hardware Contributor

    @maghac - EasyPCB rev 10 will probably include spi flash 😉


  • Plugin Developer

    It might be an idea for the "connecting the radio" page on MySensors to point to these handy boards:
    https://www.aliexpress.com/item/Free-shipping-Nano-328P-IO-wireless-sensor-expansion-board-for-XBEE-and-NRF24L01-Socket-for-arduino/32298692903.html

    Then people have to just plug in the NRF24 boards. And it also makes it much easier to connect lots of sensors. I wish I had known about these boards earlier, it would have saved me a lot of time.


  • Mod

    It depends if you want to go with the nano or the pro mini like many nodes use



  • Just noticed, that MySensors 2.2 changed default RF24 CS pin on Mega2560 from pin 10 to pin 53 (SS) 😕 I could not find any reference to the change from 2.2 change log nor from pull request (722)... No wonder RF24 worked with 2.1.1 but not with 2.2 on M2560.
    Contrary to instruction above, I wanted to continue with old pins (same as on Uno) and set the pins explicitly to MY_RF24_CE_PIN=9 & MY_RF24_CS_PIN=10. Now transport seems quite good (with combined HW and SW ack, static GW address, no routers) 🙂


  • Mod

    @kimmohop thanks for reporting. Looks like the change was introduced in commit b132a8a81e2ba6c81bcc6e2afce7513cdddbe193. I have added a message to the release notes.


  • Plugin Developer

    @gohan perhaps it can be added to the buying advice page? There the Nano is advised.


  • Mod

    @alowhum which of the buing pages are you referring to? https://www.mysensors.org/store/buying_guide has the pro mini.


  • Plugin Developer

    @mfalkvidd: Yes that's the page I'm referring to.


  • Mod

    @alowhum I'm confused. Could you clarify what you want us to change on that page?


  • Plugin Developer


  • Plugin Developer

    While you're at it: maybe tell people about the NRF52 option?


  • Mod

    @alowhum thanks. That does indeed look lika nifty solution. I'll add it.

    For the nrf5x, I don't know which boards are user-friendly, and I haven't understood if MySensors nrf5x support is "production ready" yet or if it requires people to tweak or otherwise do special stuff to get a node working. I don't think I have seen anyone building nrf5x MySensors nodes yet.


  • Plugin Developer

    Lots of people have I think, check the NRF5 thread. I built my own first one this week (BME280 sensor). It rocks.

    • Arduino with built in NRF24 for $3.
    • The size of a postage stamp.
    • Powerful enough to use the simple encryption functionality.
    • Antenna socket: just plug in antenna for more range.


  • Maybe it's just me, but in the first image of a pro mini the top row of pins seem to be reversed to what I normally see.....



  • My first post at mysensors.org. Sounds like a great tool. Tried to set up an MQTT Gateway with Hardware as described above, ESP8266 and RFM69W with 868 MHz, to connect some Technoline TX29DTH-IT temperature and humidity sensors, without success. ES8266 is working , connects with my wifi network and also connects to my mosquitto server. But I do not get any connection from RFM to technoline. Is there anyone out there who was able to get this running?


  • Mod

    @42isjustanumber welcome to the forum!
    MySensors uses its own protocol and is therefore not compatible with the TX29DTH-IT.
    You can however build your own temperature and humidity sensors from examples on this website and start expanding your network from there!



  • @Yveaux: thanks for the information. I thought it's much easier. I heard about LaCrosse Gateway which seems to be able to connect to Technoline temperature and humidity sensors with Nodemcu and RFM69 hardware and connect it to FHEM. I wanted to have a more general approach and just forward data from technoline sensors via MQTT. But if this is a totally different protocol I'll have to look for another solution.


  • Mod

    Mysensors is just taking care of transporting the data, if you have a sketch that can read data from any sensors, you can then send those values via mysensors to any controller supported.



  • That was my misunderstanding. I thought with the hardware and settings mentioned above, I would be able to read the data from any Technoline sensor. There's a YouTube video from Miika Kurkela explaining how to interpret the data from these sensors. But to be honest, I only unterstand half of it.


  • Mod

    If you have a working code that works on esp8266, you can use it as a node or as a gateway with sensors and no radio module.



  • Hi, just to warn navigation that the above code for RFM69 seems to have a glitch:

    #define MY_RFM69_FREQUENCY RF69_433MHZ doesn't compile but changing it to #define MY_RFM69_FREQUENCY RFM69_433MHZ it does. (missing the "M" in RF69_433MHZ).


  • Mod

    @joaoabs thanks for noticing. I have updated the page.



  • After running NRF24L01+ for a few years I recently decided to upgrade to several NRF24L01+PA+LNA (Antenna version) using the link from this page. Initially the performance was worse. Fail to find gateway, fail to send data and lots of NACKs. However eventually I was able to get them working. Below is a summary of tweaks and suggestions from various Mysensor Forum posts that helped stabilize my sensor network.

    1. Add 47uf capacitor between 3v and ground pin on the transceiver.

    2. Add plastic-wrap then a tinfoil shield as per other threads. Tinfoil needs to to touch the base of the antenna (ground).

    3. My 5V switching power supply to the Arduino Nano was causing problems. Some sort of noise on the wire? When I disconnected the transformer and powered the arduino by laptop usb, the signal was much more reliable. So I added a 1000uf capacitor between ground and 5V coming from the transformer which filtered out the noise coming from the power supply. This is probably not applicable to battery powered devices.

    4. Use static node addressing for each node - automatic addressing sometimes randomly make bad routing decisions bypassing repeater nodes and choosing far away nodes.
      // Far-from-gateway sensor node
      #define MY_NODE_ID 2
      // Parent is a repeater node
      #define MY_PARENT_NODE_ID 1
      #define MY_PARENT_NODE_IS_STATIC

    5. Lower the power on the transceiver. Try each power level reboot the node and pay attention to: Setup speed, how many NACKs.
      // RF24_PA_MIN = -18dBm;
      // RF24_PA_LOW = -12dBm;
      // RF24_PA_HIGH = -6dBm;
      // RF24_PA_MAX = 0dBm
      #define MY_RF24_PA_LEVEL (RF24_PA_LOW)

    6. Run the RF24 scanner example for a long time to find a channel that is free from noise. I ran it for a day to pick up neighbourhood noise and loaded the results into a spreadsheet to graph. Set the clearest channel on all my nodes. e.g.
      #define MY_RF24_CHANNEL (105)

    7. In domoticz I lowered the ACK time from 1200 to 400 to avoid broadcast storms/collisions. On the nodes after each send or receive add a "wait(LONG_WAIT);" to allow ACKs to settle between transmissions ( e.g. 500ms).

    8. Run a ping-pong test between two battery powered mobile nodes to find optimal locations for your gateway, repeaters and sensors. Find the outer limits and keep the nodes well within those limits. Try not to place a node at the outer range limit, add repeaters. Sometimes moving a few feet in one direction can have a big difference.


  • Plugin Developer

    @dmonty which hardware did you use? It sounds like you tried the old cheap model without shielding.

    There are way better modules out there now which will give you far less trouble.


  • Mod

    Agreed, the shielded modules can run at full power without any problem



  • @alowhum @gohan - I used the non-shielded module found in the "Shopping Guide" on this page: https://www.mysensors.org/build/connect_radio. Used bought from the seller that the link took me to.

    The Connecting the Radio page get's you up and running. Would be nice if the "Shopping Guide" - grouped optimal matching components into a plug-n-play style "Shopping Cart". e.g. Optimal recommended component groups for:

    1. Gateway node.
    2. Repeater node.
    3. Sensor node.

    a) usb powered.
    b) transformer powered.
    c) battery powered.
    d) solar powered.

    I think my next experiment may be to pick up the 3v regulated power sockets to see if they will help in increasing the power and range as I've read the 3.3v regulator on the Arduino Nano is not very good at powering the radio.


  • Plugin Developer

    That shopping guide (heck, most examples on the site) is often out of date.

    I'd recommend checking out this thread:
    https://forum.mysensors.org/topic/9668/cdebyte-s-new-nrf24-modules-are-great-and-cheap/26

    For your nodes I'd highly recommend getting the "nano wireless board" from places like aliexpress. The radios just plug right into it.

    For the Raspberry Pi there is also a really easy to use 'hat' that allows you to plug the NRF24 directly into it:
    https://forum.mysensors.org/topic/9696/i-got-a-plug-and-play-nrf24-shield-for-the-pi-on-aliexpress



  • Concerning RF24 Plus datasheet, it seems that a more recent version is available at https://infocenter.nordicsemi.com/pdf/nRF24L01P_PS_v1.0.pdf?cp=8_4_0_0


  • Mod

    Thanks @FlyingDomotic
    I have updated the page.



  • A journal update on NRF24L01+PA+LNA (Antenna version). After 4-5 months two of them stopped transmitting. I had also purchase and installed the 3.3v regulator base socket to help improve overall transmission reliability.

    Loaded the RF24 library GettingStarted example onto two arduinos connected to laptop and a desktop. Changed the code to match MySensors pinout and data-rate, along with a free channel found by the RF24 scanner example.

    RF24 radio(9,10);
    

    ...snip...

      radio.begin();
      radio.setDataRate(RF24_250KBPS); 
      radio.setChannel(120);
      //radio.setPALevel(RF24_PA_MIN);
      radio.setPALevel(RF24_PA_LOW);
      //radio.setPALevel(RF24_PA_HIGH);
      //radio.setPALevel(RF24_PA_MAX);
    

    I Moved laptop to far edges of the range and tried various power levels for NRF2L01 as well as the PA+LNA. Sketch default is RF24_PA_LOW which turns out to have the farthest range with the least packet loss and fastest turn around time packet time. I also cycled through the various radios to weed out the ones that were week. Even with the 3.3v base socket, a capacitor helps as well as cellophane+tinfoil on the PA LNA modules.

    I then put one of the arduinos onto a battery pack and placed it next to each of my sensors. Then used the laptop to see packet loss next to repeater nodes and gateway. When near the edge of the range moving the antenna a few feet in different directions will cause packet loss. When a sensor is at the edge it is better to move radios closer to each other or a add a repeater. I thought PA LNA would be better in all locations but it turns out that the cheaper base radios sometimes perform better.


  • Mod

    @dmonty did you use the shielded radio module?



  • @gohan said in 💬 Connecting the Radio:

    @dmonty did you use the shielded radio module?

    Yes they are shielded.

    I found another way to find optimal sensor location using an on/off loop script as a ping. Start the ping running then move the antenna to find best mount point location.

    To find the strongest location it helps to find the weak-signal boundaries where packets are lost, then make sure the antenna is on the inside of the boundary. Move the antenna:

    • X+, X-
    • Y+, Y-
    • Z+, Z-
    #!/bin/sh
    # Desc: Domoticz ping script to help find optimal location for sensor antenna.
    # Auth: Dean Montgomery
    # Date: April 21, 2020
    
    # Url of domoticz server.
    HOST="http://192.168.0.1:8080"
    # ID=14 is device idx of a light switch found on the Divices page of domoticz.
    ID=14
    
    while true; do
      CMD="${HOST}/json.htm?type=command&param=switchlight&idx=${ID}&switchcmd="
      echo "=== ON ==="
      wget -q -O - "${CMD}On"
      sleep 1
      echo "=== OFF ==="
      wget -q -O - "${CMD}Off"
      sleep 1
    done
    

    It may help to include a dummy ping light switch in all sensor nodes dedicated for this purpose.



  • Tips for connecting the LoRa Radios:

    1. Use de-coupling capacitor on power supplies (as per above other radios).
    2. Carefully select: MY_RFM95_TX_POWER_DBM and MY_RFM95_MAX_POWER_LEVEL_DBM as Semtech spec states +20dBm output power is only for 1% duty cycle operations, and some modules (AI-Thinker RA-02) are only rated as +18dbm.
    3. If you build a LoRa radio gateway using an ESP32 (for example), take care to provide a separate, low-noise 3.3V power supply to the radio as the on-board voltage regulator may not be able to supply enough current at the higher RF output power levels.


  • Since I already (half-heartedly) posted drawings of some RFM modules I created a while ago in another thread, I might as well put a little RFM69 / RFM9x infographic or cheat sheet together and share it with everyone. It's supposed to give beginners a quick overview over the available MySensors-compatible HopeRF modules.

    If you guys mind that I included the MySensors logo and mascot, please let me know and I'll remove it ASAP.

    RFM Cheat Sheet.png


  • Hardware Contributor

    Connection diagram/circuit between RFM module and atmega328p-au TQFP footprint.

    534dda4f-7899-44b6-b852-3b3fbeff6f2a-image.png



  • I would like to ask about the radio module connection - I am using SX1276 and I connect it the same way as described by @sundberg84 said in 💬 Connecting the Radio except I additionally connect also RST (NRESET) pin according to this https://github.com/sandeepmistry/arduino-LoRa/blob/master/README.md#semtech-sx1276777879-wiring

    Is it necessary?

    Thanks



  • I was wondering about the lengths for the antennas mentioned on this page.

    For 868Mhz is mentioned a length of 82.2 mm on this page. The length most often mentioned over the internet - as first result of the 1/4 wave calculation - is 86,5mm.
    Searching a little deeper through the internet, i found that the antenna should be "a little shorter". Then they end up with around -1cm shorter or something around or more.
    One page mentioned the physically effect that the wave is moving in chopper around 5% slower as the theoratical speed. If i substract 5% of 86,5mm i end up with the here mentioned 82,2mm.

    I was very suprised about the different "approaches" for such a basic thing as antenna length every single . As most of the application over the internet seem to work somehow with all that different lengths, it seems to be just a fine-tuning thing.
    Anyway, i think it would be nice to mention this details here because most people will wonder about the 82,2mm in the first view...

    best regards
    Jens


Log in to reply
 

Suggested Topics

  • 3
  • 164
  • 110
  • 584
  • 347
  • 2

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts