RFM gateway and sensors node with range issue

  • Hi all,
    First of all thank you for such great work. i been reading a lot on forum lately for different type of ideas and making my wireless communication work better or should i say reliably and today i plunge to register account and dear to ask question that might be very stupid or basic for all the black belt on this forum. so please go easy on me.

    i have been testing nrf radio with esp8266 (gateway) and battery powered nodes but i can not get them to work through the solid walls so i decided to give try to RFM 433mhz radio but again failure.

    so i m thinking i must be doing something wrong here, i watched tons of video on youtube about lora radio where people have achieved range in kilometres 🤔 but i can not get range on these radio more than 20 meters, in example folder all examples are based on nrf radio. so if you can please guide me what i m doing wrong here or i m using wrong radio or wrong radio antenna. is there any sketch for gateway and for node to do some testing? also i have added 10uf and 100nf radio

    Gateway esp8266 with RFM69HCW https://www.aliexpress.com/item/32878809891.html
    Gateway Antena:

    Node with RFM69CW https://www.aliexpress.com/item/32887379895.html
    Node Antena :

    Gateway Sketch

    // Enable debug prints to serial monitor
    #define MY_DEBUG
    // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
    #define MY_BAUD_RATE 9600
    #ifdef ESP8266
    // For RFM69
    #define MY_RADIO_RFM69
    #define MY_RFM69_FREQUENCY RFM69_433MHZ // Set your frequency here
    #define MY_IS_RFM69HW // Omit if your RFM is not "H"
    #define MY_RFM69_IRQ_PIN D1
    #define MY_RFM69_IRQ_NUM MY_RFM69_IRQ_PIN
    #define MY_RFM69_CS_PIN D8 // NSS. Use MY_RFM69_SPI_CS for older versions (before 2.2.0)
    // For RFM95
    #define MY_RADIO_RFM95
    #define MY_RFM95_IRQ_PIN D1
    #define MY_RFM95_IRQ_NUM MY_RFM95_IRQ_PIN
    #define MY_RFM95_CS_PIN D8
    #define MY_GATEWAY_ESP8266
    #define MY_WIFI_SSID "MySSID"
    #define MY_WIFI_PASSWORD "MyVerySecretPassword"
    // Set the hostname for the WiFi Client. This is the hostname
    // it will pass to the DHCP server if not static.
    #define MY_HOSTNAME "ESP8266_GW"
    // The port to keep open on node server mode
    #define MY_PORT 5003
    // How many clients should be able to connect to this gateway (default 1)
    #include <MySensors.h>
    void setup()
    	// Setup locally attached sensors
    void presentation()
    	// Present locally attached sensors here
    void loop()
    	// Send locally attached sensors data here

    Sketch for Temperature Sensor node

    // Enable debug prints to serial monitor
    #define MY_DEBUG 
    #define MY_RADIO_RFM69
    #define MY_RFM69_NEW_DRIVER
    #define MY_RFM69_FREQUENCY RFM69_433MHZ
    #define MY_IS_RFM69HW
    #include <MySensors.h>  
    #include <DallasTemperature.h>
    #include <OneWire.h>
    #define COMPARE_TEMP 1 // Send temperature only if changed? 1 = Yes 0 = No
    #define ONE_WIRE_BUS 3 // Pin where dallase sensor is connected 
    #define MAX_ATTACHED_DS18B20 16
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
    DallasTemperature sensors(&oneWire); // Pass the oneWire reference to Dallas Temperature. 
    float lastTemperature[MAX_ATTACHED_DS18B20];
    int numSensors=0;
    bool receivedConfig = false;
    bool metric = true;
    // Initialize temperature message
    MyMessage msg(0,V_TEMP);
    void before()
      // Startup up the OneWire library
    void setup()  
      // requestTemperatures() will not block current thread
    void presentation() {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Temperature Sensor", "1");
      // Fetch the number of attached temperature sensors  
      numSensors = sensors.getDeviceCount();
      // Present all sensors to controller
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
         present(i, S_TEMP);
    void loop()     
      // Fetch temperatures from Dallas sensors
      // query conversion time and sleep until conversion completed
      int16_t conversionTime = sensors.millisToWaitForConversion(sensors.getResolution());
      // sleep() call can be replaced by wait() call if node need to process incoming messages (or if node is repeater)
      // Read temperatures and send them to controller 
      for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {
        // Fetch and round temperature to one decimal
        float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
        // Only send data if temperature has changed and no error
        #if COMPARE_TEMP == 1
        if (lastTemperature[i] != temperature && temperature != -127.00 && temperature != 85.00) {
        if (temperature != -127.00 && temperature != 85.00) {
          // Send in the new temperature
          // Save new temperatures for next compare

  • Mod

    Welcome to the MySensors community @wiredfrank

    The gateway configuration says that you have a rfm69 and a rfm95 radio connected. Is that really the case?

    The node is co figured to use a rfm69 with the new driver. The new driver is not compatible with the default driver, so the node should not be able to communicate with the gateway at all.

    Note: rfm95 is a LoRa radio, while rfm69 is not.

    What do the debug log on the gateway and on the node say?

  • @mfalkvidd thank you for quick reply, that was my copy/paste as my code is mess and i tried to paste as clean as i could hence this mistake, but i m using RFM69 radio. if rfm69 isnt lora radio then it mean range isn't going to be more then 15 to 20metter ? 😢 may be this is the problem? should i switch to rfm 95 for longer range? (i feel stupid now)

    Gateway powered on and this is on serial output

    109 TSF:LRT:OK
    125 TSM:INIT
    139 TSF:WUR:MS=0
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 7
    connected with wifinet, channel 7
    dhcp client start...
    394 TSM:READY:ID=0,PAR=0,DIS=0
    451 MCO:BGN:STP
    1156 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:

    sensors powered on and on gateway

    96189 TSF:MSG:READ,30-30-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
    96250 TSF:MSG:BC
    96268 TSF:MSG:FPAR REQ,ID=30
    96298 TSF:PNG:SEND,TO=0
    96323 TSF:CKU:OK
    96341 TSF:MSG:GWL OK
    96980 TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
    98261 TSF:MSG:READ,30-30-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
    98322 TSF:MSG:PINGED,ID=30,HP=1
    99128 TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
    99256 TSF:MSG:READ,30-30-0,s=255,c=3,t=15,pt=6,l=2,sg=0:0100
    100031 TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100
    100662 TSF:MSG:READ,30-30-0,s=255,c=0,t=17,pt=0,l=5,sg=0:2.3.1
    101229 TSF:MSG:READ,30-30-0,s=255,c=3,t=6,pt=1,l=1,sg=0:0
    103299 TSF:MSG:READ,30-30-0,s=255,c=3,t=11,pt=0,l=18,sg=0:Temperature Sensor
    103867 TSF:MSG:READ,30-30-0,s=255,c=3,t=12,pt=0,l=4,sg=0:0.01
    105334 TSF:MSG:READ,30-30-0,s=0,c=0,t=6,pt=0,l=0,sg=0:
    106400 TSF:MSG:READ,30-30-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
    107440 TSF:MSG:SEND,0-0-30-30,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1
    108074 TSF:MSG:READ,30-30-0,s=1,c=1,t=38,pt=7,l=5,sg=0:5.80
    108643 TSF:MSG:READ,30-30-0,s=255,c=3,t=0,pt=1,l=1,sg=0:164
    109530 TSF:MSG:READ,30-30-0,s=0,c=1,t=0,pt=7,l=5,sg=0:21.0
    165820 TSF:MSG:READ,30-30-0,s=1,c=1,t=38,pt=7,l=5,sg=0:4.72
    166505 TSF:MSG:READ,30-30-0,s=255,c=3,t=0,pt=1,l=1,sg=0:110
    167395 TSF:MSG:READ,30-30-0,s=0,c=1,t=0,pt=7,l=5,sg=0:20.8

  • Your node sketch is configured as HW model but you said you're using standard radio on it

    comment out line below

    #define MY_IS_RFM69HW

    in sketch running radio without 6 legged chip next to ant pin

    Been there done that, but I was getting 10 cm range on coil type aerials 😉

  • i tried both radio types but can not get range more than 20m max in open air, tried coil type antenna, and all sorts things including capacitor from 10uf to 100uf, i m sure there is something missing in my setup i just dont know what it is, even nrf with pcb antenna perform better in open air, i wonder if any one even using rfm69 at all or it just me banging my head around.

  • Like @mfalkvidd said, if you use the new driver, you have to use it on all of the nodes and the gateway, as it doesn't work together with the old one.
    You said your code is a mess, maybe it is better to step back and use examples for both the node and the gateway and start from there. If that is working you can add your code. Just to exclude something is overlooked.

  • @wiredfrank roll back to old driver, use 17cm(433Mhz)/8.5cm(868 MHz) piece of straight wire as antenna.
    Solder extra 100-470uf capacitor directly to supply pins of the radios too, especially HW versions. Transient current spikes can cause all sorts of problems.

    I'm using rfm69 mixed HW and non HW versions , and 500m meters is easily achieved, even on spider dupont wire connections and 2.4v supply(2x nimh aa cells).

    also, don't rely on controller for connection tests, use debug serial output on both ends to confirm link.

  • Thank you for suggestion, is there any sketch for ping pong type communicate to do some testing?

  • Hardware Contributor

    in your gw sketch, your defines should be like this:

    #define MY_RADIO_RFM69
    #define MY_RFM69_NEW_DRIVER
    #define MY_RFM69_FREQUENCY RFM69_433MHZ // Set your frequency here
    #define MY_IS_RFM69HW // Omit if your RFM is not "H"
    #define MY_RFM69_IRQ_PIN D1
    #define MY_RFM69_IRQ_NUM MY_RFM69_IRQ_PIN
    #define MY_RFM69_CS_PIN D8 // NSS. Use MY_RFM69_SPI_CS for older versions (before 2.2.0)

    and there is the RFM69_RFM95_ATC_SignalReport.ino sketch for your node, in mysensors examples

     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2019 Sensnology AB
     * Full contributor list: https://github.com/mysensors/MySensors/graphs/contributors
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     * Version 1.0 - tekka
     * ATC mode settings and signal report functions, on RFM69 and RFM95 nodes
    // Enable debug prints
    #define MY_DEBUG
    // Enable and select radio type attached
    // RFM69
    #define MY_RADIO_RFM69
    #define MY_RFM69_NEW_DRIVER   // ATC on RFM69 works only with the new driver (not compatible with old=default driver)
    #define MY_RFM69_FREQUENCY RFM69_433MHZ
    //#define MY_RFM69_ATC_TARGET_RSSI_DBM (-70)  // target RSSI -70dBm
    //#define MY_RFM69_MAX_POWER_LEVEL_DBM (10)   // max. TX power 10dBm = 10mW
    // RFM95
    //#define MY_RADIO_RFM95
    //#define MY_RFM95_ATC_TARGET_RSSI_DBM (-70)  // target RSSI -70dBm
    //#define MY_RFM95_MAX_POWER_LEVEL_DBM (10)   // max. TX power 10dBm = 10mW
    #include <MySensors.h>
    // ID of the sensor child
    #define CHILD_ID_TX_LEVEL       (1)
    #define CHILD_ID_TX_PERCENT     (2)
    #define CHILD_ID_TX_RSSI        (3)
    #define CHILD_ID_RX_RSSI        (4)
    #define CHILD_ID_TX_SNR         (5)
    #define CHILD_ID_RX_SNR         (6)
    // Initialize general message
    MyMessage msgTxSNR(CHILD_ID_TX_SNR, V_CUSTOM);
    MyMessage msgRxSNR(CHILD_ID_RX_SNR, V_CUSTOM);
    MyMessage msgTxLevel(CHILD_ID_TX_LEVEL, V_CUSTOM);
    MyMessage msgTxPercent(CHILD_ID_TX_PERCENT, V_CUSTOM);
    MyMessage msgUplinkQuality(CHILD_ID_UPLINK_QUALITY, V_CUSTOM);
    void setup()
    void presentation()
    	// Send the sketch version information to the gateway and controller
    	sendSketchInfo("ATC", "1.0");
    	// Register all sensors to gw (they will be created as child devices)
    	//present(CHILD_ID_TX_RSSI, S_CUSTOM, "TX RSSI");
    	//present(CHILD_ID_RX_RSSI, S_CUSTOM, "RX RSSI");
    	//present(CHILD_ID_TX_SNR, S_CUSTOM, "TX SNR");
    	//present(CHILD_ID_RX_SNR, S_CUSTOM, "RX SNR");
    void loop()
    	// send messages to GW
    	// retrieve RSSI / SNR reports from incoming ACK
        Serial.print("UPLINK QUALITY RSSI=");
        Serial.println(transportInternalToRSSI(_transportSM.uplinkQualityRSSI)); // UPLINK QUALITY RSSI
    Serial.print("TX LEVEL DBM=");    
    Serial.println(transportGetTxPowerLevel());  //TX LEVEL DBM
    Serial.print("TX LEVEL PERCENT="); 
        Serial.println(transportGetTxPowerPercent());  // TX LEVEL PERCENT
    Serial.print("RX RSSI=");
        Serial.println(transportGetReceivingRSSI());  //RX RSSI
    Serial.print("TX RSSI=");
        Serial.println(transportGetSendingRSSI());    //TX RSSI
    	// wait a bit

    This is in case your modules are 433mhz. Try with a straight wire (one core), with the right length. You can also reduce some length by small bits and see if it improves.
    Good to know is 433mhz requires longer antenna, and bigger gnd plane for better results, compared to upper freq like 866mhz etc.
    A last solution if the gnd plane size would be the culprit could be to use a dipole antenna for test. by connecting two opposite wires. one to ant, the other to gnd close to ant

    You should be able to get more than nrf24 or some nrf52, easily 🙂
    I don't think you need rfm95 but that depends on the range you really need. that said some lora modules are maybe a bit more power efficient (more recent tech). but I think it's a detail for your usecase

    Can't help you on esp8266 pin mapping, I don't use it as gw (I've esp32, nrf52 and samd as gateways for prod and dev)

    Note: the new rfm driver has compatible communication for rfm69<->rfm95. Like others said, for using new driver, you need to enable it on both ends (gw+nodes) because it uses a different packet format than old driver.

  • Thank you everyone for reply, i been searching around for antenna and how to test them and came across this guy.
    #191 Optimizing Antennas using a cheap N1201SA VNA (Vector Impedance Analyzer), LoRa, Review – 16:29
    — Andreas Spiess

    i m thinking to buy one of these VNA as i m shooting in dark with antenna right now and no way of knowing what is going on under the hood, i dont mind spending more to get miniVNA Tiny+ but what you experts think?

  • @wiredfrank It's a bit of overkill to be honest for hobby purposes, a quarter wave wire works fine when cut to the recommended dimension, or if concerned over the groundplane, a dipole as outlined by @scalz above.

    A VNA is typically used to determine the exact resonant frequency of an antenna, if it's out by a fraction it won't make much difference in performance.

  • @zboblamont thank you, i think part of my problem might be allowed frequency is 868MHz as compare with mine 433MHz 😞 (school boy error) i have ordered 898MHz module and i will give them try.

  • @wiredfrank Not sure what you meant by 433MHz not being allowed, so far as I recall that band is permitted worldwide but has transmit duration restrictions as it's a shared band.
    I started off with the 433MHz RFMs and never had the slightest issue, penetrating walls and floors with plenty of range outside, even at one stage buried in snow.
    The range and penetration of 868 v 433 will be slightly reduced, but performance should still be better than 2.4GHz.
    The point about the recommended wire length being close enough remains valid

  • sorry i wasn't clear in my reply, in my country 868MHz is listed allowed frequency.

Log in to reply

Suggested Topics