new RFM69 Gateway and node



  • Hello,

    I did now switch from NRF24 to RFM69 for the gateway and one sensor.

    I can connect to the gateway from my controller (FHEM) without any problems and dont see any errors in the debug messages of the controller.

    The node shows some strange behavior and does not connect to the gateway.

    TSM:INIT
    TSF:WUR:MS=0
    TSM:INIT:TSP OK
    TSM:INIT:STATID=40
    TSF:SID:OK,ID=40
    TSM:FPAR
    TSF:MSG:SEND,40-40-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    !TSM:FPAR:NO REPLY
    TSM:FPAR
    TSF:MSG:SEND,40-40-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    !TSM:FPAR:NO REPLY
    TSM:FPAR
    TSF:MSG:SEND,40-40-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    !TSM:FPAR:NO REPLY
    TSM:FPAR
    TSF:MSG:SEND,40-40-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
    !TSM:FPAR:FAIL
    TSM:FAIL:CNT=1
    TSM:FAIL:PDT
    

    Is this a problem related to the controller or to my communication between the node and the gateway?

    Are there any samples to test the communication between two RFM69 devices to check that the communication is not the problem.

    Regards
    Stefan



  • Can you post your sketches for your gateway and node?
    Also what hardware are you using (radio and mcu etc)?



  • I use the same hardware for the gateway and the node, a Wemos and a RFM69HW module.

    The gateway is using the following sketch:

    /**
     * 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-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/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.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.0 - Henrik EKblad
     * Contribution by a-lurker and Anticimex,
     * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
     * Contribution by Ivo Pullens (ESP8266 support)
     *
     * DESCRIPTION
     * The EthernetGateway sends data received from sensors to the WiFi link.
     * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
     *
     * VERA CONFIGURATION:
     * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin.
     * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003
     *
     * LED purposes:
     * - To use the feature, uncomment any of the MY_DEFAULT_xx_LED_PINs in your sketch, only the LEDs that is defined is used.
     * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
     * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
     * - ERR (red) - fast blink on error during transmission error or recieve crc error
     *
     * See http://www.mysensors.org/build/esp8266_gateway for wiring instructions.
     * nRF24L01+  ESP8266
     * VCC        VCC
     * CE         GPIO4
     * CSN/CS     GPIO15
     * SCK        GPIO14
     * MISO       GPIO12
     * MOSI       GPIO13
     * GND        GND
     *
     * Not all ESP8266 modules have all pins available on their external interface.
     * This code has been tested on an ESP-12 module.
     * The ESP8266 requires a certain pin configuration to download code, and another one to run code:
     * - Connect REST (reset) via 10K pullup resistor to VCC, and via switch to GND ('reset switch')
     * - Connect GPIO15 via 10K pulldown resistor to GND
     * - Connect CH_PD via 10K resistor to VCC
     * - Connect GPIO2 via 10K resistor to VCC
     * - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch')
     *
      * Inclusion mode button:
     * - Connect GPIO5 via switch to GND ('inclusion switch')
     *
     * Hardware SHA204 signing is currently not supported!
     *
     * Make sure to fill in your ssid and WiFi password below for ssid & pass.
     */
    
    
    // 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
    
    // Enables and select radio type (if attached)
    #define MY_RADIO_RFM69
    #define MY_RFM69_FREQUENCY RF69_868MHZ
    #define MY_IS_RFM69HW
    
    #define MY_GATEWAY_ESP8266
    
    #define MY_ESP8266_SSID "xxx"
    #define MY_ESP8266_PASSWORD "xxx"
    
    // Set the hostname for the WiFi Client. This is the hostname
    // it will pass to the DHCP server if not static.
    #define MY_ESP8266_HOSTNAME "MySensor-Gateway-RFM69"
    
    // 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)
    #define MY_GATEWAY_MAX_CLIENTS 2
    
    // Controller ip address. Enables client mode (default is "server" mode).
    // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
    //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
    
    // Enable inclusion mode
    //#define MY_INCLUSION_MODE_FEATURE
    
    // Enable Inclusion mode button on gateway
    // #define MY_INCLUSION_BUTTON_FEATURE
    // Set inclusion mode duration (in seconds)
    //#define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    //#define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    // Flash leds on rx/tx/err
    // Led pins used if blinking feature is enabled above
    #define MY_DEFAULT_ERR_LED_PIN LED_BUILTIN  // Error led pin
    #define MY_DEFAULT_RX_LED_PIN  LED_BUILTIN  // Receive led pin
    #define MY_DEFAULT_TX_LED_PIN  LED_BUILTIN  // the PCB, on board LED
    
    #include <ESP8266WiFi.h>
    #include <MySensors.h>
    
    void setup()
    {
      #if defined MY_DEBUG
      if (WiFi.status() != WL_CONNECTED) {
        Serial.println("Not connected to WiFi");
      } else {
        Serial.println("");
        Serial.println("-- STA (client) informations --");
        Serial.print("Hostname: ");
        Serial.println(WiFi.hostname());
        Serial.print("Connected to: ");
        Serial.print(WiFi.SSID());
        Serial.print(" (");
        Serial.print(WiFi.BSSIDstr());
        Serial.print("), ");
        Serial.print(WiFi.RSSI());
        Serial.println("dBm");
        Serial.print("IP address: ");
        Serial.println(WiFi.localIP());
        Serial.print("Gateway address: ");
        Serial.println(WiFi.gatewayIP());
        Serial.print("Subnet mask: ");
        Serial.println(WiFi.subnetMask());
        Serial.print("MAC STA address: ");
        Serial.println(WiFi.macAddress());
        Serial.println("-- AP (server) informations --");
        Serial.print("Soft IP address: ");
        Serial.println(WiFi.softAPIP());
        Serial.print("MAC AP address: ");
        Serial.println(WiFi.softAPmacAddress());
        Serial.println("----");
        Serial.println("");
      }
    #endif
    }
    
    void presentation()
    {
      // Present locally attached sensors here
    }
    
    
    void loop()
    {
      // Send locally attached sensors data here
    }
    

    and for the node I use this test sketch:

    /**
     * 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-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/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.
     *
     *******************************
     *
     * REVISION HISTORY
     * Version 1.0 - Henrik EKblad
     *
     * DESCRIPTION
     * Example sketch showing how to measue light level using a LM393 photo-resistor
     * http://www.mysensors.org/build/light
     */
    
    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    #define MY_NODE_ID 050
    
    // Enable and select radio type attached
    //#define MY_RADIO_NRF24
    #define MY_RADIO_RFM69
    #define MY_RFM69_FREQUENCY RF69_868MHZ
    #define MY_IS_RFM69HW
    
    #include <MySensors.h>
    
    #define CHILD_ID_LIGHT 0
    #define LIGHT_SENSOR_ANALOG_PIN 0
    
    unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)
    
    MyMessage msg(CHILD_ID_LIGHT, V_LIGHT_LEVEL);
    int lastLightLevel;
    
    
    void presentation()
    {
    	// Send the sketch version information to the gateway and Controller
    	sendSketchInfo("Light Sensor", "1.0");
    
    	// Register all sensors to gateway (they will be created as child devices)
    	present(CHILD_ID_LIGHT, S_LIGHT_LEVEL);
    }
    
    void loop()
    {
    	int16_t lightLevel = (1023-analogRead(LIGHT_SENSOR_ANALOG_PIN))/10.23;
    	Serial.println(lightLevel);
    	if (lightLevel != lastLightLevel) {
    		send(msg.set(lightLevel));
    		lastLightLevel = lightLevel;
    	}
    	sleep(SLEEP_TIME);
    }
    
    
    


  • This is the output from the gateway:

    0;255;3;0;9;TSF:LRT:OK
    0;255;3;0;9;TSM:INIT
    0;255;3;0;9;TSF:WUR:MS=0
    scandone
    state: 0 -> 2 (b0)
    state: 2 -> 3 (0)
    state: 3 -> 5 (10)
    add 0
    aid 18
    cnt 
    
    connected with HasenpupsExtreme, channel 1
    dhcp client start...
    0;255;3;0;9;TSM:INIT:TSP OK
    0;255;3;0;9;TSM:INIT:GW MODE
    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
    0;255;3;0;9;MCO:REG:NOT NEEDED
    f r0, scandone
    ip:192.168.1.35,mask:255.255.255.0,gw:192.168.1.1
    .IP: 192.168.1.35
    0;255;3;0;9;MCO:BGN:STP
    
    -- STA (client) informations --
    Hostname: MySensor-Gateway-RFM69
    Connected to: HasenpupsExtreme (80:EA:96:F0:49:F2), -73dBm
    IP address: 192.168.1.35
    Gateway address: 192.168.1.1
    Subnet mask: 255.255.255.0
    MAC STA address: 5C:CF:7F:2C:11:3D
    -- AP (server) informations --
    Soft IP address: 0.0.0.0
    MAC AP address: 5E:CF:7F:2C:11:3D
    ----
    
    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
    pm open,type:2 0
    0;255;3;0;9;Client 0 connected
    0;255;3;0;9;Client 0: 0;0;3;0;2;
    

  • Admin

    @gloob How did you connect the radio to the wemos board?



  • I use this board:

    link text


  • Hardware Contributor

    One thing seems to be missing for your GW sketch.
    In the example sketch I provide I define some things that seems to be missing here:

    #define MY_RF69_IRQ_PIN D2  // GPIO 4
    #define MY_RF69_SPI_CS  D8  // GPIO 15
    

    Could you try with the included "MySWemosGatewayESP8266OTA.ino" sketch to see if this one is working?



  • I now get some kind of communication but it seems that the WeMos pro mini does reset when a controller is connected and a message is received from a node.

    I will check this tomorrow.


  • Hero Member

    @gloob reset of ethernet modules is usually a symptom of the problem in the Arduino AVR board definition in version 1.6.12 and newer. Please try version 1.6.11. (don't remember exactly what versions vere affected but 1.6.11 works for me).



  • @korttoma said:

    @gloob reset of ethernet modules is usually a symptom of the problem in the Arduino AVR board definition in version 1.6.12 and newer. Please try version 1.6.11. (don't remember exactly what versions vere affected but 1.6.11 works for me).

    Thanks for this hint but is this also neccessary for the WeMos modules (ESP8266)? My gateway with an NRF24L01 chip and the same WeMos is running without any problems.


  • Hardware Contributor

    @gloob I received my RFM69 radio modules yesterday and did a quick test.
    Same as for you, I'm unable to have a "MockSensor" talk to an esp8266 based gateway, both WeMos or NodeMCU.

    Never used RFM69 before so I'm not sure how to go from there, will do a few more tests on evenings and this week end, let me know if you got something on your side.



  • I can confirm that the adapter PCB is working without any problems together with a WeMos, because I use them to receive some signals of a weather station.


  • Hardware Contributor

    Good to know.
    I guess this is not a MySensors weather station, do you mind sharing the code you used, or project (I found a few on github).
    I will have a look in the code to see if there is something obvious somewhere.



  • It is called "LaCrosse Gateway"
    You can find the source code here: https://svn.fhem.de/trac/export/HEAD/trunk/fhem/contrib/arduino/36_LaCrosseGateway.zip

    I have included this gateway in FHEM and receive a weather station sensor from "Technoline" which is sending on 868MHz.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.