Ebyte LoRa E32 device for Arduino, esp32 or esp8266: power saving and sending structured data – Part 5

Spread the love

We will now understand how to send complex structures and manage power saving with our E32 UART LoRa device based on popular SX1276/SX1278 Wireless Modules.

LoRa EBYTE E32-TTL-100 Arduino Power saving and structured data
LoRa EBYTE E32-TTL-100 Arduino Power saving and structured data

You can find here AliExpress (433MHz 5Km) - AliExpress (433MHz 8Km) - AliExpress (433MHz 16Km) - AliExpress (868MHz 915MHz 5.5Km) - AliExpress (868MHz 915MHz 8Km)

If you have trouble with the device freeze, you must put a pull-up 4.7k resistor or better connect to the device AUX pin.

sx1278 sx1276 wireless lora uart module serial 3000m arduino 433 rf

Another interesting feature is the power saving configuration, and you can set M0 and M1 to do a wake-up from one device to another device in power-saving mode.

ModeM1M0Explanation
Normal00UART and the wireless channel is good to go
Wake-Up01Same as standard, but a preamble code is added to transmitted data for waking up the receiver.
Power-Saving10UART is disabled, and wireless is on WOR(wake on radio) mode, which means the device will turn on when data is received. Transmission is not allowed.
Sleep11Used in setting parameters. Transmitting and receiving are disabled.

So we need to connect the sending device in Wake-Up mode (If you fully connect the device, the library manage all modality for you):

LoRa E32 Arduino Wake-Up connection
LoRa E32 Wemos D1 wake up connection
LoRa E32 E220 ESP32 DEV KIT V1 Wake UP WOR transmitting mode on breadboard
LoRa E32 E220 ESP32 DEV KIT V1 Wake UP WOR transmitting mode on breadboard
LoRa E32 E220 Arduino MKR WiFi 1010 Wake UP WOR transmitting mode on breadboard
LoRa E32 E220 Arduino MKR WiFi 1010 Wake UP WOR transmitting mode on breadboard

And receiver device in power saving mode (If you fully connected the device, the library do all modality for you):

LoRa E32 Arduino Power Saving connection
LoRa E32 Wemos D1 power saving connection
LoRa E32 E220 ESP32 DEV KIT V1 Power saving, WOR receiving mode on breadboard
LoRa E32 E220 ESP32 DEV KIT V1 Power saving, WOR receiving mode on the breadboard
LoRa E32 E220 Arduino MKR WiFi 1010 Power saving WOR receiving mode on breadboard
LoRa E32 E220 Arduino MKR WiFi 1010 Power saving WOR receiving mode on the breadboard

Then you can use the sketch already posted.

Wake time

A critical configuration parameter is wake time, for the sender is important because It adds a long preamble to the message (long as wake time). This receiver use wake time as a pull interval time check.
So if the receiver checks every 250ms (wake time) if there is a message if the sender adds a 2 seconds wake time, the receiver probably scans the message preamble, waits that arrive the actual message, read It and return to power save mode.

So If you want to maximize the power save, you must put minimal WAKE TIME to the sender and maximize WAKE TIME to the receiver; if you want more efficiency, you must do the inverse.

Sending sketch (if you don’t make connection entirely, remember that first, you must set configuration in program/sleep mode and then return in specified modality)

/*
 * LoRa E32-TTL-100
 * Send fixed transmission message to a specified point.
 * https://mischianti.org
 *
 * E32-TTL-100----- Arduino UNO or esp8266
 * M0         ----- 3.3v (To config) 3.3v (To send) 7 (To dinamically manage)
 * M1         ----- 3.3v (To config) GND  (To send) 6 (To dinamically manage)
 * TX         ----- PIN 2 (PullUP)
 * RX         ----- PIN 3 (PullUP & Voltage divider)
 * AUX        ----- Not connected (5 if you connect)
 * VCC        ----- 3.3v/5v
 * GND        ----- GND
 *
 */
#include "Arduino.h"
#include "LoRa_E32.h"

// ---------- esp8266 pins --------------
//LoRa_E32 e32ttl(D2, D3, D5, D7, D6);
//LoRa_E32 e32ttl(D2, D3, D5, D7, D6); // Config without connect AUX and M0 M1
#include <SoftwareSerial.h>
SoftwareSerial mySerial(D2, D3); // e32 TX e32 RX
LoRa_E32 e32ttl(&mySerial, D5, D7, D6);

//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(D2, D3); // e32 TX e32 RX
//LoRa_E32 e32ttl(&mySerial, D5, D7, D6);
// -------------------------------------

// ---------- Arduino pins --------------
//LoRa_E32 e32ttl(2, 3, 5, 7, 6);
//LoRa_E32 e32ttl(2, 3); // Config without connect AUX and M0 M1

//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(2, 3); // e32 TX e32 RX
//LoRa_E32 e32ttl(&mySerial, 5, 7, 6);
// -------------------------------------

void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
//The setup function is called once at startup of the sketch
void setup()
{
	Serial.begin(9600);
	while (!Serial) {
	    ; // wait for serial port to connect. Needed for native USB
    }
	delay(100);

	e32ttl.begin();
        e32ttl.setMode(MODE_1_WAKE_UP);

	// After set configuration comment set M0 and M1 to low
	// and reboot if you directly set HIGH M0 and M1 to program
	ResponseStructContainer c;
	c = e32ttl.getConfiguration();
	Configuration configuration = *(Configuration*) c.data;
	configuration.ADDL = 0x01;
	configuration.ADDH = 0x00;
	configuration.CHAN = 0x04;
	configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;
	configuration.OPTION.wirelessWakeupTime = WAKE_UP_2000;
	e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
	printParameters(configuration);
	// ---------------------------
}

// The loop function is called in an endless loop
void loop()
{
	delay(2000);

	Serial.println("Send message to 00 03 04");
	ResponseStatus rs = e32ttl.sendFixedMessage(0, 3, 0x04, "Message to 00 03 04 device");
	Serial.println(rs.getResponseDescription());
}

void printParameters(struct Configuration configuration) {
	Serial.println("----------------------------------------");

	Serial.print(F("HEAD : "));  Serial.print(configuration.HEAD, BIN);Serial.print(" ");Serial.print(configuration.HEAD, DEC);Serial.print(" ");Serial.println(configuration.HEAD, HEX);
	Serial.println(F(" "));
	Serial.print(F("AddH : "));  Serial.println(configuration.ADDH, BIN);
	Serial.print(F("AddL : "));  Serial.println(configuration.ADDL, BIN);
	Serial.print(F("Chan : "));  Serial.print(configuration.CHAN, DEC); Serial.print(" -> "); Serial.println(configuration.getChannelDescription());
	Serial.println(F(" "));
	Serial.print(F("SpeedParityBit     : "));  Serial.print(configuration.SPED.uartParity, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTParityDescription());
	Serial.print(F("SpeedUARTDatte  : "));  Serial.print(configuration.SPED.uartBaudRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTBaudRate());
	Serial.print(F("SpeedAirDataRate   : "));  Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRate());

	Serial.print(F("OptionTrans        : "));  Serial.print(configuration.OPTION.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFixedTransmissionDescription());
	Serial.print(F("OptionPullup       : "));  Serial.print(configuration.OPTION.ioDriveMode, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getIODroveModeDescription());
	Serial.print(F("OptionWakeup       : "));  Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());
	Serial.print(F("OptionFEC          : "));  Serial.print(configuration.OPTION.fec, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFECDescription());
	Serial.print(F("OptionPower        : "));  Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getTransmissionPowerDescription());

	Serial.println("----------------------------------------");

}
void printModuleInformation(struct ModuleInformation moduleInformation) {
	Serial.println("----------------------------------------");
	Serial.print(F("HEAD BIN: "));  Serial.print(moduleInformation.HEAD, BIN);Serial.print(" ");Serial.print(moduleInformation.HEAD, DEC);Serial.print(" ");Serial.println(moduleInformation.HEAD, HEX);

	Serial.print(F("Freq.: "));  Serial.println(moduleInformation.frequency, HEX);
	Serial.print(F("Version  : "));  Serial.println(moduleInformation.version, HEX);
	Serial.print(F("Features : "));  Serial.println(moduleInformation.features, HEX);
	Serial.println("----------------------------------------");

}

And receiving sketch (if you don’t make connection entirely, remember that first, you must set configuration in program/sleep mode and then return in specified modality):

/*
 * LoRa E32-TTL-100
 * Receive fixed transmission message on channel.
 * https://mischianti.org
 *
 * E32-TTL-100----- Arduino UNO or esp8266
 * M0         ----- 3.3v (To config) GND  (To send) 7 (To dinamically manage)
 * M1         ----- 3.3v (To config) 3.3v (To send) 6 (To dinamically manage)
 * TX         ----- PIN 2 (PullUP)
 * RX         ----- PIN 3 (PullUP & Voltage divider)
 * AUX        ----- Not connected (5 if you connect)
 * VCC        ----- 3.3v/5v
 * GND        ----- GND
 *
 */
#include "Arduino.h"
#include "LoRa_E32.h"

// ---------- esp8266 pins --------------
//LoRa_E32 e32ttl(D2, D3, D5, D7, D6);
//LoRa_E32 e32ttl(D2, D3); // Config without connect AUX and M0 M1

//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(D2, D3);  // e32 TX e32 RX
//LoRa_E32 e32ttl(&mySerial, D5, D7, D6);
// -------------------------------------

// ---------- Arduino pins --------------
//LoRa_E32 e32ttl(2, 3, 5, 7, 6);
LoRa_E32 e32ttl(2, 3); // Config without connect AUX and M0 M1

//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(2, 3); // e32 TX e32 RX
//LoRa_E32 e32ttl(&mySerial, 5, 7, 6);
// -------------------------------------
void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
//The setup function is called once at startup of the sketch
void setup()
{
	Serial.begin(9600);
	while (!Serial) {
	    ; // wait for serial port to connect. Needed for native USB
    }
	delay(100);

	e32ttl.begin();
        e32ttl.setMode(MODE_2_POWER_SAVING);

//	e32ttl.resetModule();
	// After set configuration comment set M0 and M1 to low
	// and reboot if you directly set HIGH M0 and M1 to program
	ResponseStructContainer c;
	c = e32ttl.getConfiguration();
	Configuration configuration = *(Configuration*) c.data;
	configuration.ADDL = 3;
	configuration.ADDH = 0;
	configuration.CHAN = 0x04;
	configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;
	configuration.OPTION.wirelessWakeupTime = WAKE_UP_250;

	e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
	printParameters(configuration);
	// ---------------------------
	Serial.println();
	Serial.println("Start listening!");
}

// The loop function is called in an endless loop
void loop()
{
	if (e32ttl.available()  > 1){
		ResponseContainer rs = e32ttl.receiveMessage();
        // First of all get the data
		String message = rs.data;

		Serial.println(rs.status.getResponseDescription());
		Serial.println(message);
	}
}

void printParameters(struct Configuration configuration) {
	Serial.println("----------------------------------------");

	Serial.print(F("HEAD : "));  Serial.print(configuration.HEAD, BIN);Serial.print(" ");Serial.print(configuration.HEAD, DEC);Serial.print(" ");Serial.println(configuration.HEAD, HEX);
	Serial.println(F(" "));
	Serial.print(F("AddH : "));  Serial.println(configuration.ADDH, DEC);
	Serial.print(F("AddL : "));  Serial.println(configuration.ADDL, DEC);
	Serial.print(F("Chan : "));  Serial.print(configuration.CHAN, DEC); Serial.print(" -> "); Serial.println(configuration.getChannelDescription());
	Serial.println(F(" "));
	Serial.print(F("SpeedParityBit     : "));  Serial.print(configuration.SPED.uartParity, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTParityDescription());
	Serial.print(F("SpeedUARTDatte  : "));  Serial.print(configuration.SPED.uartBaudRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTBaudRate());
	Serial.print(F("SpeedAirDataRate   : "));  Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRate());

	Serial.print(F("OptionTrans        : "));  Serial.print(configuration.OPTION.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFixedTransmissionDescription());
	Serial.print(F("OptionPullup       : "));  Serial.print(configuration.OPTION.ioDriveMode, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getIODroveModeDescription());
	Serial.print(F("OptionWakeup       : "));  Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());
	Serial.print(F("OptionFEC          : "));  Serial.print(configuration.OPTION.fec, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFECDescription());
	Serial.print(F("OptionPower        : "));  Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getTransmissionPowerDescription());

	Serial.println("----------------------------------------");

}
void printModuleInformation(struct ModuleInformation moduleInformation) {
	Serial.println("----------------------------------------");
	Serial.print(F("HEAD BIN: "));  Serial.print(moduleInformation.HEAD, BIN);Serial.print(" ");Serial.print(moduleInformation.HEAD, DEC);Serial.print(" ");Serial.println(moduleInformation.HEAD, HEX);

	Serial.print(F("Freq.: "));  Serial.println(moduleInformation.frequency, HEX);
	Serial.print(F("Version  : "));  Serial.println(moduleInformation.version, HEX);
	Serial.print(F("Features : "));  Serial.println(moduleInformation.features, HEX);
	Serial.println("----------------------------------------");

}

Send complex structure

We can use string as we want, use It as JSON format, and so on, but if you’re going to use structured messages in native mode (byte array), It’s possible to send them.

The example code for the sender can be:

	struct Message {
	    char type[5] = "TEMP";
	    char message[8] = "Kitchen";
	    byte temperature[4];
	} message;

	*(float*)(message.temperature) = 19.2;

	ResponseStatus rs = e32ttl.sendFixedMessage(0,3,4,&message, sizeof(Message));
	Serial.println(rs.getResponseDescription());

and to receive:

	if (e32ttl.available()  > 1){

		ResponseStructContainer rsc = e32ttl.receiveMessage(sizeof(Message));
		struct Message message = *(Message*) rsc.data;
		Serial.println(message.type);

		Serial.println(*(float*)(message.temperature));
		Serial.println(message.message);
		free(rsc.data);
	}

Complete sender sketch:

/*
 * LoRa E32-TTL-100
 * Send fixed transmission structured message to a specified point.
 * https://mischianti.org
 *
 * E32-TTL-100----- Arduino UNO or esp8266
 * M0         ----- 3.3v (To config) GND (To send) 7 (To dinamically manage)
 * M1         ----- 3.3v (To config) GND (To send) 6 (To dinamically manage)
 * TX         ----- PIN 2 (PullUP)
 * RX         ----- PIN 3 (PullUP & Voltage divider)
 * AUX        ----- Not connected (5 if you connect)
 * VCC        ----- 3.3v/5v
 * GND        ----- GND
 *
 */
#include "Arduino.h"
#include "LoRa_E32.h"

// ---------- esp8266 pins --------------
//LoRa_E32 e32ttl(D2, D3, D5, D7, D6);
//LoRa_E32 e32ttl(D2, D3, D5, D7, D6); // Config without connect AUX and M0 M1
#include <SoftwareSerial.h>
SoftwareSerial mySerial(D2, D3); // e32 TX e32 RX
LoRa_E32 e32ttl(&mySerial, D5, D7, D6);

//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(D2, D3); // e32 TX e32 RX
//LoRa_E32 e32ttl(&mySerial, D5, D7, D6);
// -------------------------------------

// ---------- Arduino pins --------------
//LoRa_E32 e32ttl(2, 3, 5, 7, 6);
//LoRa_E32 e32ttl(2, 3); // Config without connect AUX and M0 M1

//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(2, 3); // e32 TX e32 RX
//LoRa_E32 e32ttl(&mySerial, 5, 7, 6);
// -------------------------------------

void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
//The setup function is called once at startup of the sketch
void setup()
{
	Serial.begin(9600);
	while (!Serial) {
	    ; // wait for serial port to connect. Needed for native USB
    }
	delay(100);

	e32ttl.begin();
	// After set configuration comment set M0 and M1 to low
	// and reboot if you directly set HIGH M0 and M1 to program
	ResponseStructContainer c;
	c = e32ttl.getConfiguration();
	Configuration configuration = *(Configuration*) c.data;
	configuration.ADDL = 0x01;
	configuration.ADDH = 0x00;
	configuration.CHAN = 0x02;
	configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;
	e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
	printParameters(configuration);
	// ---------------------------
}
struct Message {
    char type[5];
    char message[8];
    int temperature;
} message;

int i = 0;
// The loop function is called in an endless loop
void loop()
{
	delay(2500);
	i++;
	struct Message {
	    char type[5] = "TEMP";
	    char message[8] = "Kitchen";
	    byte temperature[4];
	} message;

	*(float*)(message.temperature) = 19.2;

	ResponseStatus rs = e32ttl.sendFixedMessage(0,3,4,&message, sizeof(Message));
	Serial.println(rs.getResponseDescription());
}

void printParameters(struct Configuration configuration) {
	Serial.println("----------------------------------------");

	Serial.print(F("HEAD : "));  Serial.print(configuration.HEAD, BIN);Serial.print(" ");Serial.print(configuration.HEAD, DEC);Serial.print(" ");Serial.println(configuration.HEAD, HEX);
	Serial.println(F(" "));
	Serial.print(F("AddH : "));  Serial.println(configuration.ADDH, BIN);
	Serial.print(F("AddL : "));  Serial.println(configuration.ADDL, BIN);
	Serial.print(F("Chan : "));  Serial.print(configuration.CHAN, DEC); Serial.print(" -> "); Serial.println(configuration.getChannelDescription());
	Serial.println(F(" "));
	Serial.print(F("SpeedParityBit     : "));  Serial.print(configuration.SPED.uartParity, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTParityDescription());
	Serial.print(F("SpeedUARTDatte  : "));  Serial.print(configuration.SPED.uartBaudRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTBaudRate());
	Serial.print(F("SpeedAirDataRate   : "));  Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRate());

	Serial.print(F("OptionTrans        : "));  Serial.print(configuration.OPTION.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFixedTransmissionDescription());
	Serial.print(F("OptionPullup       : "));  Serial.print(configuration.OPTION.ioDriveMode, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getIODroveModeDescription());
	Serial.print(F("OptionWakeup       : "));  Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());
	Serial.print(F("OptionFEC          : "));  Serial.print(configuration.OPTION.fec, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFECDescription());
	Serial.print(F("OptionPower        : "));  Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getTransmissionPowerDescription());

	Serial.println("----------------------------------------");

}
void printModuleInformation(struct ModuleInformation moduleInformation) {
	Serial.println("----------------------------------------");
	Serial.print(F("HEAD BIN: "));  Serial.print(moduleInformation.HEAD, BIN);Serial.print(" ");Serial.print(moduleInformation.HEAD, DEC);Serial.print(" ");Serial.println(moduleInformation.HEAD, HEX);

	Serial.print(F("Freq.: "));  Serial.println(moduleInformation.frequency, HEX);
	Serial.print(F("Version  : "));  Serial.println(moduleInformation.version, HEX);
	Serial.print(F("Features : "));  Serial.println(moduleInformation.features, HEX);
	Serial.println("----------------------------------------");

}

Complete receiver sketch:

/*
 * LoRa E32-TTL-100
 * Receive fixed transmission message on channel.
 * https://mischianti.org
 *
 * E32-TTL-100----- Arduino UNO or esp8266
 * M0         ----- 3.3v (To config) GND (To send) 7 (To dinamically manage)
 * M1         ----- 3.3v (To config) GND (To send) 6 (To dinamically manage)
 * TX         ----- PIN 2 (PullUP)
 * RX         ----- PIN 3 (PullUP & Voltage divider)
 * AUX        ----- Not connected (5 if you connect)
 * VCC        ----- 3.3v/5v
 * GND        ----- GND
 *
 */
#include "Arduino.h"
#include "LoRa_E32.h"

// ---------- esp8266 pins --------------
//LoRa_E32 e32ttl(D2, D3, D5, D7, D6);
//LoRa_E32 e32ttl(D2, D3); // Config without connect AUX and M0 M1

//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(D2, D3); // e32 TX e32 RX
//LoRa_E32 e32ttl(&mySerial, D5, D7, D6);
// -------------------------------------

// ---------- Arduino pins --------------
//LoRa_E32 e32ttl(2, 3, 5, 7, 6);
LoRa_E32 e32ttl(2, 3, 4); // Config without connect AUX and M0 M1

//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(2, 3); // e32 TX e32 RX
//LoRa_E32 e32ttl(&mySerial, 5, 7, 6);
// -------------------------------------
void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
//The setup function is called once at startup of the sketch
void setup()
{
	Serial.begin(9600);
	while (!Serial) {
	    ; // wait for serial port to connect. Needed for native USB
    }
	delay(100);

	e32ttl.begin();

//	e32ttl.resetModule();
	// After set configuration comment set M0 and M1 to low
	// and reboot if you directly set HIGH M0 and M1 to program
	ResponseStructContainer c;
	c = e32ttl.getConfiguration();
	Configuration configuration = *(Configuration*) c.data;
	configuration.ADDL = 3;
	configuration.ADDH = 0;
	configuration.CHAN = 0x04;
	configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;

	e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
	printParameters(configuration);
	// ---------------------------
	Serial.println();
	Serial.println("Start listening!");
    e32ttl.setMode(MODE_2_POWER_SAVING);

}
struct Message {
    char type[5];
    char message[8];
    byte temperature[4];
};

// The loop function is called in an endless loop
void loop()
{
	if (e32ttl.available()  > 1){

		ResponseStructContainer rsc = e32ttl.receiveMessage(sizeof(Message));
		struct Message message = *(Message*) rsc.data;
		Serial.println(message.type);

		Serial.println(*(float*)(message.temperature));
		Serial.println(message.message);
		free(rsc.data);
	}
}

void printParameters(struct Configuration configuration) {
	Serial.println("----------------------------------------");

	Serial.print(F("HEAD : "));  Serial.print(configuration.HEAD, BIN);Serial.print(" ");Serial.print(configuration.HEAD, DEC);Serial.print(" ");Serial.println(configuration.HEAD, HEX);
	Serial.println(F(" "));
	Serial.print(F("AddH : "));  Serial.println(configuration.ADDH, DEC);
	Serial.print(F("AddL : "));  Serial.println(configuration.ADDL, DEC);
	Serial.print(F("Chan : "));  Serial.print(configuration.CHAN, DEC); Serial.print(" -> "); Serial.println(configuration.getChannelDescription());
	Serial.println(F(" "));
	Serial.print(F("SpeedParityBit     : "));  Serial.print(configuration.SPED.uartParity, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTParityDescription());
	Serial.print(F("SpeedUARTDatte  : "));  Serial.print(configuration.SPED.uartBaudRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTBaudRate());
	Serial.print(F("SpeedAirDataRate   : "));  Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRate());

	Serial.print(F("OptionTrans        : "));  Serial.print(configuration.OPTION.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFixedTransmissionDescription());
	Serial.print(F("OptionPullup       : "));  Serial.print(configuration.OPTION.ioDriveMode, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getIODroveModeDescription());
	Serial.print(F("OptionWakeup       : "));  Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());
	Serial.print(F("OptionFEC          : "));  Serial.print(configuration.OPTION.fec, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFECDescription());
	Serial.print(F("OptionPower        : "));  Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getTransmissionPowerDescription());

	Serial.println("----------------------------------------");

}
void printModuleInformation(struct ModuleInformation moduleInformation) {
	Serial.println("----------------------------------------");
	Serial.print(F("HEAD BIN: "));  Serial.print(moduleInformation.HEAD, BIN);Serial.print(" ");Serial.print(moduleInformation.HEAD, DEC);Serial.print(" ");Serial.println(moduleInformation.HEAD, HEX);

	Serial.print(F("Freq.: "));  Serial.println(moduleInformation.frequency, HEX);
	Serial.print(F("Version  : "));  Serial.println(moduleInformation.version, HEX);
	Serial.print(F("Features : "));  Serial.println(moduleInformation.features, HEX);
	Serial.println("----------------------------------------");

}

But real life is not so simple, and probably you have multiple sensors with different structures in your home, so you need to receive various structures. A possible solution is to read the first part of the structure and instantiate the rest as you want.

Read a piece of structure

So if you would have the TYPE of structure you are going to read:

		char type[5]; // first part of structure
		ResponseContainer rs = e32ttl.receiveInitialMessage(sizeof(type));
                String typeStr = rs.data;

With this information, we can create specified structures from different devices, for example:

	struct Message {
	    char type[5] = "TEMP";
	    char message[8] = "Kitchen";
	    byte temperature[4];
	} message;

	*(float*)(message.temperature) = 19.2;

	ResponseStatus rs = e32ttl.sendFixedMessage(0,3,4,&message, sizeof(Message));
	Serial.println(rs.getResponseDescription());

or

	struct Message {
	    char type[5] = "HUM";
	    char message[8] = "Room";
	    byte humidity;
	} message;

	message.humidity = 65;

	ResponseStatus rs = e32ttl.sendFixedMessage(0,3,4,&message, sizeof(Message));
	Serial.println(rs.getResponseDescription());

And so you can load specified structure from the receiver:

	if (e32ttl.available()  > 1){
		char type[5]; // first part of structure
		ResponseContainer rs = e32ttl.receiveInitialMessage(sizeof(type));
// 		Put string in a char array (not needed)
//		memcpy ( type, rs.data.c_str(), sizeof(type) );
		String typeStr = rs.data;

		Serial.println(typeStr);
		if (typeStr=="TEMP"){
			ResponseStructContainer rsc = e32ttl.receiveMessage(sizeof(Message));
			struct Message message = *(Message*) rsc.data;

			Serial.println(*(float*)(message.temperature));
			Serial.println(message.message);
			free(rsc.data);
		}else if (typeStr == "HUM"){
			ResponseStructContainer rsc = e32ttl.receiveMessage(sizeof(MessageHumidity));
			struct MessageHumidity message = *(MessageHumidity*) rsc.data;

			Serial.println(message.humidity);
			Serial.println(message.message);
			free(rsc.data);

		}else{
			Serial.println("Something goes wrong!!");
		}
	}

So we have two sender sketches like this that send float temperature:

/*
 * LoRa E32-TTL-100
 * Send fixed transmission structured message to a specified point.
 * https://mischianti.org
 *
 * E32-TTL-100----- Arduino UNO or esp8266
 * M0         ----- 3.3v (To config) GND (To send) 7 (To dinamically manage)
 * M1         ----- 3.3v (To config) GND (To send) 6 (To dinamically manage)
 * TX         ----- PIN 2 (PullUP)
 * RX         ----- PIN 3 (PullUP & Voltage divider)
 * AUX        ----- Not connected (5 if you connect)
 * VCC        ----- 3.3v/5v
 * GND        ----- GND
 *
 */
#include "Arduino.h"
#include "LoRa_E32.h"

// ---------- esp8266 pins --------------
//LoRa_E32 e32ttl(D2, D3, D5, D7, D6);
//LoRa_E32 e32ttl(D2, D3, D5, D7, D6); // Config without connect AUX and M0 M1
#include <SoftwareSerial.h>
SoftwareSerial mySerial(D2, D3); // e32 TX e32 RX
LoRa_E32 e32ttl(&mySerial, D5, D7, D6);

//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(D2, D3); // e32 TX e32 RX
//LoRa_E32 e32ttl(&mySerial, D5, D7, D6);
// -------------------------------------

// ---------- Arduino pins --------------
//LoRa_E32 e32ttl(2, 3, 5, 7, 6);
//LoRa_E32 e32ttl(2, 3); // Config without connect AUX and M0 M1

//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(2, 3); // e32 TX e32 RX
//LoRa_E32 e32ttl(&mySerial, 5, 7, 6);
// -------------------------------------

void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
//The setup function is called once at startup of the sketch
void setup()
{
	Serial.begin(9600);
	while (!Serial) {
	    ; // wait for serial port to connect. Needed for native USB
    }
	delay(100);

	e32ttl.begin();
	// After set configuration comment set M0 and M1 to low
	// and reboot if you directly set HIGH M0 and M1 to program
	ResponseStructContainer c;
	c = e32ttl.getConfiguration();
	Configuration configuration = *(Configuration*) c.data;
	configuration.ADDL = 0x01;
	configuration.ADDH = 0x00;
	configuration.CHAN = 0x02;
	configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;
	e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
	printParameters(configuration);
	// ---------------------------
}
struct Message {
    char type[5];
    char message[8];
    int temperature;
} message;

int i = 0;
// The loop function is called in an endless loop
void loop()
{
	delay(2500);
	i++;
	struct Message {
	    char type[5] = "TEMP";
	    char message[8] = "Kitchen";
	    byte temperature[4];
	} message;

	*(float*)(message.temperature) = 19.2;

	ResponseStatus rs = e32ttl.sendFixedMessage(0,3,4,&message, sizeof(Message));
	Serial.println(rs.getResponseDescription());
}

void printParameters(struct Configuration configuration) {
	Serial.println("----------------------------------------");

	Serial.print(F("HEAD : "));  Serial.print(configuration.HEAD, BIN);Serial.print(" ");Serial.print(configuration.HEAD, DEC);Serial.print(" ");Serial.println(configuration.HEAD, HEX);
	Serial.println(F(" "));
	Serial.print(F("AddH : "));  Serial.println(configuration.ADDH, BIN);
	Serial.print(F("AddL : "));  Serial.println(configuration.ADDL, BIN);
	Serial.print(F("Chan : "));  Serial.print(configuration.CHAN, DEC); Serial.print(" -> "); Serial.println(configuration.getChannelDescription());
	Serial.println(F(" "));
	Serial.print(F("SpeedParityBit     : "));  Serial.print(configuration.SPED.uartParity, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTParityDescription());
	Serial.print(F("SpeedUARTDatte  : "));  Serial.print(configuration.SPED.uartBaudRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTBaudRate());
	Serial.print(F("SpeedAirDataRate   : "));  Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRate());

	Serial.print(F("OptionTrans        : "));  Serial.print(configuration.OPTION.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFixedTransmissionDescription());
	Serial.print(F("OptionPullup       : "));  Serial.print(configuration.OPTION.ioDriveMode, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getIODroveModeDescription());
	Serial.print(F("OptionWakeup       : "));  Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());
	Serial.print(F("OptionFEC          : "));  Serial.print(configuration.OPTION.fec, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFECDescription());
	Serial.print(F("OptionPower        : "));  Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getTransmissionPowerDescription());

	Serial.println("----------------------------------------");

}
void printModuleInformation(struct ModuleInformation moduleInformation) {
	Serial.println("----------------------------------------");
	Serial.print(F("HEAD BIN: "));  Serial.print(moduleInformation.HEAD, BIN);Serial.print(" ");Serial.print(moduleInformation.HEAD, DEC);Serial.print(" ");Serial.println(moduleInformation.HEAD, HEX);

	Serial.print(F("Freq.: "));  Serial.println(moduleInformation.frequency, HEX);
	Serial.print(F("Version  : "));  Serial.println(moduleInformation.version, HEX);
	Serial.print(F("Features : "));  Serial.println(moduleInformation.features, HEX);
	Serial.println("----------------------------------------");

}

and like so to send humidity value:

/*
 * LoRa E32-TTL-100
 * Send fixed transmission structured message to a specified point.
 * https://mischianti.org
 *
 * E32-TTL-100----- Arduino UNO or esp8266
 * M0         ----- 3.3v (To config) GND (To send) 7 (To dinamically manage)
 * M1         ----- 3.3v (To config) GND (To send) 6 (To dinamically manage)
 * TX         ----- PIN 2 (PullUP)
 * RX         ----- PIN 3 (PullUP & Voltage divider)
 * AUX        ----- Not connected (5 if you connect)
 * VCC        ----- 3.3v/5v
 * GND        ----- GND
 *
 */
#include "Arduino.h"
#include "LoRa_E32.h"

// ---------- esp8266 pins --------------
//LoRa_E32 e32ttl(D2, D3, D5, D7, D6);
//LoRa_E32 e32ttl(D2, D3, D5, D7, D6); // Config without connect AUX and M0 M1
#include <SoftwareSerial.h>
SoftwareSerial mySerial(D2, D3); // e32 TX e32 RX
LoRa_E32 e32ttl(&mySerial, D5, D7, D6);

//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(D2, D3); // e32 TX e32 RX
//LoRa_E32 e32ttl(&mySerial, D5, D7, D6);
// -------------------------------------

// ---------- Arduino pins --------------
//LoRa_E32 e32ttl(2, 3, 5, 7, 6);
//LoRa_E32 e32ttl(2, 3); // Config without connect AUX and M0 M1

//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(2, 3); // e32 TX e32 RX
//LoRa_E32 e32ttl(&mySerial, 5, 7, 6);
// -------------------------------------

void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
//The setup function is called once at startup of the sketch
void setup()
{
	Serial.begin(9600);
	while (!Serial) {
	    ; // wait for serial port to connect. Needed for native USB
    }
	delay(100);

	e32ttl.begin();
	// After set configuration comment set M0 and M1 to low
	// and reboot if you directly set HIGH M0 and M1 to program
	ResponseStructContainer c;
	c = e32ttl.getConfiguration();
	Configuration configuration = *(Configuration*) c.data;
	configuration.ADDL = 0x02;
	configuration.ADDH = 0x00;
	configuration.CHAN = 0x02;
	configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;
	e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
	printParameters(configuration);
	// ---------------------------
}
int i = 0;
// The loop function is called in an endless loop
void loop()
{
	delay(2500);
	i++;
	struct Message {
	    char type[5] = "HUM";
	    char message[8] = "Room";
	    byte humidity;
	} message;

	message.humidity = 65;

	ResponseStatus rs = e32ttl.sendFixedMessage(0,3,4,&message, sizeof(Message));
	Serial.println(rs.getResponseDescription());
}

void printParameters(struct Configuration configuration) {
	Serial.println("----------------------------------------");

	Serial.print(F("HEAD : "));  Serial.print(configuration.HEAD, BIN);Serial.print(" ");Serial.print(configuration.HEAD, DEC);Serial.print(" ");Serial.println(configuration.HEAD, HEX);
	Serial.println(F(" "));
	Serial.print(F("AddH : "));  Serial.println(configuration.ADDH, BIN);
	Serial.print(F("AddL : "));  Serial.println(configuration.ADDL, BIN);
	Serial.print(F("Chan : "));  Serial.print(configuration.CHAN, DEC); Serial.print(" -> "); Serial.println(configuration.getChannelDescription());
	Serial.println(F(" "));
	Serial.print(F("SpeedParityBit     : "));  Serial.print(configuration.SPED.uartParity, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTParityDescription());
	Serial.print(F("SpeedUARTDatte  : "));  Serial.print(configuration.SPED.uartBaudRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTBaudRate());
	Serial.print(F("SpeedAirDataRate   : "));  Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRate());

	Serial.print(F("OptionTrans        : "));  Serial.print(configuration.OPTION.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFixedTransmissionDescription());
	Serial.print(F("OptionPullup       : "));  Serial.print(configuration.OPTION.ioDriveMode, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getIODroveModeDescription());
	Serial.print(F("OptionWakeup       : "));  Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());
	Serial.print(F("OptionFEC          : "));  Serial.print(configuration.OPTION.fec, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFECDescription());
	Serial.print(F("OptionPower        : "));  Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getTransmissionPowerDescription());

	Serial.println("----------------------------------------");

}
void printModuleInformation(struct ModuleInformation moduleInformation) {
	Serial.println("----------------------------------------");
	Serial.print(F("HEAD BIN: "));  Serial.print(moduleInformation.HEAD, BIN);Serial.print(" ");Serial.print(moduleInformation.HEAD, DEC);Serial.print(" ");Serial.println(moduleInformation.HEAD, HEX);

	Serial.print(F("Freq.: "));  Serial.println(moduleInformation.frequency, HEX);
	Serial.print(F("Version  : "));  Serial.println(moduleInformation.version, HEX);
	Serial.print(F("Features : "));  Serial.println(moduleInformation.features, HEX);
	Serial.println("----------------------------------------");

}

And a receiver that manages the two types of messages:

/*
 * LoRa E32-TTL-100
 * Receive fixed transmission structure message and read first part and load the rest of structure.
 * https://mischianti.org
 *
 * E32-TTL-100----- Arduino UNO or esp8266
 * M0         ----- 3.3v (To config) GND (To send) 7 (To dinamically manage)
 * M1         ----- 3.3v (To config) GND (To send) 6 (To dinamically manage)
 * TX         ----- PIN 2 (PullUP)
 * RX         ----- PIN 3 (PullUP & Voltage divider)
 * AUX        ----- Not connected (5 if you connect)
 * VCC        ----- 3.3v/5v
 * GND        ----- GND
 *
 */
#include "Arduino.h"
#include "LoRa_E32.h"

// ---------- esp8266 pins --------------
//LoRa_E32 e32ttl(D2, D3, D5, D7, D6);
//LoRa_E32 e32ttl(D2, D3); // Config without connect AUX and M0 M1

//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(D2, D3); // e32 TX e32 RX
//LoRa_E32 e32ttl(&mySerial, D5, D7, D6);
// -------------------------------------

// ---------- Arduino pins --------------
//LoRa_E32 e32ttl(2, 3, 5, 7, 6);
LoRa_E32 e32ttl(2, 3, 4); // Config without connect AUX and M0 M1

//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(2, 3); // e32 TX e32 RX
//LoRa_E32 e32ttl(&mySerial, 5, 7, 6);
// -------------------------------------
void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
//The setup function is called once at startup of the sketch
void setup()
{
	Serial.begin(9600);
	while (!Serial) {
	    ; // wait for serial port to connect. Needed for native USB
    }
	delay(100);

	e32ttl.begin();

//	e32ttl.resetModule();
	// After set configuration comment set M0 and M1 to low
	// and reboot if you directly set HIGH M0 and M1 to program
	ResponseStructContainer c;
	c = e32ttl.getConfiguration();
	Configuration configuration = *(Configuration*) c.data;
	configuration.ADDL = 3;
	configuration.ADDH = 0;
	configuration.CHAN = 0x04;
	configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;

	e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
	printParameters(configuration);
	// ---------------------------
	Serial.println();
	Serial.println("Start listening!");
    e32ttl.setMode(MODE_2_POWER_SAVING);

}
struct Message {
    char message[8];
    byte temperature[4];
};
struct MessageHumidity {
    char message[8];
    byte humidity;
};

// The loop function is called in an endless loop
void loop()
{
	if (e32ttl.available()  > 1){
		char type[5]; // first part of structure
		ResponseContainer rs = e32ttl.receiveInitialMessage(sizeof(type));
// 		Put string in a char array (not needed)
//		memcpy ( type, rs.data.c_str(), sizeof(type) );
		String typeStr = rs.data;

		Serial.println(typeStr);
		if (typeStr=="TEMP"){
			ResponseStructContainer rsc = e32ttl.receiveMessage(sizeof(Message));
			struct Message message = *(Message*) rsc.data;

			Serial.println(*(float*)(message.temperature));
			Serial.println(message.message);
			free(rsc.data);
		}else if (typeStr == "HUM"){
			ResponseStructContainer rsc = e32ttl.receiveMessage(sizeof(MessageHumidity));
			struct MessageHumidity message = *(MessageHumidity*) rsc.data;

			Serial.println(message.humidity);
			Serial.println(message.message);
			free(rsc.data);

		}else{
			Serial.println("Something goes wrong!!");
		}
	}
}

void printParameters(struct Configuration configuration) {
	Serial.println("----------------------------------------");

	Serial.print(F("HEAD : "));  Serial.print(configuration.HEAD, BIN);Serial.print(" ");Serial.print(configuration.HEAD, DEC);Serial.print(" ");Serial.println(configuration.HEAD, HEX);
	Serial.println(F(" "));
	Serial.print(F("AddH : "));  Serial.println(configuration.ADDH, DEC);
	Serial.print(F("AddL : "));  Serial.println(configuration.ADDL, DEC);
	Serial.print(F("Chan : "));  Serial.print(configuration.CHAN, DEC); Serial.print(" -> "); Serial.println(configuration.getChannelDescription());
	Serial.println(F(" "));
	Serial.print(F("SpeedParityBit     : "));  Serial.print(configuration.SPED.uartParity, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTParityDescription());
	Serial.print(F("SpeedUARTDatte  : "));  Serial.print(configuration.SPED.uartBaudRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTBaudRate());
	Serial.print(F("SpeedAirDataRate   : "));  Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRate());

	Serial.print(F("OptionTrans        : "));  Serial.print(configuration.OPTION.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFixedTransmissionDescription());
	Serial.print(F("OptionPullup       : "));  Serial.print(configuration.OPTION.ioDriveMode, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getIODroveModeDescription());
	Serial.print(F("OptionWakeup       : "));  Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());
	Serial.print(F("OptionFEC          : "));  Serial.print(configuration.OPTION.fec, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFECDescription());
	Serial.print(F("OptionPower        : "));  Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getTransmissionPowerDescription());

	Serial.println("----------------------------------------");

}
void printModuleInformation(struct ModuleInformation moduleInformation) {
	Serial.println("----------------------------------------");
	Serial.print(F("HEAD BIN: "));  Serial.print(moduleInformation.HEAD, BIN);Serial.print(" ");Serial.print(moduleInformation.HEAD, DEC);Serial.print(" ");Serial.println(moduleInformation.HEAD, HEX);

	Serial.print(F("Freq.: "));  Serial.println(moduleInformation.frequency, HEX);
	Serial.print(F("Version  : "));  Serial.println(moduleInformation.version, HEX);
	Serial.print(F("Features : "));  Serial.println(moduleInformation.features, HEX);
	Serial.println("----------------------------------------");

}

Thanks

And this was the last part of my little tutorial.

  1. LoRa E32 device for Arduino, esp32 or esp8266: settings and basic usage
  2. LoRa E32 device for Arduino, esp32 or esp8266: library
  3. LoRa E32 device for Arduino, esp32 or esp8266: configuration
  4. LoRa E32 device for Arduino, esp32 or esp8266: fixed transmission
  5. LoRa E32 device for Arduino, esp32 or esp8266: power saving and sending structured data
  6. LoRa E32 device for Arduino, esp32 or esp8266: WOR (wake on radio) microcontroller and Arduino shield
  7. LoRa E32 device for Arduino, esp32 or esp8266: WOR (wake on radio) microcontroller and WeMos D1 shield
  8. EByte LoRa E32 device for Arduino, esp32 or esp8266: WOR (wake on radio) and new ESP32 shield
  9. Ebyte LoRa E32 with STM32: WOR (wake on radio) and new STM32 shield

Github library


Spread the love

15 Responses

  1. Udara says:

    Power cannot be set to 30dBm in1w unit,it says Power_30 not defined.Can you Please look in to this problem??

  2. Hussain says:

    LoRa seems interesting but I am hesitant to try it out as it’s a radio and government rules and legislation applies to them, I was reading somewhere that you cannot transmit continuously and probably less than few seconds only, is it true and is there some official guide somewhere which notes such rules and regulations for all countries, I am from India.

    Thanks!!

  3. Andreas says:

    Hi Renzo,

    many thanks for all of your briliant work!
    I finally got a sender and a receiver transmit structured data with the fixed transmission setup working.
    How can I add an additional sender to transmit data to the existing receiver? So that I have one receiver and two senders.
    How can I distinguish from what sender the data is comming from?

    Best regards
    Andreas

    • Hi Andreas,
      to add another sender you must only configure a sender like the other and change the ADDRESS,
      but to distinguish the sender you must add a parameter in the structure.

      You can read the first part of the structure
      ResponseContainer rs = e32ttl.receiveInitialMessage(sizeof(type));
      than process the data based on the sender.

      Bye Renzo

  4. craig stock says:

    Hi,
    Can you help with what channel value I need to use for 915 mhz version
    e.g. configuration.CHAN = 0x04; this is for the 433 mhz
    Thanks
    Craig

    • Hi craig,
      the channel is the value added to base frequency

      #ifdef FREQUENCY_433
          #define OPERATING_FREQUENCY 410
      #elif defined(FREQUENCY_170)
          #define OPERATING_FREQUENCY 130
      #elif defined(FREQUENCY_470)
          #define OPERATING_FREQUENCY 370
      #elif defined(FREQUENCY_868)
          #define OPERATING_FREQUENCY 862
      #elif defined(FREQUENCY_915)
          #define OPERATING_FREQUENCY 900
      #else
          #define OPERATING_FREQUENCY 410
      #endif
      

      Bye Renzo

  5. Rambo says:

    This keeps printing on the receiver

    Guru Meditation Error: Core 1 panic’ed (LoadProhibited). Exception was unhandled.
    Core 1 register dump:
    PC : 0x4000c2af PS : 0x00060130 A0 : 0x800d1355 A1 : 0x3ffb1f50
    A2 : 0x3ffb1f82 A3 : 0x00000000 A4 : 0x00000006 A5 : 0x3ffb1f82
    A6 : 0x00002580 A7 : 0x0800001c A8 : 0x00000000 A9 : 0x00000000
    A10 : 0x00000009 A11 : 0x00000003 A12 : 0x0800001c A13 : 0x00000010
    A14 : 0x00000011 A15 : 0x00000000 SAR : 0x0000000a EXCCAUSE: 0x0000001c
    EXCVADDR: 0x00000000 LBEG : 0x00000000 LEND : 0x00000000 LCOUNT : 0x00000000

  6. Tony says:

    Hello Renzo .Thanks for your great job. I’m new to programming and am getting an error when compiling exemple code for resiver –

    - ": error: 'Message' was not declared in this scope
       96 |         ResponseStructContainer rsc = e32ttl.receiveMessage(sizeof(Message));
    
     error: expected primary-expression before ')' token
       97 |         struct Message message = *(Message*) rsc.data;
          |                                            ^
          |                                                                    ^~~~~~~ " .
    

    and etc.
    What does it mean? I am just copy your code for resiver ( with my pin configuration ) and getting this error.

  7. Fabrizio says:

    Hi Renzo. Thanks for sharing your job. Could you help me with the LoRa_E32 e32ttl for the esp32?

    • Hi Fabrizio,
      sure, write a topic on the forum with all the information and your code and we try to help you.
      Bye Renzo

      • Fabrizio says:

        Hi renzo,
        I’m using an esp32 in wake up mode and an arduino nano in power saving mode. I’m having problems with the comunication between them so i don’t know if it is a wiring or coding problem because i’m using the connections you gave for esp32 and arduino uno. Here is the code i’m using:

        sender:

        // ---------- esp32 pins --------------
        LoRa_E32 e32ttl(&Serial2, 18, 21, 19); //  RX AUX M0 M1
        e32ttl.begin();
            ResponseStructContainer c;
            c = e32ttl.getConfiguration();
            Configuration configuration = *(Configuration*) c.data;
            configuration.ADDL = 0x01;
            configuration.ADDH = 0x00;
            configuration.CHAN = 0x02;
            configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;
            e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
            printParameters(configuration);
        

        reciever:

        // ---------- Arduino pins --------------
        //LoRa_E32 e32ttl(2, 3, 5, 7, 6);
        LoRa_E32 e32ttl(2, 3); // Config without connect AUX and M0 M1
        
        e32ttl.begin();
         
        //  e32ttl.resetModule();
            // After set configuration comment set M0 and M1 to low
            // and reboot if you directly set HIGH M0 and M1 to program
            ResponseStructContainer c;
            c = e32ttl.getConfiguration();
            Configuration configuration = *(Configuration*) c.data;
            configuration.ADDL = 3;
            configuration.ADDH = 0;
            configuration.CHAN = 0x04;
            configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;
         
            e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
            printParameters(configuration);
            // ---------------------------
            Serial.println();
            Serial.println("Start listening!");
            e32ttl.setMode(MODE_2_POWER_SAVING);
        

Leave a Reply to craig stock Cancel reply

Your email address will not be published. Required fields are marked *