Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: ESP32 with Lora E32 not receiving data #30822
    adi1316
    Participant

      Thanks Renzo for your support.

      //Sender Config

      //Sender Config
      13:42:53.345 -> RX MIC ---> -1
      13:42:53.345 -> TX MIC ---> -1
      13:42:53.345 -> TX Const ---> 6
      13:42:53.345 -> AUX ---> 23
      13:42:53.418 -> M0 ---> 10
      13:42:53.418 -> M1 ---> 11
      13:42:53.418 -> Init AUX pin!
      13:42:53.418 -> Init M0 pin!
      13:42:53.418 -> Init M1 pin!
      13:42:53.498 -> Begin ex
      13:42:53.498 -> Begin Hardware Serial
      13:42:53.498 -> Begin 
      13:42:53.498 -> MODE NORMAL!
      13:42:53.535 -> AUX HIGH!
      13:42:53.535 -> Complete!
      13:42:53.568 -> MODE PROGRAM/SLEEP!
      13:42:53.608 -> AUX HIGH!
      13:42:53.608 -> Complete!
      13:42:53.728 -> Available buffer: 6 structure size: 6
      13:42:53.728 -> AUX HIGH!
      13:42:53.728 -> Complete!
      13:42:53.728 -> ----------------------------------------
      13:42:53.797 -> HEAD : 11000000 192 C0
      13:42:53.797 ->  
      13:42:53.880 -> AddH : 0
      13:42:53.880 -> AddL : 1
      13:42:53.880 -> Chan : 4 -> 414MHz
      13:42:53.880 ->  
      13:42:53.880 -> SpeedParityBit     : 0 -> 8N1 (Default)
      13:42:53.915 -> SpeedUARTDatte  : 11 -> 9600bps (default)
      13:42:53.998 -> SpeedAirDataRate   : 10 -> 2.4kbps (default)
      13:42:53.998 -> OptionTrans        : 1 -> Fixed transmission (first three bytes can be used as high/low address and channel)
      13:42:54.113 -> OptionPullup       : 1 -> TXD, RXD, AUX are push-pulls/pull-ups
      13:42:54.182 -> OptionWakeup       : 100 -> 1250ms
      13:42:54.263 -> OptionFEC          : 1 -> Turn on Forward Error Correction Switch (Default)
      13:42:54.332 -> OptionPower        : 11 -> 10dBm
      13:42:54.332 -> ----------------------------------------
      13:42:54.398 -> ----------------------------------------
      13:42:54.479 -> HEAD BIN INSIDE: 11000000 192 C0
      13:42:54.479 -> ----------------------------------------
      13:42:54.479 -> MODE NORMAL!
      13:42:54.514 -> AUX HIGH!
      13:42:54.514 -> Complete!
      13:42:54.514 -> Complete!
      13:42:54.579 -> MODE PROGRAM/SLEEP!
      13:42:54.612 -> AUX HIGH!
      13:42:54.653 -> Complete!
      13:42:54.696 -> AUX HIGH!
      13:42:54.764 -> Complete!
      13:42:54.764 -> Clear buffer...ok!
      

      //Receiver Config

      13:29:58.427 -> RX MIC ---> -1
      13:29:58.427 -> TX MIC ---> -1
      13:29:58.427 -> TX Const ---> 6
      13:29:58.427 -> AUX ---> 1
      13:29:58.427 -> M0 ---> 10
      13:29:58.495 -> M1 ---> 11
      13:29:58.495 -> Init AUX pin!
      13:29:58.495 -> Init M0 pin!
      13:29:58.495 -> Init M1 pin!
      13:29:58.574 -> Begin ex
      13:29:58.574 -> Begin Hardware Serial
      13:29:58.574 -> Begin 
      13:29:58.574 -> MODE NORMAL!
      13:29:58.574 -> AUX HIGH!
      13:29:58.610 -> Complete!
      13:29:58.646 -> MODE PROGRAM/SLEEP!
      13:29:58.685 -> AUX HIGH!
      13:29:58.685 -> Complete!
      13:29:58.819 -> Available buffer: 6 structure size: 6
      13:29:58.819 -> AUX HIGH!
      13:29:58.819 -> Complete!
      13:29:58.819 -> ----------------------------------------
      13:29:58.861 -> HEAD : 11000000 192 C0
      13:29:58.861 ->  
      13:29:58.956 -> AddH : 0
      13:29:58.956 -> AddL : 3
      13:29:58.956 -> Chan : 4 -> 414MHz
      13:29:58.956 ->  
      13:29:58.956 -> SpeedParityBit     : 0 -> 8N1 (Default)
      13:29:58.989 -> SpeedUARTDatte  : 11 -> 9600bps (default)
      13:29:59.059 -> SpeedAirDataRate   : 10 -> 2.4kbps (default)
      13:29:59.059 -> OptionTrans        : 1 -> Fixed transmission (first three bytes can be used as high/low address and channel)
      13:29:59.179 -> OptionPullup       : 1 -> TXD, RXD, AUX are push-pulls/pull-ups
      13:29:59.258 -> OptionWakeup       : 100 -> 1250ms
      13:29:59.324 -> OptionFEC          : 1 -> Turn on Forward Error Correction Switch (Default)
      13:29:59.391 -> OptionPower        : 11 -> 10dBm
      13:29:59.474 -> ----------------------------------------
      13:29:59.540 -> HEAD BIN INSIDE: 11000000 192 C0
      13:29:59.540 -> ----------------------------------------
      13:29:59.575 -> MODE NORMAL!
      13:29:59.575 -> AUX HIGH!
      13:29:59.626 -> Complete!
      13:29:59.626 -> Updtaed config is 
      13:29:59.662 -> MODE PROGRAM/SLEEP!
      13:29:59.662 -> AUX HIGH!
      13:29:59.705 -> Complete!
      13:29:59.739 -> AUX HIGH!
      13:29:59.805 -> Complete!
      13:29:59.805 -> Clear buffer...ok!
      13:29:59.805 -> ----------------------------------------
      13:29:59.872 -> HEAD BIN INSIDE: 11000000 192 C0
      13:29:59.872 -> ----------------------------------------
      13:29:59.941 -> MODE NORMAL!
      13:29:59.972 -> AUX HIGH!
      13:30:00.006 -> Complete!
      13:30:00.006 -> Config: Success
      

      I have powering the sender/transmitter node with power bank and its working fine now.

      Can you please check the configuration once and confirm if it is production deploy ready?

      Also below is the updated code for your reference, if it needs any change

      Updated Sender Code

      
      //Sender
      #include "Arduino.h"
      #define E32_TTL_1W
      #include "LoRa_E32.h"
      #define FREQUENCY_868
      #define AUX 23
      #define M0 10
      #define M1 11
      #define txpin 5
      #define rxpin 4
      //HardwareSerial serial1(2);
      
      //LoRa_E32 e32ttl1w(txpin, rxpin, &Serial1, AUX, M0, M1, UART_BPS_RATE_9600);
      LoRa_E32 e32ttl1w(&Serial1, AUX, M0, M1);
      void printParameters(struct Configuration configuration);
      void printModuleInformation(struct ModuleInformation moduleInformation);
      
      // Variables globales
      unsigned long interval = 15000;          // interval between sends
      unsigned long lastSendTime = 0;        // last send time
      byte msgCount = 0;            // count of outgoing messages
      long randNumber;
      void setup() {
        //Inicio comunicacion serie con monitor
        Serial.begin(9600);
        delay(500);
      
        Serial.println("In setup");
      
        e32ttl1w.begin();
      
        //Configuro el nodo LoRa
        nodeConfig();
      }
      
      void loop() {
        // Wait a few seconds between measurements.
      
        if (millis() - lastSendTime > interval) {
          // print a random number from 10 to 19
          randNumber = random(10, 20);
          String trama = String(randNumber);
          ResponseStatus rs = e32ttl1w.sendFixedMessage(0x0, 0x3, 0x4, trama);
          Serial.println("Sending " + trama);
          Serial.println(rs.getResponseDescription());
          lastSendTime = millis();            // timestamp the message
          msgCount++;
        }
        delay(100);
      }
      
      void nodeConfig(){
      
        ResponseStructContainer c;
        c = e32ttl1w.getConfiguration();
        Configuration configuration = *(Configuration*) c.data;
      
        configuration.ADDH        = 0x0;
        configuration.ADDL        = 0x1;
        configuration.CHAN        = 0x4;
      
        configuration.SPED.airDataRate           = AIR_DATA_RATE_010_24;
        configuration.SPED.uartBaudRate          = UART_BPS_9600;
        configuration.SPED.uartParity            = MODE_00_8N1;
        configuration.OPTION.fec                 = FEC_1_ON;
        configuration.OPTION.fixedTransmission   = FT_FIXED_TRANSMISSION;
        configuration.OPTION.ioDriveMode         = IO_D_MODE_PUSH_PULLS_PULL_UPS;
        configuration.OPTION.transmissionPower   = POWER_21;
        configuration.OPTION.wirelessWakeupTime  = WAKE_UP_1250;
        //printParameters(configuration);
        c.close();
      // Set configuration changed and set to not hold the configuration
        ResponseStatus rs = e32ttl1w.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
        Serial.print("Config: ");
        Serial.println(rs.getResponseDescription());
      }
      

      Updated Receiver Code

      
      //Receiver Code
      #include "Arduino.h"
      #define E32_TTL_1W
      #include "LoRa_E32.h"
      #define AUX 1
      #define M0 10
      #define M1 11
      
      LoRa_E32 e32ttl1w(&Serial1, AUX, M0, M1);
      ResponseContainer rc;
      void setup() {
      //Inicio comunicacion serie con monitor
      	Serial.begin(9600);
        Serial.println("In setup mode");
      	delay(500);
      // Startup all pins and UART
      	e32ttl1w.begin();
      //Configuro el nodo LoRa
      	nodeConfig();
        //delay(4000);
        //fetchConfig();
      }
      
      void loop() {
      	if (e32ttl1w.available() > 0) {
      		Serial.println("———-");
      		rc = e32ttl1w.receiveMessageUntil();
          //rc.close();
      // If something goes wrong print error
      		if (rc.status.code != 1) {
      			rc.status.getResponseDescription();
            
      		} else {
      // Print the data received
      			Serial.println(rc.data);
      		}
          //rc.close();
      	}
      	delay(100);
      }
      
      void nodeConfig() {
      	ResponseStructContainer c;
      	c = e32ttl1w.getConfiguration();
      	Configuration configuration = *(Configuration*) c.data;
      	configuration.ADDH = 0x0;
      	configuration.ADDL = 0x3;
      	configuration.CHAN = 0x4;
      	configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
      	configuration.SPED.uartBaudRate = UART_BPS_9600;
      	configuration.SPED.uartParity = MODE_00_8N1;
      	configuration.OPTION.fec = FEC_1_ON;
      	configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;
      	configuration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS;
      	configuration.OPTION.transmissionPower = POWER_21;
      	configuration.OPTION.wirelessWakeupTime = WAKE_UP_1250;
      // Set configuration changed and set to not hold the configuration
        c.close();
        Serial.println("Updtaed config is ");
        
      	ResponseStatus rs = e32ttl1w.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
      	Serial.print("Config: ");
      	Serial.println(rs.getResponseDescription());
      }
      
    Viewing 1 post (of 1 total)