Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Hardware
  3. Mysensors and BSFrance Lora32u4 ii

Mysensors and BSFrance Lora32u4 ii

Scheduled Pinned Locked Moved Hardware
10 Posts 4 Posters 528 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CarloMagno
    wrote on last edited by
    #1

    I have recently bought 2 units of the board BSFrance Lora32u4 ii and I have been unable to get Mysensors library working with this boards.
    The boards seems to be a clone of Adafruit Feather 32u4 RFM95
    The board has a SX1276 radio module and the following pinout:
    0_1570905602169_LoRa32u4II_Pinout.jpg
    If I set a Serial Gateway (controller is Openhab in RPI3) with one of the boards and the other board as a node there is no message received in the gateway.
    The problem seems related to the reception (the transmission seems to work) because if i use as a gateway the board TTGO ESP32 Lora v2.0 I can see in the gateway logs some messages from the Lora32U4 node requesting to engage (Find Parent) and that the gateway replays but in the node the answer is never received.

    If I use RadioHead library with sender and receiver sketch with the 2 Lora32U4 boards, the transmission works perfectly in both directions (Transmission and Receptoin), so the hardware seems to be OK and I believe the problem may be with MySensors.

    Has anybody have any success with these boards and MySensors.

    Gateway Sketch:

    /* MySesors Gateway with Lora32U4 II v1.2 board
    * Enable debug prints to serial monitor
    * Gateway configuration in openhab connected to RPI 3B+ : /dev/ttyUSB0
    * disable check in start up
    *
    * v0: 
    */
    
    //Activate debug prints in MySensors library
    // Enable and select radio type attached
    #define   MY_RADIO_RFM95
    #define   MY_DEBUG
    #define   MY_DEBUG_VERBOSE_RFM95
    //#define   MY_DEBUG_VERBOSE_RFM95_REGISTERS
    //#define MY_RFM95_ATC_TARGET_RSSI (-70)  // target RSSI -70dBm
    //#define   MY_RFM95_MAX_POWER_LEVEL_DBM (20)   // max. TX power 10dBm = 10mW
    #define   MY_RFM95_FREQUENCY (RFM95_868MHZ)
    #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
    
    
    // Enables and select radio type (if attached)
    
    //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128     // Default, medium range
    //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW500CR45SF128   // Fast, short range
    //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW31_25CR48SF512 // Slow, long range
    //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR48SF4096  // Slow, long range
    
    // Definitions to improve RFM95 communication
    #define RFM95_RETRY_TIMEOUT_MS      (5000ul)      //!< Timeout for ACK, adjustments needed if modem configuration changed (air time different) in drivers/RFM95/RFM95.h (default: 500ul)
    #define MY_TRANSPORT_STATE_TIMEOUT_MS     (30*1000ul)   //!< 2 changed to RFM95W Ultra long Range enable general state timeout (in ms) in Mytransport.h (default: 2*1000ul)
    
    // For RFM95 connections in LoRA32U4 (Adafruit and BSFrance do not use the standard configuration)
    #define MY_RFM95_IRQ_PIN      7                
    #define MY_RFM95_IRQ_NUM      MY_RFM95_IRQ_PIN
    //#define MY_RF69_IRQ_NUM 4
    #define MY_RFM95_CS_PIN       8                
    #define MY_RFM95_RST_PIN      4                 
    
    //#define MY_SOFTSPI
    #define MY_SOFT_SPI_SCK_PIN   15                 
    #define MY_SOFT_SPI_MISO_PIN  14                
    #define MY_SOFT_SPI_MOSI_PIN  16                
    //#define MY_RFM95_POWER_PIN (3)                // What is this used for?
    
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    // Enable inclusion mode
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    #include <Wire.h>                 // I2C handling library
    
    // MySensors - Version: 2.3.2-Development (works with ESP32)
    #include <MyConfig.h>
    #include <MySensors.h>
    
    void setup()
    {
      static boolean state = HIGH;
      static unsigned char count = 0;
      // Set console baud rate to monitor
        Serial.begin(115200);
        while (!Serial && (count < 10) )
        {
          delay(100);     // Wait for serial port to connect with timeout. Needed for native USB
          //digitalWrite(LED_BUILTIN, state); LED Pin connected to SDA Pin. Do not use Builtin led in this device
          //state = !state;
          count++;
        }
    
      Wire.begin();         // Start I2C port in case used libraries do not open it
     
      delay(100);
    }
    
    void presentation()
    {
      // Present locally attached sensors here
    
      
    }
    
    
    void loop()
    {
    
    
    }
    

    Node Sketch:

    /*
    * MySesors Node LORA32U4II (adafruit feather equivalent)
    *
    * v0: 2 simulated child sensors attached to node
    *
    */
    
    //Activate debug prints in MySensors library
    // Enable and select radio type attached
    #define   MY_RADIO_RFM95
    #define   MY_DEBUG
    #define   MY_DEBUG_VERBOSE_RFM95
    //#define   MY_DEBUG_VERBOSE_RFM95_REGISTERS
    //#define MY_RFM95_ATC_TARGET_RSSI (-70)  // target RSSI -70dBm
    //#define   MY_RFM95_MAX_POWER_LEVEL_DBM (20)   // max. TX power 10dBm = 10mW
    #define   MY_RFM95_FREQUENCY (RFM95_868MHZ)
    #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
    
    
    // Enables and select radio type (if attached)
    
    //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128     // Default, medium range
    //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW500CR45SF128   // Fast, short range
    //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW31_25CR48SF512 // Slow, long range
    //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR48SF4096  // Slow, long range
    
    // Definitions to improve RFM95 communication
    #define RFM95_RETRY_TIMEOUT_MS      (5000ul)      //!< Timeout for ACK, adjustments needed if modem configuration changed (air time different) in drivers/RFM95/RFM95.h (default: 500ul)
    #define MY_TRANSPORT_STATE_TIMEOUT_MS     (30*1000ul)   //!< 2 changed to RFM95W Ultra long Range enable general state timeout (in ms) in Mytransport.h (default: 2*1000ul)
    
    
    // For RFM95 connections in LoRA32U4 (Adafruit and BSFrance do not use the standard configuration)
    #define MY_RFM95_IRQ_PIN      7                
    #define MY_RFM95_IRQ_NUM      MY_RFM95_IRQ_PIN
    //#define MY_RF69_IRQ_NUM 4
    #define MY_RFM95_CS_PIN       8                
    #define MY_RFM95_RST_PIN      4                 
    
    //#define MY_SOFTSPI
    #define MY_SOFT_SPI_SCK_PIN   15                 
    #define MY_SOFT_SPI_MISO_PIN  14                
    #define MY_SOFT_SPI_MOSI_PIN  16                
    //#define MY_RFM95_POWER_PIN (3)                // What is this used for?
    
    
    // Define a static node address, remove if you want auto address assignment 
    #define MY_NODE_ID   10 
    // Sensor Child ID of the NODE
    #define CHILD_ID_BA_Volt_Bateria         0  // Voltaje de Batería
    #define CHILD_ID_BA_Volt_Med_Bateria     1  // Voltaje del punto medio de la Batería
    
    // MySensors - Version: 2.3.2-Development (works with ESP32)
    #include <MyConfig.h>
    #include <MySensors.h>
    
    unsigned long lastmillis;
    float BA_Volt_Bateria;
    float BA_Volt_Bateria_last=0.0;
    float BA_Volt_Med_Bateria;
    float BA_Volt_Med_Bateria_last=0.0;
    
    boolean metric = true;          // Gateway uses metric system
    
    // MySensors message definition
    MyMessage msg_BA_Volt_Bateria(CHILD_ID_BA_Volt_Bateria, V_VOLTAGE);
    MyMessage msg_BA_Volt_Med_Bateria(CHILD_ID_BA_Volt_Med_Bateria, V_VOLTAGE);
    
    void setup()
    {
      static boolean state = HIGH;
      static unsigned char count = 0;
      // Set console baud rate to monitor
      Serial.begin(115200);
      while (!Serial && (count < 30) ) {
          delay(200);     // Wait for serial port to connect with timeout. Needed for native USB
          //digitalWrite(LED_BUILTIN, state);
          state = !state;
          count++;
      }
      Serial.println("Setup Complete");
      delay(100);
    }
    
    void presentation()
    {
      // Send the sketch version information to the gateway and Controller
      //sendSketchInfo("LORA32U4II & Node 10", "1.0");
    
      // Register attached sensors
      present(CHILD_ID_BA_Volt_Bateria, S_MULTIMETER);  
      present(CHILD_ID_BA_Volt_Med_Bateria, S_MULTIMETER);    
    }
    
    void loop() {
      // Get current readings for The defined interval POWER_MEASURE_INTERVAL
      float counter=1.2;
      if (millis()-lastmillis >= 10000) {
        // send message
        counter=counter*1.2;
        BA_Volt_Bateria = counter;
        Serial.print("Sending value BA_Volt_Bateria: "); Serial.println(BA_Volt_Bateria);
        
        BA_Volt_Med_Bateria = counter * 0.5;
        Serial.print("Sending value BA_Volt_Med_Bateria: "); Serial.println(BA_Volt_Med_Bateria);
        send(msg_BA_Volt_Bateria.set(BA_Volt_Bateria,2));
        send(msg_BA_Volt_Med_Bateria.set(BA_Volt_Med_Bateria,2));        
        lastmillis = millis();
      }
    }
    

    I have used the development version of MySensors because I have TTGO boards with ESP32 processors and those are only supported by the development version, but I have also tried the latest stable version with the same results.

    I have also increased the timeouts for the ACK as suggested in the following post, although is quite old:
    https://forum.mysensors.org/topic/8813/any-success-story-on-lora-rfm95-module-and-mysensors/9
    I have included the configuration in the sketches instead of the library files as can be seen in the sketches. Is this right? or should I do that in the library files?:Mytransport.h and drivers/RFM95/RFM95.h.

    mfalkviddM YveauxY 2 Replies Last reply
    0
    • C CarloMagno

      I have recently bought 2 units of the board BSFrance Lora32u4 ii and I have been unable to get Mysensors library working with this boards.
      The boards seems to be a clone of Adafruit Feather 32u4 RFM95
      The board has a SX1276 radio module and the following pinout:
      0_1570905602169_LoRa32u4II_Pinout.jpg
      If I set a Serial Gateway (controller is Openhab in RPI3) with one of the boards and the other board as a node there is no message received in the gateway.
      The problem seems related to the reception (the transmission seems to work) because if i use as a gateway the board TTGO ESP32 Lora v2.0 I can see in the gateway logs some messages from the Lora32U4 node requesting to engage (Find Parent) and that the gateway replays but in the node the answer is never received.

      If I use RadioHead library with sender and receiver sketch with the 2 Lora32U4 boards, the transmission works perfectly in both directions (Transmission and Receptoin), so the hardware seems to be OK and I believe the problem may be with MySensors.

      Has anybody have any success with these boards and MySensors.

      Gateway Sketch:

      /* MySesors Gateway with Lora32U4 II v1.2 board
      * Enable debug prints to serial monitor
      * Gateway configuration in openhab connected to RPI 3B+ : /dev/ttyUSB0
      * disable check in start up
      *
      * v0: 
      */
      
      //Activate debug prints in MySensors library
      // Enable and select radio type attached
      #define   MY_RADIO_RFM95
      #define   MY_DEBUG
      #define   MY_DEBUG_VERBOSE_RFM95
      //#define   MY_DEBUG_VERBOSE_RFM95_REGISTERS
      //#define MY_RFM95_ATC_TARGET_RSSI (-70)  // target RSSI -70dBm
      //#define   MY_RFM95_MAX_POWER_LEVEL_DBM (20)   // max. TX power 10dBm = 10mW
      #define   MY_RFM95_FREQUENCY (RFM95_868MHZ)
      #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
      
      
      // Enables and select radio type (if attached)
      
      //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128     // Default, medium range
      //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW500CR45SF128   // Fast, short range
      //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW31_25CR48SF512 // Slow, long range
      //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR48SF4096  // Slow, long range
      
      // Definitions to improve RFM95 communication
      #define RFM95_RETRY_TIMEOUT_MS      (5000ul)      //!< Timeout for ACK, adjustments needed if modem configuration changed (air time different) in drivers/RFM95/RFM95.h (default: 500ul)
      #define MY_TRANSPORT_STATE_TIMEOUT_MS     (30*1000ul)   //!< 2 changed to RFM95W Ultra long Range enable general state timeout (in ms) in Mytransport.h (default: 2*1000ul)
      
      // For RFM95 connections in LoRA32U4 (Adafruit and BSFrance do not use the standard configuration)
      #define MY_RFM95_IRQ_PIN      7                
      #define MY_RFM95_IRQ_NUM      MY_RFM95_IRQ_PIN
      //#define MY_RF69_IRQ_NUM 4
      #define MY_RFM95_CS_PIN       8                
      #define MY_RFM95_RST_PIN      4                 
      
      //#define MY_SOFTSPI
      #define MY_SOFT_SPI_SCK_PIN   15                 
      #define MY_SOFT_SPI_MISO_PIN  14                
      #define MY_SOFT_SPI_MOSI_PIN  16                
      //#define MY_RFM95_POWER_PIN (3)                // What is this used for?
      
      // Enable serial gateway
      #define MY_GATEWAY_SERIAL
      // Enable inclusion mode
      // Set blinking period
      #define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      #include <Wire.h>                 // I2C handling library
      
      // MySensors - Version: 2.3.2-Development (works with ESP32)
      #include <MyConfig.h>
      #include <MySensors.h>
      
      void setup()
      {
        static boolean state = HIGH;
        static unsigned char count = 0;
        // Set console baud rate to monitor
          Serial.begin(115200);
          while (!Serial && (count < 10) )
          {
            delay(100);     // Wait for serial port to connect with timeout. Needed for native USB
            //digitalWrite(LED_BUILTIN, state); LED Pin connected to SDA Pin. Do not use Builtin led in this device
            //state = !state;
            count++;
          }
      
        Wire.begin();         // Start I2C port in case used libraries do not open it
       
        delay(100);
      }
      
      void presentation()
      {
        // Present locally attached sensors here
      
        
      }
      
      
      void loop()
      {
      
      
      }
      

      Node Sketch:

      /*
      * MySesors Node LORA32U4II (adafruit feather equivalent)
      *
      * v0: 2 simulated child sensors attached to node
      *
      */
      
      //Activate debug prints in MySensors library
      // Enable and select radio type attached
      #define   MY_RADIO_RFM95
      #define   MY_DEBUG
      #define   MY_DEBUG_VERBOSE_RFM95
      //#define   MY_DEBUG_VERBOSE_RFM95_REGISTERS
      //#define MY_RFM95_ATC_TARGET_RSSI (-70)  // target RSSI -70dBm
      //#define   MY_RFM95_MAX_POWER_LEVEL_DBM (20)   // max. TX power 10dBm = 10mW
      #define   MY_RFM95_FREQUENCY (RFM95_868MHZ)
      #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
      
      
      // Enables and select radio type (if attached)
      
      //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128     // Default, medium range
      //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW500CR45SF128   // Fast, short range
      //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW31_25CR48SF512 // Slow, long range
      //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR48SF4096  // Slow, long range
      
      // Definitions to improve RFM95 communication
      #define RFM95_RETRY_TIMEOUT_MS      (5000ul)      //!< Timeout for ACK, adjustments needed if modem configuration changed (air time different) in drivers/RFM95/RFM95.h (default: 500ul)
      #define MY_TRANSPORT_STATE_TIMEOUT_MS     (30*1000ul)   //!< 2 changed to RFM95W Ultra long Range enable general state timeout (in ms) in Mytransport.h (default: 2*1000ul)
      
      
      // For RFM95 connections in LoRA32U4 (Adafruit and BSFrance do not use the standard configuration)
      #define MY_RFM95_IRQ_PIN      7                
      #define MY_RFM95_IRQ_NUM      MY_RFM95_IRQ_PIN
      //#define MY_RF69_IRQ_NUM 4
      #define MY_RFM95_CS_PIN       8                
      #define MY_RFM95_RST_PIN      4                 
      
      //#define MY_SOFTSPI
      #define MY_SOFT_SPI_SCK_PIN   15                 
      #define MY_SOFT_SPI_MISO_PIN  14                
      #define MY_SOFT_SPI_MOSI_PIN  16                
      //#define MY_RFM95_POWER_PIN (3)                // What is this used for?
      
      
      // Define a static node address, remove if you want auto address assignment 
      #define MY_NODE_ID   10 
      // Sensor Child ID of the NODE
      #define CHILD_ID_BA_Volt_Bateria         0  // Voltaje de Batería
      #define CHILD_ID_BA_Volt_Med_Bateria     1  // Voltaje del punto medio de la Batería
      
      // MySensors - Version: 2.3.2-Development (works with ESP32)
      #include <MyConfig.h>
      #include <MySensors.h>
      
      unsigned long lastmillis;
      float BA_Volt_Bateria;
      float BA_Volt_Bateria_last=0.0;
      float BA_Volt_Med_Bateria;
      float BA_Volt_Med_Bateria_last=0.0;
      
      boolean metric = true;          // Gateway uses metric system
      
      // MySensors message definition
      MyMessage msg_BA_Volt_Bateria(CHILD_ID_BA_Volt_Bateria, V_VOLTAGE);
      MyMessage msg_BA_Volt_Med_Bateria(CHILD_ID_BA_Volt_Med_Bateria, V_VOLTAGE);
      
      void setup()
      {
        static boolean state = HIGH;
        static unsigned char count = 0;
        // Set console baud rate to monitor
        Serial.begin(115200);
        while (!Serial && (count < 30) ) {
            delay(200);     // Wait for serial port to connect with timeout. Needed for native USB
            //digitalWrite(LED_BUILTIN, state);
            state = !state;
            count++;
        }
        Serial.println("Setup Complete");
        delay(100);
      }
      
      void presentation()
      {
        // Send the sketch version information to the gateway and Controller
        //sendSketchInfo("LORA32U4II & Node 10", "1.0");
      
        // Register attached sensors
        present(CHILD_ID_BA_Volt_Bateria, S_MULTIMETER);  
        present(CHILD_ID_BA_Volt_Med_Bateria, S_MULTIMETER);    
      }
      
      void loop() {
        // Get current readings for The defined interval POWER_MEASURE_INTERVAL
        float counter=1.2;
        if (millis()-lastmillis >= 10000) {
          // send message
          counter=counter*1.2;
          BA_Volt_Bateria = counter;
          Serial.print("Sending value BA_Volt_Bateria: "); Serial.println(BA_Volt_Bateria);
          
          BA_Volt_Med_Bateria = counter * 0.5;
          Serial.print("Sending value BA_Volt_Med_Bateria: "); Serial.println(BA_Volt_Med_Bateria);
          send(msg_BA_Volt_Bateria.set(BA_Volt_Bateria,2));
          send(msg_BA_Volt_Med_Bateria.set(BA_Volt_Med_Bateria,2));        
          lastmillis = millis();
        }
      }
      

      I have used the development version of MySensors because I have TTGO boards with ESP32 processors and those are only supported by the development version, but I have also tried the latest stable version with the same results.

      I have also increased the timeouts for the ACK as suggested in the following post, although is quite old:
      https://forum.mysensors.org/topic/8813/any-success-story-on-lora-rfm95-module-and-mysensors/9
      I have included the configuration in the sketches instead of the library files as can be seen in the sketches. Is this right? or should I do that in the library files?:Mytransport.h and drivers/RFM95/RFM95.h.

      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #2

      Welcome to the forum @CarloMagno
      Yes, the configuration should be in the sketches. Otherwise, the configuration would be overwritten for each upgrade of MySensors, and you would not be able to have different configuration for different sketches.

      I don't think the timeout should be an issue, since you are using one of the faster LoRa modes.

      I have never seen include <MyConfig.h> in a sketch before. Not sure if it has a negative impact.

      Looking at debug logs from the node and the gateway is likely the best way forward.

      C 1 Reply Last reply
      0
      • C CarloMagno

        I have recently bought 2 units of the board BSFrance Lora32u4 ii and I have been unable to get Mysensors library working with this boards.
        The boards seems to be a clone of Adafruit Feather 32u4 RFM95
        The board has a SX1276 radio module and the following pinout:
        0_1570905602169_LoRa32u4II_Pinout.jpg
        If I set a Serial Gateway (controller is Openhab in RPI3) with one of the boards and the other board as a node there is no message received in the gateway.
        The problem seems related to the reception (the transmission seems to work) because if i use as a gateway the board TTGO ESP32 Lora v2.0 I can see in the gateway logs some messages from the Lora32U4 node requesting to engage (Find Parent) and that the gateway replays but in the node the answer is never received.

        If I use RadioHead library with sender and receiver sketch with the 2 Lora32U4 boards, the transmission works perfectly in both directions (Transmission and Receptoin), so the hardware seems to be OK and I believe the problem may be with MySensors.

        Has anybody have any success with these boards and MySensors.

        Gateway Sketch:

        /* MySesors Gateway with Lora32U4 II v1.2 board
        * Enable debug prints to serial monitor
        * Gateway configuration in openhab connected to RPI 3B+ : /dev/ttyUSB0
        * disable check in start up
        *
        * v0: 
        */
        
        //Activate debug prints in MySensors library
        // Enable and select radio type attached
        #define   MY_RADIO_RFM95
        #define   MY_DEBUG
        #define   MY_DEBUG_VERBOSE_RFM95
        //#define   MY_DEBUG_VERBOSE_RFM95_REGISTERS
        //#define MY_RFM95_ATC_TARGET_RSSI (-70)  // target RSSI -70dBm
        //#define   MY_RFM95_MAX_POWER_LEVEL_DBM (20)   // max. TX power 10dBm = 10mW
        #define   MY_RFM95_FREQUENCY (RFM95_868MHZ)
        #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
        
        
        // Enables and select radio type (if attached)
        
        //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128     // Default, medium range
        //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW500CR45SF128   // Fast, short range
        //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW31_25CR48SF512 // Slow, long range
        //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR48SF4096  // Slow, long range
        
        // Definitions to improve RFM95 communication
        #define RFM95_RETRY_TIMEOUT_MS      (5000ul)      //!< Timeout for ACK, adjustments needed if modem configuration changed (air time different) in drivers/RFM95/RFM95.h (default: 500ul)
        #define MY_TRANSPORT_STATE_TIMEOUT_MS     (30*1000ul)   //!< 2 changed to RFM95W Ultra long Range enable general state timeout (in ms) in Mytransport.h (default: 2*1000ul)
        
        // For RFM95 connections in LoRA32U4 (Adafruit and BSFrance do not use the standard configuration)
        #define MY_RFM95_IRQ_PIN      7                
        #define MY_RFM95_IRQ_NUM      MY_RFM95_IRQ_PIN
        //#define MY_RF69_IRQ_NUM 4
        #define MY_RFM95_CS_PIN       8                
        #define MY_RFM95_RST_PIN      4                 
        
        //#define MY_SOFTSPI
        #define MY_SOFT_SPI_SCK_PIN   15                 
        #define MY_SOFT_SPI_MISO_PIN  14                
        #define MY_SOFT_SPI_MOSI_PIN  16                
        //#define MY_RFM95_POWER_PIN (3)                // What is this used for?
        
        // Enable serial gateway
        #define MY_GATEWAY_SERIAL
        // Enable inclusion mode
        // Set blinking period
        #define MY_DEFAULT_LED_BLINK_PERIOD 300
        
        #include <Wire.h>                 // I2C handling library
        
        // MySensors - Version: 2.3.2-Development (works with ESP32)
        #include <MyConfig.h>
        #include <MySensors.h>
        
        void setup()
        {
          static boolean state = HIGH;
          static unsigned char count = 0;
          // Set console baud rate to monitor
            Serial.begin(115200);
            while (!Serial && (count < 10) )
            {
              delay(100);     // Wait for serial port to connect with timeout. Needed for native USB
              //digitalWrite(LED_BUILTIN, state); LED Pin connected to SDA Pin. Do not use Builtin led in this device
              //state = !state;
              count++;
            }
        
          Wire.begin();         // Start I2C port in case used libraries do not open it
         
          delay(100);
        }
        
        void presentation()
        {
          // Present locally attached sensors here
        
          
        }
        
        
        void loop()
        {
        
        
        }
        

        Node Sketch:

        /*
        * MySesors Node LORA32U4II (adafruit feather equivalent)
        *
        * v0: 2 simulated child sensors attached to node
        *
        */
        
        //Activate debug prints in MySensors library
        // Enable and select radio type attached
        #define   MY_RADIO_RFM95
        #define   MY_DEBUG
        #define   MY_DEBUG_VERBOSE_RFM95
        //#define   MY_DEBUG_VERBOSE_RFM95_REGISTERS
        //#define MY_RFM95_ATC_TARGET_RSSI (-70)  // target RSSI -70dBm
        //#define   MY_RFM95_MAX_POWER_LEVEL_DBM (20)   // max. TX power 10dBm = 10mW
        #define   MY_RFM95_FREQUENCY (RFM95_868MHZ)
        #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
        
        
        // Enables and select radio type (if attached)
        
        //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128     // Default, medium range
        //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW500CR45SF128   // Fast, short range
        //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW31_25CR48SF512 // Slow, long range
        //#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR48SF4096  // Slow, long range
        
        // Definitions to improve RFM95 communication
        #define RFM95_RETRY_TIMEOUT_MS      (5000ul)      //!< Timeout for ACK, adjustments needed if modem configuration changed (air time different) in drivers/RFM95/RFM95.h (default: 500ul)
        #define MY_TRANSPORT_STATE_TIMEOUT_MS     (30*1000ul)   //!< 2 changed to RFM95W Ultra long Range enable general state timeout (in ms) in Mytransport.h (default: 2*1000ul)
        
        
        // For RFM95 connections in LoRA32U4 (Adafruit and BSFrance do not use the standard configuration)
        #define MY_RFM95_IRQ_PIN      7                
        #define MY_RFM95_IRQ_NUM      MY_RFM95_IRQ_PIN
        //#define MY_RF69_IRQ_NUM 4
        #define MY_RFM95_CS_PIN       8                
        #define MY_RFM95_RST_PIN      4                 
        
        //#define MY_SOFTSPI
        #define MY_SOFT_SPI_SCK_PIN   15                 
        #define MY_SOFT_SPI_MISO_PIN  14                
        #define MY_SOFT_SPI_MOSI_PIN  16                
        //#define MY_RFM95_POWER_PIN (3)                // What is this used for?
        
        
        // Define a static node address, remove if you want auto address assignment 
        #define MY_NODE_ID   10 
        // Sensor Child ID of the NODE
        #define CHILD_ID_BA_Volt_Bateria         0  // Voltaje de Batería
        #define CHILD_ID_BA_Volt_Med_Bateria     1  // Voltaje del punto medio de la Batería
        
        // MySensors - Version: 2.3.2-Development (works with ESP32)
        #include <MyConfig.h>
        #include <MySensors.h>
        
        unsigned long lastmillis;
        float BA_Volt_Bateria;
        float BA_Volt_Bateria_last=0.0;
        float BA_Volt_Med_Bateria;
        float BA_Volt_Med_Bateria_last=0.0;
        
        boolean metric = true;          // Gateway uses metric system
        
        // MySensors message definition
        MyMessage msg_BA_Volt_Bateria(CHILD_ID_BA_Volt_Bateria, V_VOLTAGE);
        MyMessage msg_BA_Volt_Med_Bateria(CHILD_ID_BA_Volt_Med_Bateria, V_VOLTAGE);
        
        void setup()
        {
          static boolean state = HIGH;
          static unsigned char count = 0;
          // Set console baud rate to monitor
          Serial.begin(115200);
          while (!Serial && (count < 30) ) {
              delay(200);     // Wait for serial port to connect with timeout. Needed for native USB
              //digitalWrite(LED_BUILTIN, state);
              state = !state;
              count++;
          }
          Serial.println("Setup Complete");
          delay(100);
        }
        
        void presentation()
        {
          // Send the sketch version information to the gateway and Controller
          //sendSketchInfo("LORA32U4II & Node 10", "1.0");
        
          // Register attached sensors
          present(CHILD_ID_BA_Volt_Bateria, S_MULTIMETER);  
          present(CHILD_ID_BA_Volt_Med_Bateria, S_MULTIMETER);    
        }
        
        void loop() {
          // Get current readings for The defined interval POWER_MEASURE_INTERVAL
          float counter=1.2;
          if (millis()-lastmillis >= 10000) {
            // send message
            counter=counter*1.2;
            BA_Volt_Bateria = counter;
            Serial.print("Sending value BA_Volt_Bateria: "); Serial.println(BA_Volt_Bateria);
            
            BA_Volt_Med_Bateria = counter * 0.5;
            Serial.print("Sending value BA_Volt_Med_Bateria: "); Serial.println(BA_Volt_Med_Bateria);
            send(msg_BA_Volt_Bateria.set(BA_Volt_Bateria,2));
            send(msg_BA_Volt_Med_Bateria.set(BA_Volt_Med_Bateria,2));        
            lastmillis = millis();
          }
        }
        

        I have used the development version of MySensors because I have TTGO boards with ESP32 processors and those are only supported by the development version, but I have also tried the latest stable version with the same results.

        I have also increased the timeouts for the ACK as suggested in the following post, although is quite old:
        https://forum.mysensors.org/topic/8813/any-success-story-on-lora-rfm95-module-and-mysensors/9
        I have included the configuration in the sketches instead of the library files as can be seen in the sketches. Is this right? or should I do that in the library files?:Mytransport.h and drivers/RFM95/RFM95.h.

        YveauxY Offline
        YveauxY Offline
        Yveaux
        Mod
        wrote on last edited by
        #3

        @carlomagno said in Mysensors and BSFrance Lora32u4 ii:

        Not sure if it is relevant in your case, but there seem to be quite some revisions around of your board, according to this: https://www.thethingsnetwork.org/forum/t/big-lora32u4-boards-topic/15273

        http://yveaux.blogspot.nl

        C 1 Reply Last reply
        0
        • mfalkviddM mfalkvidd

          Welcome to the forum @CarloMagno
          Yes, the configuration should be in the sketches. Otherwise, the configuration would be overwritten for each upgrade of MySensors, and you would not be able to have different configuration for different sketches.

          I don't think the timeout should be an issue, since you are using one of the faster LoRa modes.

          I have never seen include <MyConfig.h> in a sketch before. Not sure if it has a negative impact.

          Looking at debug logs from the node and the gateway is likely the best way forward.

          C Offline
          C Offline
          CarloMagno
          wrote on last edited by CarloMagno
          #4

          @mfalkvidd Thank you for the support.
          You are right, I forgot to post the logs, and without the logs I can imagine it is impossible to guess what is happening.
          Find attached the logs from the Node (Node 10 in this case) taken from the serial output connected to a computer, and the logs from the Gateway taken from the Controller (Openhab) web log viewer to which the gateway is attached through the serial port (Serial gateway):

          Node 10 log:

          15:04:10.595 -> 7026 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:04:12.610 -> 9027 !TSM:FPAR:NO REPLY
          15:04:12.610 -> 9027 TSM:FPAR
          15:04:19.600 -> 16029 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:04:21.596 -> 18032 !TSM:FPAR:NO REPLY
          15:04:21.596 -> 18032 TSM:FPAR
          15:04:28.569 -> 25034 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:04:30.573 -> 27037 !TSM:FPAR:NO REPLY
          15:04:30.573 -> 27037 TSM:FPAR
          15:04:37.566 -> 34039 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:04:39.577 -> 36042 !TSM:FPAR:FAIL
          15:04:39.577 -> 36042 TSM:FAIL:CNT=1
          15:04:39.577 -> 36042 TSM:FAIL:DIS
          15:04:39.577 -> 36044 TSF:TDI:TSL
          15:04:49.559 -> 46045 TSM:FAIL:RE-INIT
          15:04:49.606 -> 46045 TSM:INIT
          15:04:49.606 -> 46061 TSM:INIT:TSP OK
          15:04:49.606 -> 46061 TSM:INIT:STATID=10
          15:04:49.606 -> 46063 TSF:SID:OK,ID=10
          15:04:49.606 -> 46063 TSM:FPAR
          15:04:59.001 -> 53065 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:04:59.001 -> 55068 !TSM:FPAR:NO REPLY
          15:04:59.001 -> 55068 TSM:FPAR
          15:05:05.576 -> 62070 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:05:07.591 -> 64073 !TSM:FPAR:NO REPLY
          15:05:07.591 -> 64073 TSM:FPAR
          15:05:14.578 -> 71075 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:05:16.610 -> 73078 !TSM:FPAR:NO REPLY
          15:05:16.610 -> 73078 TSM:FPAR
          15:05:23.594 -> 80080 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:05:25.614 -> 82083 !TSM:FPAR:FAIL
          15:05:25.614 -> 82083 TSM:FAIL:CNT=2
          15:05:25.614 -> 82083 TSM:FAIL:DIS
          15:05:25.614 -> 82085 TSF:TDI:TSL
          15:05:35.568 -> 92086 TSM:FAIL:RE-INIT
          15:05:35.568 -> 92086 TSM:INIT
          15:05:35.615 -> 92102 TSM:INIT:TSP OK
          15:05:35.615 -> 92102 TSM:INIT:STATID=10
          15:05:35.615 -> 92104 TSF:SID:OK,ID=10
          15:05:35.615 -> 92104 TSM:FPAR
          15:05:42.619 -> 99106 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:05:44.626 -> 101109 !TSM:FPAR:NO REPLY
          15:05:44.626 -> 101109 TSM:FPAR
          15:05:51.590 -> 108111 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:05:53.582 -> 110114 !TSM:FPAR:NO REPLY
          15:05:53.582 -> 110114 TSM:FPAR
          15:06:00.582 -> 117116 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:06:02.609 -> 119119 !TSM:FPAR:NO REPLY
          15:06:02.609 -> 119119 TSM:FPAR
          15:06:09.589 -> 126121 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:06:11.592 -> 128126 !TSM:FPAR:FAIL
          15:06:11.592 -> 128126 TSM:FAIL:CNT=3
          15:06:11.592 -> 128126 TSM:FAIL:DIS
          15:06:11.592 -> 128129 TSF:TDI:TSL
          15:06:21.571 -> 138131 TSM:FAIL:RE-INIT
          15:06:21.607 -> 138131 TSM:INIT
          15:06:21.607 -> 138147 TSM:INIT:TSP OK
          15:06:21.607 -> 138147 TSM:INIT:STATID=10
          15:06:21.607 -> 138149 TSF:SID:OK,ID=10
          15:06:21.607 -> 138149 TSM:FPAR
          15:06:28.620 -> 145152 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:06:30.594 -> 147156 !TSM:FPAR:NO REPLY
          15:06:30.594 -> 147156 TSM:FPAR
          15:06:37.610 -> 154157 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:06:39.606 -> 156160 !TSM:FPAR:NO REPLY
          15:06:39.606 -> 156160 TSM:FPAR
          15:06:46.607 -> 163160 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:06:48.582 -> 165163 !TSM:FPAR:NO REPLY
          15:06:48.582 -> 165163 TSM:FPAR
          15:06:55.595 -> 172163 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:06:57.580 -> 174166 !TSM:FPAR:FAIL
          15:06:57.580 -> 174166 TSM:FAIL:CNT=4
          15:06:57.580 -> 174166 TSM:FAIL:DIS
          15:06:57.580 -> 174168 TSF:TDI:TSL
          15:07:07.588 -> 184170 TSM:FAIL:RE-INIT
          15:07:07.588 -> 184170 TSM:INIT
          15:07:07.635 -> 184186 TSM:INIT:TSP OK
          15:07:07.635 -> 184186 TSM:INIT:STATID=10
          15:07:07.635 -> 184188 TSF:SID:OK,ID=10
          15:07:07.635 -> 184188 TSM:FPAR
          15:07:14.597 -> 191191 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:07:16.606 -> 193196 !TSM:FPAR:NO REPLY
          15:07:16.606 -> 193196 TSM:FPAR
          15:07:23.598 -> 200196 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:07:25.625 -> 202199 !TSM:FPAR:NO REPLY
          15:07:25.625 -> 202199 TSM:FPAR
          15:07:32.584 -> 209199 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:07:34.604 -> 211202 !TSM:FPAR:NO REPLY
          15:07:34.604 -> 211202 TSM:FPAR
          15:07:41.599 -> 218202 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:07:43.611 -> 220205 !TSM:FPAR:FAIL
          15:07:43.611 -> 220205 TSM:FAIL:CNT=5
          15:07:43.611 -> 220205 TSM:FAIL:DIS
          15:07:43.611 -> 220207 TSF:TDI:TSL
          15:07:53.620 -> 230209 TSM:FAIL:RE-INIT
          15:07:53.620 -> 230209 TSM:INIT
          15:07:53.620 -> 230225 TSM:INIT:TSP OK
          15:07:53.620 -> 230225 TSM:INIT:STATID=10
          15:07:53.620 -> 230227 TSF:SID:OK,ID=10
          15:07:53.620 -> 230227 TSM:FPAR
          15:08:00.605 -> 237230 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:08:02.590 -> 239233 !TSM:FPAR:NO REPLY
          15:08:02.637 -> 239233 TSM:FPAR
          15:08:09.599 -> 246233 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:08:11.591 -> 248236 !TSM:FPAR:NO REPLY
          15:08:11.591 -> 248236 TSM:FPAR
          15:08:18.613 -> 255236 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:08:20.594 -> 257239 !TSM:FPAR:NO REPLY
          15:08:20.594 -> 257239 TSM:FPAR
          15:08:27.584 -> 264239 TSF:MSG:SEND,10-10-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
          15:08:29.623 -> 266242 !TSM:FPAR:FAIL
          15:08:29.623 -> 266242 TSM:FAIL:CNT=6
          15:08:29.623 -> 266242 TSM:FAIL:DIS
          15:08:29.623 -> 266244 TSF:TDI:TSL
          

          And the Gateway Log (serial messages received in Openhab):

          2019-09-11 15:01:34.805 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2400215 TSM:READY:NWD REQ
          2019-09-11 15:01:34.869 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2400266 TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
          2019-09-11 15:04:05.668 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2551047 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          2019-09-11 15:04:05.671 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2551053 TSF:MSG:BC
          2019-09-11 15:04:05.673 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2551058 TSF:MSG:FPAR REQ,ID=10
          2019-09-11 15:04:05.676 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2551064 TSF:PNG:SEND,TO=0
          2019-09-11 15:04:05.678 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2551070 TSF:CKU:OK
          2019-09-11 15:04:05.681 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2551075 TSF:MSG:GWL OK
          2019-09-11 15:04:09.578 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2554976 !TSF:MSG:SEND,0-0-10-10,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
          2019-09-11 15:04:14.652 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2560042 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          2019-09-11 15:04:14.658 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2560049 TSF:MSG:BC
          2019-09-11 15:04:14.661 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2560054 TSF:MSG:FPAR REQ,ID=10
          2019-09-11 15:04:14.668 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2560060 TSF:CKU:OK,FCTRL
          2019-09-11 15:04:14.677 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2560065 TSF:MSG:GWL OK
          2019-09-11 15:04:18.292 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2563672 !TSF:MSG:SEND,0-0-10-10,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
          2019-09-11 15:04:23.658 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2569040 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          2019-09-11 15:04:23.662 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2569046 TSF:MSG:BC
          2019-09-11 15:04:23.666 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2569051 TSF:MSG:FPAR REQ,ID=10
          2019-09-11 15:04:23.670 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2569057 TSF:CKU:OK,FCTRL
          2019-09-11 15:04:23.673 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2569063 TSF:MSG:GWL OK
          2019-09-11 15:04:28.133 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2573528 !TSF:MSG:SEND,0-0-10-10,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
          2019-09-11 15:04:32.646 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2578038 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          2019-09-11 15:04:32.651 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2578044 TSF:MSG:BC
          2019-09-11 15:04:32.654 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2578049 TSF:MSG:FPAR REQ,ID=10
          2019-09-11 15:04:32.659 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2578055 TSF:CKU:OK,FCTRL
          2019-09-11 15:04:32.665 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2578060 TSF:MSG:GWL OK
          2019-09-11 15:04:36.990 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2582384 !TSF:MSG:SEND,0-0-10-10,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
          2019-09-11 15:04:51.662 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2597048 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          2019-09-11 15:04:51.668 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2597054 TSF:MSG:BC
          2019-09-11 15:04:51.671 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2597059 TSF:MSG:FPAR REQ,ID=10
          2019-09-11 15:04:51.676 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2597065 TSF:PNG:SEND,TO=0
          2019-09-11 15:04:51.680 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2597071 TSF:CKU:OK
          2019-09-11 15:04:51.687 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2597076 TSF:MSG:GWL OK
          2019-09-11 15:04:55.485 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2600884 !TSF:MSG:SEND,0-0-10-10,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
          2019-09-11 15:05:00.659 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2606046 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          2019-09-11 15:05:00.665 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2606052 TSF:MSG:BC
          2019-09-11 15:05:00.671 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2606057 TSF:MSG:FPAR REQ,ID=10
          2019-09-11 15:05:00.675 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2606063 TSF:CKU:OK,FCTRL
          2019-09-11 15:05:00.679 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2606068 TSF:MSG:GWL OK
          2019-09-11 15:05:05.170 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2610572 !TSF:MSG:SEND,0-0-10-10,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
          2019-09-11 15:05:09.646 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2615043 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          2019-09-11 15:05:09.652 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2615049 TSF:MSG:BC
          2019-09-11 15:05:09.656 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2615054 TSF:MSG:FPAR REQ,ID=10
          2019-09-11 15:05:09.665 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2615060 TSF:CKU:OK,FCTRL
          2019-09-11 15:05:09.668 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2615066 TSF:MSG:GWL OK
          2019-09-11 15:05:14.090 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2619492 !TSF:MSG:SEND,0-0-10-10,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
          2019-09-11 15:05:18.651 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2624041 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          2019-09-11 15:05:18.654 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2624047 TSF:MSG:BC
          2019-09-11 15:05:18.658 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2624052 TSF:MSG:FPAR REQ,ID=10
          2019-09-11 15:05:18.662 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2624058 TSF:CKU:OK,FCTRL
          2019-09-11 15:05:18.670 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2624063 TSF:MSG:GWL OK
          2019-09-11 15:05:22.844 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2628248 !TSF:MSG:SEND,0-0-10-10,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
          2019-09-11 15:05:37.654 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2643051 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          2019-09-11 15:05:37.666 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2643057 TSF:MSG:BC
          2019-09-11 15:05:37.683 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2643062 TSF:MSG:FPAR REQ,ID=10
          2019-09-11 15:05:37.695 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2643068 TSF:PNG:SEND,TO=0
          2019-09-11 15:05:37.702 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2643074 TSF:CKU:OK
          2019-09-11 15:05:37.706 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2643078 TSF:MSG:GWL OK
          2019-09-11 15:05:41.453 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2646848 !TSF:MSG:SEND,0-0-10-10,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
          2019-09-11 15:05:46.656 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2652048 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          2019-09-11 15:05:46.665 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2652055 TSF:MSG:BC
          2019-09-11 15:05:46.669 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2652060 TSF:MSG:FPAR REQ,ID=10
          2019-09-11 15:05:46.673 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2652066 TSF:CKU:OK,FCTRL
          2019-09-11 15:05:46.680 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2652071 TSF:MSG:GWL OK
          2019-09-11 15:05:51.232 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2656636 !TSF:MSG:SEND,0-0-10-10,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
          2019-09-11 15:05:55.659 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2661046 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          2019-09-11 15:05:55.663 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2661052 TSF:MSG:BC
          2019-09-11 15:05:55.667 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2661057 TSF:MSG:FPAR REQ,ID=10
          2019-09-11 15:05:55.671 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2661063 TSF:CKU:OK,FCTRL
          2019-09-11 15:05:55.675 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2661069 TSF:MSG:GWL OK
          2019-09-11 15:05:59.959 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2665356 !TSF:MSG:SEND,0-0-10-10,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
          2019-09-11 15:06:04.653 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2670044 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          2019-09-11 15:06:04.657 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2670050 TSF:MSG:BC
          2019-09-11 15:06:04.660 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2670055 TSF:MSG:FPAR REQ,ID=10
          2019-09-11 15:06:04.664 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2670061 TSF:CKU:OK,FCTRL
          2019-09-11 15:06:04.671 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2670066 TSF:MSG:GWL OK
          2019-09-11 15:06:08.753 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2674148 !TSF:MSG:SEND,0-0-10-10,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
          2019-09-11 15:06:23.669 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2689060 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          2019-09-11 15:06:23.676 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2689066 TSF:MSG:BC
          2019-09-11 15:06:23.681 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2689071 TSF:MSG:FPAR REQ,ID=10
          2019-09-11 15:06:23.685 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2689077 TSF:PNG:SEND,TO=0
          2019-09-11 15:06:23.696 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2689082 TSF:CKU:OK
          2019-09-11 15:06:23.711 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2689087 TSF:MSG:GWL OK
          2019-09-11 15:06:27.381 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2692780 !TSF:MSG:SEND,0-0-10-10,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
          2019-09-11 15:06:32.656 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2698057 TSF:MSG:READ,10-10-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
          2019-09-11 15:06:32.660 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2698064 TSF:MSG:BC
          2019-09-11 15:06:32.675 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2698069 TSF:MSG:FPAR REQ,ID=10
          2019-09-11 15:06:32.679 [DEBUG] [rsAbstractConnection$MySensorsReader] - Message from gateway received: 0;255;3;0;9;2698074 TSF:CKU:OK,FCTRL
          

          The logs from the gateway is a little bit more dificult to follow because of the lenght of the messages due to the heading from Openhab preciding the debug messages.

          Regarding the <MyConfig.h>, I believe it is because I have used it in the first MySensors implementation I did... some years ago (version 1.4) it was required.. I think.. and I have copied it in this new implementation.

          EDIT: The logs received in the Gateway is using the TTGO ESP32 Lora as gateway and Lora32U4 as Node. If I use another Lora32U4 as gateway no messages are received. With the TTGO at least I see that when I power the Node, the Gateway starts receiving messages indicating that there is communication and that the transmission part in the Lora32U4 is working.

          1 Reply Last reply
          1
          • YveauxY Yveaux

            @carlomagno said in Mysensors and BSFrance Lora32u4 ii:

            Not sure if it is relevant in your case, but there seem to be quite some revisions around of your board, according to this: https://www.thethingsnetwork.org/forum/t/big-lora32u4-boards-topic/15273

            C Offline
            C Offline
            CarloMagno
            wrote on last edited by
            #5

            @yveaux Thank you for the replay.
            I read that post when I was testing the board but I don't know much about radio protocols and I get a little confused trying to extrapolate the information in that post to MySensors. The boards I have are version v1.2 (printed in the PCB).
            What I understood from the post (I could be totally wrong), is that if I want to implement LoRaWan protocol with that board I would need to solder DIO1 and DIO2 to some IO pins (preferably pin5 and pin6 using wire instead of the 1 and 2 that would be the easy ones with the soldering pads). But I believe for radio use with MySensors (no LoRaWan) I don't have to solder DIO1 or DIO2... (Is this assumption right?) as I got the boards talking to each other with the RadioHead library and the pin definitions I posted the sketch.

            RadioHead TX test sketch:

            // Feather9x_TX
            // -*- mode: C++ -*-
            // Example sketch showing how to create a simple messaging client (transmitter)
            // with the RH_RF95 class. RH_RF95 class does not provide for addressing or
            // reliability, so you should only use RH_RF95 if you do not need the higher
            // level messaging abilities.
            // It is designed to work with the other example Feather9x_RX
            
            #include <SPI.h>
            #include <RH_RF95.h>
            
            // for feather32u4 
            #define RFM95_CS 8
            #define RFM95_RST 4
            #define RFM95_INT 7
            
            
            /* for feather m0  
            #define RFM95_CS 8
            #define RFM95_RST 4
            #define RFM95_INT 3
            */
            
            /* for shield 
            #define RFM95_CS 10
            #define RFM95_RST 9
            #define RFM95_INT 7
            */
            
            /* Feather 32u4 w/wing
            #define RFM95_RST     11   // "A"
            #define RFM95_CS      10   // "B"
            #define RFM95_INT     2    // "SDA" (only SDA/SCL/RX/TX have IRQ!)
            */
            
            /* Feather m0 w/wing 
            #define RFM95_RST     11   // "A"
            #define RFM95_CS      10   // "B"
            #define RFM95_INT     6    // "D"
            */
            
            #if defined(ESP8266)
              /* for ESP w/featherwing */ 
              #define RFM95_CS  2    // "E"
              #define RFM95_RST 16   // "D"
              #define RFM95_INT 15   // "B"
            
            #elif defined(ESP32)  
              /* ESP32 feather w/wing */
              #define RFM95_RST     27   // "A"
              #define RFM95_CS      33   // "B"
              #define RFM95_INT     12   //  next to A
            
            #elif defined(NRF52)  
              /* nRF52832 feather w/wing */
              #define RFM95_RST     7   // "A"
              #define RFM95_CS      11   // "B"
              #define RFM95_INT     31   // "C"
              
            #elif defined(TEENSYDUINO)
              /* Teensy 3.x w/wing */
              #define RFM95_RST     9   // "A"
              #define RFM95_CS      10   // "B"
              #define RFM95_INT     4    // "C"
            #endif
            
            // Change to 434.0 or other frequency, must match RX's freq!
            #define RF95_FREQ 868.0
            
            // Singleton instance of the radio driver
            RH_RF95 rf95(RFM95_CS, RFM95_INT);
            
            void setup() 
            {
              pinMode(RFM95_RST, OUTPUT);
              digitalWrite(RFM95_RST, HIGH);
            
              Serial.begin(115200);
              while (!Serial) {
                delay(1);
              }
            
              delay(100);
            
              Serial.println("Feather LoRa TX Test!");
            
              // manual reset
              digitalWrite(RFM95_RST, LOW);
              delay(10);
              digitalWrite(RFM95_RST, HIGH);
              delay(10);
            
              while (!rf95.init()) {
                Serial.println("LoRa radio init failed");
                Serial.println("Uncomment '#define SERIAL_DEBUG' in RH_RF95.cpp for detailed debug info");
                while (1);
              }
              Serial.println("LoRa radio init OK!");
            
              // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM
              if (!rf95.setFrequency(RF95_FREQ)) {
                Serial.println("setFrequency failed");
                while (1);
              }
              Serial.print("Set Freq to: "); Serial.println(RF95_FREQ);
              
              // Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on
            
              // The default transmitter power is 13dBm, using PA_BOOST.
              // If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then 
              // you can set transmitter powers from 5 to 23 dBm:
              rf95.setTxPower(23, false);
            }
            
            int16_t packetnum = 0;  // packet counter, we increment per xmission
            
            void loop()
            {
              delay(1000); // Wait 1 second between transmits, could also 'sleep' here!
              Serial.println("Transmitting..."); // Send a message to rf95_server
              
              char radiopacket[20] = "Hello World #      ";
              itoa(packetnum++, radiopacket+13, 10);
              Serial.print("Sending "); Serial.println(radiopacket);
              radiopacket[19] = 0;
              
              Serial.println("Sending...");
              delay(10);
              rf95.send((uint8_t *)radiopacket, 20);
            
              Serial.println("Waiting for packet to complete..."); 
              delay(10);
              rf95.waitPacketSent();
              // Now wait for a reply
              uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
              uint8_t len = sizeof(buf);
            
              Serial.println("Waiting for reply...");
              if (rf95.waitAvailableTimeout(1000))
              { 
                // Should be a reply message for us now   
                if (rf95.recv(buf, &len))
               {
                  Serial.print("Got reply: ");
                  Serial.println((char*)buf);
                  Serial.print("RSSI: ");
                  Serial.println(rf95.lastRssi(), DEC);    
                }
                else
                {
                  Serial.println("Receive failed");
                }
              }
              else
              {
                Serial.println("No reply, is there a listener around?");
              }
            
            }
            

            RadioHead RX Test Sketch:

            // Feather9x_RX
            // -*- mode: C++ -*-
            // Example sketch showing how to create a simple messaging client (receiver)
            // with the RH_RF95 class. RH_RF95 class does not provide for addressing or
            // reliability, so you should only use RH_RF95 if you do not need the higher
            // level messaging abilities.
            // It is designed to work with the other example Feather9x_TX
            
            #include <SPI.h>
            #include <RH_RF95.h>
            
            // for Feather32u4 RFM9x
            #define RFM95_CS 8
            #define RFM95_RST 4
            #define RFM95_INT 7
            
            
            /* for feather m0 RFM9x
            #define RFM95_CS 8
            #define RFM95_RST 4
            #define RFM95_INT 3
            */
            
            /* for shield 
            #define RFM95_CS 10
            #define RFM95_RST 9
            #define RFM95_INT 7
            */
            
            /* Feather 32u4 w/wing
            #define RFM95_RST     11   // "A"
            #define RFM95_CS      10   // "B"
            #define RFM95_INT     2    // "SDA" (only SDA/SCL/RX/TX have IRQ!)
            */
            
            /* Feather m0 w/wing 
            #define RFM95_RST     11   // "A"
            #define RFM95_CS      10   // "B"
            #define RFM95_INT     6    // "D"
            */
            
            #if defined(ESP8266)
              /* for ESP w/featherwing */ 
              #define RFM95_CS  2    // "E"
              #define RFM95_RST 16   // "D"
              #define RFM95_INT 15   // "B"
            
            #elif defined(ESP32)  
              /* ESP32 feather w/wing */
              #define RFM95_RST     27   // "A"
              #define RFM95_CS      33   // "B"
              #define RFM95_INT     12   //  next to A
            
            #elif defined(NRF52)  
              /* nRF52832 feather w/wing */
              #define RFM95_RST     7   // "A"
              #define RFM95_CS      11   // "B"
              #define RFM95_INT     31   // "C"
              
            #elif defined(TEENSYDUINO)
              /* Teensy 3.x w/wing */
              #define RFM95_RST     9   // "A"
              #define RFM95_CS      10   // "B"
              #define RFM95_INT     4    // "C"
            #endif
            
            
            // Change to 434.0 or other frequency, must match RX's freq!
            #define RF95_FREQ 868.0
            
            // Singleton instance of the radio driver
            RH_RF95 rf95(RFM95_CS, RFM95_INT);
            
            // Blinky on receipt
            #define LED 13
            
            void setup()
            {
              pinMode(LED, OUTPUT);
              pinMode(RFM95_RST, OUTPUT);
              digitalWrite(RFM95_RST, HIGH);
            
              Serial.begin(115200);
              while (!Serial) {
                delay(1);
              }
              delay(100);
            
              Serial.println("Feather LoRa RX Test!");
            
              // manual reset
              digitalWrite(RFM95_RST, LOW);
              delay(10);
              digitalWrite(RFM95_RST, HIGH);
              delay(10);
            
              while (!rf95.init()) {
                Serial.println("LoRa radio init failed");
                Serial.println("Uncomment '#define SERIAL_DEBUG' in RH_RF95.cpp for detailed debug info");
                while (1);
              }
              Serial.println("LoRa radio init OK!");
            
              // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM
              if (!rf95.setFrequency(RF95_FREQ)) {
                Serial.println("setFrequency failed");
                while (1);
              }
              Serial.print("Set Freq to: "); Serial.println(RF95_FREQ);
            
              // Defaults after init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on
            
              // The default transmitter power is 13dBm, using PA_BOOST.
              // If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then
              // you can set transmitter powers from 5 to 23 dBm:
              rf95.setTxPower(23, false);
            }
            
            void loop()
            {
              if (rf95.available())
              {
                // Should be a message for us now
                uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
                uint8_t len = sizeof(buf);
            
                if (rf95.recv(buf, &len))
                {
                  digitalWrite(LED, HIGH);
                  RH_RF95::printBuffer("Received: ", buf, len);
                  Serial.print("Got: ");
                  Serial.println((char*)buf);
                   Serial.print("RSSI: ");
                  Serial.println(rf95.lastRssi(), DEC);
            
                  // Send a reply
                  uint8_t data[] = "And hello back to you";
                  rf95.send(data, sizeof(data));
                  rf95.waitPacketSent();
                  Serial.println("Sent a reply");
                  digitalWrite(LED, LOW);
                }
                else
                {
                  Serial.println("Receive failed");
                }
              }
            }
            

            The receiver node got the message with this library and without soldering DIO1 and DIO2.
            Thanks again for the support!

            1 Reply Last reply
            0
            • FarmerEdF Offline
              FarmerEdF Offline
              FarmerEd
              wrote on last edited by
              #6

              I realize this topic is old, but not sure if it was ever resolved. I'm trying out one of these boards at the moment, this was the only topic I seen about the board and I encountered the same issues as above.

              This is how I got it to communicate in the end and I thought I'd leave it here in case anyone else is looking at the same.

              #define MY_RADIO_RFM95
              #define MY_RFM95_RST_PIN 4
              #define MY_RFM95_CS_PIN 8
              #define MY_RFM95_IRQ_PIN 7
              #define MY_RFM95_IRQ_NUM digitalPinToInterrupt(7)
              #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
              #define MY_RFM95_FREQUENCY (RFM95_868MHZ)

              Soft SPI isn't necessary, but the only issue in the code above was the missing digitalPinToInterrupt.
              #define MY_RFM95_IRQ_NUM digitalPinToInterrupt(7)
              I presume the following should work also:
              #define MY_RFM95_IRQ_NUM digitalPinToInterrupt(MY_RFM95_IRQ_PIN)

              C 1 Reply Last reply
              3
              • FarmerEdF FarmerEd

                I realize this topic is old, but not sure if it was ever resolved. I'm trying out one of these boards at the moment, this was the only topic I seen about the board and I encountered the same issues as above.

                This is how I got it to communicate in the end and I thought I'd leave it here in case anyone else is looking at the same.

                #define MY_RADIO_RFM95
                #define MY_RFM95_RST_PIN 4
                #define MY_RFM95_CS_PIN 8
                #define MY_RFM95_IRQ_PIN 7
                #define MY_RFM95_IRQ_NUM digitalPinToInterrupt(7)
                #define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
                #define MY_RFM95_FREQUENCY (RFM95_868MHZ)

                Soft SPI isn't necessary, but the only issue in the code above was the missing digitalPinToInterrupt.
                #define MY_RFM95_IRQ_NUM digitalPinToInterrupt(7)
                I presume the following should work also:
                #define MY_RFM95_IRQ_NUM digitalPinToInterrupt(MY_RFM95_IRQ_PIN)

                C Offline
                C Offline
                CarloMagno
                wrote on last edited by
                #7

                @FarmerEd Thank you very much for taking the time to post the solution!
                At the moment I have dismantled the gateway with RF69 (moved to a LoRa gateway) but I will try to find some time in the following months to test the code.

                FarmerEdF 1 Reply Last reply
                0
                • C CarloMagno

                  @FarmerEd Thank you very much for taking the time to post the solution!
                  At the moment I have dismantled the gateway with RF69 (moved to a LoRa gateway) but I will try to find some time in the following months to test the code.

                  FarmerEdF Offline
                  FarmerEdF Offline
                  FarmerEd
                  wrote on last edited by
                  #8

                  @CarloMagno, No problem, this is not an RF69 device, it is RFM95 which is LoRa. I'm only interested in LoRa radios at the moment as I'm building a sensor network across a farm.

                  C 1 Reply Last reply
                  0
                  • FarmerEdF FarmerEd

                    @CarloMagno, No problem, this is not an RF69 device, it is RFM95 which is LoRa. I'm only interested in LoRa radios at the moment as I'm building a sensor network across a farm.

                    C Offline
                    C Offline
                    CarloMagno
                    wrote on last edited by CarloMagno
                    #9

                    @FarmerEd You are totally right :blush: .. I have left them so long ago that I forgot that I bought them when I changed from RF69 to LoRa. When i bought them (3 years ago they were a good solution if you want Lora in a pre-built board and don't need the power and price of ESP32 .. I have checked on-line shops for them now but the price advantage seems to have gone.

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      CarloMagno
                      wrote on last edited by
                      #10

                      I can confirm the solution posted by FarmerEd works for me. I was able to transmit from a Lora32u4 ii (node) to a TTGO Lora32 gateway.
                      As pointed in his post, the right line was:

                      #define MY_RFM95_IRQ_NUM digitalPinToInterrupt(7)
                      

                      instead of #define MY_RFM95_IRQ_NUM MY_RFM95_IRQ_PIN
                      or #define MY_RFM95_IRQ_NUM 7

                      Thanks very much again for taking the time to post the solution.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      9

                      Online

                      11.7k

                      Users

                      11.2k

                      Topics

                      113.0k

                      Posts


                      Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • MySensors
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular