Ebyte LoRa E22 device for Arduino, esp32 or esp8266: configuration – 3
LoRa or Long Range wireless data telemetry is a technology pioneered by Semtech that operates at a lower frequency than NRF24L01 (433 MHz, 868 MHz, or 916 MHz against 2.4 GHz for the NRF24L01) but at thrice the distance (from 4000m to 10000m).
Now we try to examine better how to configure the Ebyte E22 UART LoRa device based on SX1262/SX1268 Wireless Modules.
You can find here AliExpress (433MHz 5.5Km) - AliExpress (433MHz 10Km) - AliExpress (868MHz 915Mhz 5.5Km) - AliExpress (868MHz 915Mhz 10Km)
I created this library to manage EBYTE E22 especially to simplify the configuration process because can be very tedious.
If you have device freezing problems, you must put a pull-up 4.7k resistor or better connect to the device AUX pin.
Library
You can find my library here, and It’s available on Arduino IDE library manager.
To download.
Click the DOWNLOADS button in the top right corner, rename the uncompressed folder LoRa_E22.
Check that the LoRa_E22 folder contains LoRa_E22.cpp and LoRa_E22.h.
Place the LoRa_E22 library folder in your /libraries/ folder.
You may need to create the libraries subfolder if it’s your first library.
Restart the IDE.
Connection schemas for programming
For the basic usage, we had used a specified configuration for Arduino. Still, you are working only in “Normal mode” in that configuration. Now we will manage only the needed pins dynamic (RX, TX) to simplify the programming process and the others in a static way.
Mode | M1 | M0 | Explanation |
---|---|---|---|
Normal | 0 | 0 | UART and wireless channel are open, transparent transmission is on (Supports configuration over air via special command) |
WOR Mode | 0 | 1 | Can be defined as WOR transmitter and WOR receiver |
Configuration mode | 1 | 0 | Users can access the register through the serial port to control the working state of the module |
Deep sleep mode | 1 | 1 | Sleep mode |
Normal configuration (transparent)
M0 | GND (Set normal mode) |
M1 | GND (Set normal mode) |
TX | PIN 2 (PullUP 4,7KΩ) |
RX | PIN 3 (PullUP 4,7KΩ & Voltage divider) |
AUX | Not connected |
VCC | 5v |
GND | GND |
and this configuration for Wemos D1 mini:
M0 | GND (Set normal mode) |
M1 | GND (Set normal mode) |
TX | PIN D2 (PullUP 4,7KΩ) |
RX | PIN D3 (PullUP 4,7KΩ) |
AUX | Not connected |
VCC | 3.3v/5v |
GND | GND |
ESP-32:
M0 | GND (Set normal mode) |
M1 | GND (Set normal mode) |
RX | TX2 (PullUP 4,7KΩ) |
TX | RX2 (PullUP 4,7KΩ) |
AUX | Not connected (PullUP 4,7KΩ) |
VCC | 3.3v/5v |
GND | GND |
Arduino MKR WiFi 1010:
M0 | GND (Set normal mode) |
M1 | GND (Set normal mode) |
TX | PIN 14 Tx (PullUP 4,7KΩ) |
RX | PIN 13 Rx (PullUP 4,7KΩ) |
AUX | Not connected (PullUP 4,7KΩ) |
VCC | 3.3v/5v |
GND | GND |
Wiring for programming/sleep mode
To configure It, you must set M0 to GND and M1 to high (remember to use 3.3v).
But If you connect all pins, the library sets HIGH or LOW the pins as needed without a problem.
M0 | GND (Set programming/sleep mode) |
M1 | VCC (Set programming/sleep mode) |
TX | PIN D2 (PullUP 4,7KΩ) |
RX | PIN D3 (PullUP 4,7KΩ) |
AUX | Not connected |
VCC | 3.3v/5v |
GND | GND |
M0 | GND (Set programming/sleep mode) |
M1 | 3.3v (Set programming/sleep mode) |
TX | PIN 2 (PullUP 4,7KΩ) |
TX | PIN 3 (PullUP 4,7KΩ & Voltage divider) |
AUX | Not connected |
VCC | 5v |
GND | GND |
M0 | GND (Set programming/sleep mode) |
M1 | 3.3v (Set programming/sleep mode) |
RX | TX2 (PullUP 4,7KΩ) |
TX | RX2 (PullUP 4,7KΩ) |
AUX | Not connected |
VCC | 3.3v/5v |
GND | GND |
M0 | GND (Set programming/sleep mode) |
M1 | 3.3v (Set programming/sleep mode) |
TX | PIN 14 Tx (PullUP 4,7KΩ) |
RX | PIN 13 Rx (PullUP 4,7KΩ) |
AUX | Not connected (PullUP 4,7KΩ) |
VCC | 3.3v/5v |
GND | GND |
In this mode, you can manage the configuration of the device
Basic configuration option
Name | Description | Address |
---|---|---|
ADDH | High address byte of the module (the default 00H) | 00H |
ADDL | Low address byte of the module (the default 00H) | 01H |
NETID | Network address, used to distinguish the network. | 02H |
SPED | Information about data rate parity bit and Air data rate | 03H |
OPTION | Type of transmission, pull-up settings, wake-up time, FEC, Transmission power | 04H |
CHAN | Communication channel(410M + CHAN*1M), default 17H (433MHz), valid only for 433MHz device | 05H |
TRANSMISSION_MODE | All transmission parameters | 06H |
CRTYPT_H | User encryption | 07H |
CRTYPT_L | User encryption | 08H |
You can find configuration options in the Library article.
Get configuration
Arduino example sketch
/*
* EByte LoRa E22
* Get configuration.
* https://mischianti.org
*
* E22 ----- Arduino
* M0 ----- 7 (or GND)
* M1 ----- 6 (or HIGH)
* RX ----- 4 (PullUP)
* TX ----- 5 (PullUP)
* AUX ----- 3 (PullUP)
* VCC ----- 3.3v/5v
* GND ----- GND
*
*/
#include "Arduino.h"
#include "LoRa_E22.h"
// ---------- esp8266 pins --------------
//LoRa_E22 e22ttl(RX, TX, AUX, M0, M1); // Arduino RX <-- e22 TX, Arduino TX --> e22 RX
//LoRa_E22 e22ttl(D3, D4, D5, D7, D6); // Arduino RX <-- e22 TX, Arduino TX --> e22 RX AUX M0 M1
//LoRa_E22 e22ttl(D2, D3); // Config without connect AUX and M0 M1
//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(D2, D3); // Arduino RX <-- e22 TX, Arduino TX --> e22 RX
//LoRa_E22 e22ttl(&mySerial, D5, D7, D6); // AUX M0 M1
// -------------------------------------
// ---------- Arduino pins --------------
LoRa_E22 e22ttl(4, 5, 3, 7, 6); // Arduino RX <-- e22 TX, Arduino TX --> e22 RX AUX M0 M1
//LoRa_E22 e22ttl(4, 5); // Config without connect AUX and M0 M1
//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(4, 5); // Arduino RX <-- e22 TX, Arduino TX --> e22 RX
//LoRa_E22 e22ttl(&mySerial, 3, 7, 6); // AUX M0 M1
// -------------------------------------
// ------------- Arduino MKR WiFi 1010 -------------
// LoRa_E220 e22ttl(&Serial1, 2, 4, 6); // RX AUX M0 M1
// -------------------------------------------------
// ---------- esp32 pins --------------
//LoRa_E22 e22ttl(&Serial2, 18, 21, 19); // RX AUX M0 M1
//LoRa_E22 e22ttl(&Serial2, 22, 4, 18, 21, 19, UART_BPS_RATE_9600); // esp32 RX <-- e22 TX, esp32 TX --> e22 RX AUX M0 M1
// -------------------------------------
void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
void setup() {
Serial.begin(9600);
while(!Serial){};
delay(500);
Serial.println();
// Startup all pins and UART
e22ttl.begin();
ResponseStructContainer c;
c = e22ttl.getConfiguration();
// It's important get configuration pointer before all other operation
Configuration configuration = *(Configuration*) c.data;
Serial.println(c.status.getResponseDescription());
Serial.println(c.status.code);
printParameters(configuration);
ResponseStructContainer cMi;
cMi = e22ttl.getModuleInformation();
// It's important get information pointer before all other operation
ModuleInformation mi = *(ModuleInformation*)cMi.data;
Serial.println(cMi.status.getResponseDescription());
Serial.println(cMi.status.code);
printModuleInformation(mi);
}
void loop() {
}
void printParameters(struct Configuration configuration) {
Serial.println("----------------------------------------");
Serial.print(F("HEAD : ")); Serial.print(configuration.COMMAND, HEX);Serial.print(" ");Serial.print(configuration.STARTING_ADDRESS, HEX);Serial.print(" ");Serial.println(configuration.LENGHT, HEX);
Serial.println(F(" "));
Serial.print(F("AddH : ")); Serial.println(configuration.ADDH, HEX);
Serial.print(F("AddL : ")); Serial.println(configuration.ADDL, HEX);
Serial.print(F("NetID : ")); Serial.println(configuration.NETID, HEX);
Serial.println(F(" "));
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.getUARTBaudRateDescription());
Serial.print(F("SpeedAirDataRate : ")); Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRateDescription());
Serial.println(F(" "));
Serial.print(F("OptionSubPacketSett: ")); Serial.print(configuration.OPTION.subPacketSetting, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getSubPacketSetting());
Serial.print(F("OptionTranPower : ")); Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getTransmissionPowerDescription());
Serial.print(F("OptionRSSIAmbientNo: ")); Serial.print(configuration.OPTION.RSSIAmbientNoise, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getRSSIAmbientNoiseEnable());
Serial.println(F(" "));
Serial.print(F("TransModeWORPeriod : ")); Serial.print(configuration.TRANSMISSION_MODE.WORPeriod, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getWORPeriodByParamsDescription());
Serial.print(F("TransModeTransContr: ")); Serial.print(configuration.TRANSMISSION_MODE.WORTransceiverControl, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getWORTransceiverControlDescription());
Serial.print(F("TransModeEnableLBT : ")); Serial.print(configuration.TRANSMISSION_MODE.enableLBT, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getLBTEnableByteDescription());
Serial.print(F("TransModeEnableRSSI: ")); Serial.print(configuration.TRANSMISSION_MODE.enableRSSI, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getRSSIEnableByteDescription());
Serial.print(F("TransModeEnabRepeat: ")); Serial.print(configuration.TRANSMISSION_MODE.enableRepeater, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getRepeaterModeEnableByteDescription());
Serial.print(F("TransModeFixedTrans: ")); Serial.print(configuration.TRANSMISSION_MODE.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getFixedTransmissionDescription());
Serial.println("----------------------------------------");
}
void printModuleInformation(struct ModuleInformation moduleInformation) {
Serial.println("----------------------------------------");
Serial.print(F("HEAD: ")); Serial.print(moduleInformation.COMMAND, HEX);Serial.print(" ");Serial.print(moduleInformation.STARTING_ADDRESS, HEX);Serial.print(" ");Serial.println(moduleInformation.LENGHT, DEC);
Serial.print(F("Model no.: ")); Serial.println(moduleInformation.model, HEX);
Serial.print(F("Version : ")); Serial.println(moduleInformation.version, HEX);
Serial.print(F("Features : ")); Serial.println(moduleInformation.features, HEX);
Serial.println("----------------------------------------");
}
Here is the result of the sketch
Success
1
----------------------------------------
HEAD : C1 0 9
AddH : 0
AddL : 3
NetID : 0
Chan : 23 -> 433MHz
SpeedParityBit : 0 -> 8N1 (Default)
SpeedUARTDatte : 11 -> 9600bps (default)
SpeedAirDataRate : 10 -> 2.4kbps (default)
OptionSubPacketSett: 0 -> 240bytes (default)
OptionTranPower : 0 -> 22dBm (Default)
OptionRSSIAmbientNo: 0 -> Disabled (default)
TransModeWORPeriod : 0 -> 500ms
TransModeTransContr: 0 -> WOR Receiver (default)
TransModeEnableLBT : 0 -> Disabled (default)
TransModeEnableRSSI: 0 -> Disabled (default)
TransModeEnabRepeat: 0 -> Disabled (default)
TransModeFixedTrans: 1 -> Fixed transmission (first three bytes can be used as high/low address and channel)
----------------------------------------
Success
1
----------------------------------------
HEAD: C1 80 7
Model no.: 16
Version : A
Features : 0
----------------------------------------
As you can see, I add a lot of constructors for every device, if you change the first configuration you can switch the device with the same code.
To get the correct information, I add some #define to change the device type (same #define
manage more other devices, I create only one for type for simplicity).
#define E22_22
#define E22_30
You can select only one of them. The parameter changes the Transmission power constant as described in the configuration schema.
In the same manner, you can select one reference frequences
#define FREQUENCY_433
#define FREQUENCY_170
#define FREQUENCY_470
#define FREQUENCY_868
#define FREQUENCY_915
You can choose only one of them. The parameter changes the reference frequencies only for display purposes,
Set configuration
Naturally, when you have a configuration you want to change It for your purpose, I think you can get the configuration from a device, modify what you want and set It.
But in the example sketch, I add a set of configuration commented, you can uncomment the config you want, and in the other examples in the library, there is a reference to the relative configuration to apply.
Ricorda che il parametro saveType è fondamentale per mantenere le opzioni al riavvio del dispositivo, WRITE_CFG_PWR_DWN_LOSE naturalmente perderai le impostazioni con WRITE_CFG_PWR_DWN_SAVE non perderai le impostazioni.
Here is an Arduino Nano 33 IoT sketch:
/*
* LoRa E22-TTL-100
* Get configuration.
* https://mischianti.org
*
* E22 ----- Arduino Nano 33 IoT
* M0 ----- 4 (or GND)
* M1 ----- 6 (or HIGH)
* RX ----- TX (PullUP)
* TX ----- RX (PullUP)
* AUX ----- 2 (PullUP)
* VCC ----- 3.3v/5v
* GND ----- GND
*
*/
#include "Arduino.h"
#include "LoRa_E22.h"
// ---------- esp8266 pins --------------
//LoRa_E22 e22ttl(RX, TX, AUX, M0, M1); // Arduino RX <-- e22 TX, Arduino TX --> e22 RX
//LoRa_E22 e22ttl(D3, D4, D5, D7, D6); // Arduino RX <-- e22 TX, Arduino TX --> e22 RX AUX M0 M1
//LoRa_E22 e22ttl(D2, D3); // Config without connect AUX and M0 M1
//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(D2, D3); // Arduino RX <-- e22 TX, Arduino TX --> e22 RX
//LoRa_E22 e22ttl(&mySerial, D5, D7, D6); // AUX M0 M1
// -------------------------------------
// ---------- Arduino pins --------------
// LoRa_E22 e22ttl(4, 5, 3, 7, 6); // Arduino RX <-- e22 TX, Arduino TX --> e22 RX AUX M0 M1
//LoRa_E22 e22ttl(4, 5); // Config without connect AUX and M0 M1
//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(4, 5); // Arduino RX <-- e22 TX, Arduino TX --> e22 RX
//LoRa_E22 e22ttl(&mySerial, 3, 7, 6); // AUX M0 M1
// -------------------------------------
// ------------- Arduino Nano 33 IoT -------------
LoRa_E22 e22ttl(&Serial1, 2, 4, 6); // RX AUX M0 M1
// -------------------------------------------------
// ------------- Arduino MKR WiFi 1010 -------------
// LoRa_E22 e22ttl(&Serial1, 2, 4, 6); // RX AUX M0 M1
// -------------------------------------------------
// ---------- esp32 pins --------------
//LoRa_E22 e22ttl(&Serial2, 18, 21, 19); // RX AUX M0 M1
//LoRa_E22 e22ttl(&Serial2, 22, 4, 18, 21, 19, UART_BPS_RATE_9600); // esp32 RX <-- e22 TX, esp32 TX --> e22 RX AUX M0 M1
// -------------------------------------
void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
void setup() {
Serial.begin(9600);
while(!Serial){};
delay(500);
Serial.println();
// Startup all pins and UART
e22ttl.begin();
ResponseStructContainer c;
c = e22ttl.getConfiguration();
// It's important get configuration pointer before all other operation
Configuration configuration = *(Configuration*) c.data;
Serial.println(c.status.getResponseDescription());
Serial.println(c.status.code);
printParameters(configuration);
configuration.ADDL = 0x03;
configuration.ADDH = 0x00;
configuration.NETID = 0x00;
configuration.CHAN = 23;
// ----------------------- DEFAULT TRANSPARENT -----------------------
configuration.ADDL = 0x03;
configuration.ADDH = 0x00;
configuration.NETID = 0x00;
configuration.CHAN = 23;
configuration.SPED.uartBaudRate = UART_BPS_9600;
configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
configuration.SPED.uartParity = MODE_00_8N1;
configuration.OPTION.subPacketSetting = SPS_240_00;
configuration.OPTION.RSSIAmbientNoise = RSSI_AMBIENT_NOISE_DISABLED;
configuration.OPTION.transmissionPower = POWER_22;
configuration.TRANSMISSION_MODE.enableRSSI = RSSI_DISABLED;
configuration.TRANSMISSION_MODE.fixedTransmission = FT_TRANSPARENT_TRANSMISSION;
configuration.TRANSMISSION_MODE.enableRepeater = REPEATER_DISABLED;
configuration.TRANSMISSION_MODE.enableLBT = LBT_DISABLED;
configuration.TRANSMISSION_MODE.WORTransceiverControl = WOR_RECEIVER;
configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
// ----------------------- DEFAULT TRANSPARENT WITH RSSI -----------------------
// configuration.ADDL = 0x03;
// configuration.ADDH = 0x00;
// configuration.NETID = 0x00;
//
// configuration.CHAN = 23;
//
// configuration.SPED.uartBaudRate = UART_BPS_9600;
// configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
// configuration.SPED.uartParity = MODE_00_8N1;
//
// configuration.OPTION.subPacketSetting = SPS_240_00;
// configuration.OPTION.RSSIAmbientNoise = RSSI_AMBIENT_NOISE_DISABLED;
// configuration.OPTION.transmissionPower = POWER_22;
//
// configuration.TRANSMISSION_MODE.enableRSSI = RSSI_ENABLED;
// configuration.TRANSMISSION_MODE.fixedTransmission = FT_TRANSPARENT_TRANSMISSION;
// configuration.TRANSMISSION_MODE.enableRepeater = REPEATER_DISABLED;
// configuration.TRANSMISSION_MODE.enableLBT = LBT_DISABLED;
// configuration.TRANSMISSION_MODE.WORTransceiverControl = WOR_RECEIVER;
// configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
// ----------------------- FIXED SENDER -----------------------
// configuration.ADDL = 0x02;
// configuration.ADDH = 0x00;
// configuration.NETID = 0x00;
//
// configuration.CHAN = 23;
//
// configuration.SPED.uartBaudRate = UART_BPS_9600;
// configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
// configuration.SPED.uartParity = MODE_00_8N1;
//
// configuration.OPTION.subPacketSetting = SPS_240_00;
// configuration.OPTION.RSSIAmbientNoise = RSSI_AMBIENT_NOISE_DISABLED;
// configuration.OPTION.transmissionPower = POWER_22;
//
// configuration.TRANSMISSION_MODE.enableRSSI = RSSI_DISABLED;
// configuration.TRANSMISSION_MODE.fixedTransmission = FT_FIXED_TRANSMISSION;
// configuration.TRANSMISSION_MODE.enableRepeater = REPEATER_DISABLED;
// configuration.TRANSMISSION_MODE.enableLBT = LBT_DISABLED;
// configuration.TRANSMISSION_MODE.WORTransceiverControl = WOR_TRANSMITTER;
// configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
//
// ----------------------- FIXED RECEIVER -----------------------
// configuration.ADDL = 0x03;
// configuration.ADDH = 0x00;
// configuration.NETID = 0x00;
//
// configuration.CHAN = 23;
//
// configuration.SPED.uartBaudRate = UART_BPS_9600;
// configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
// configuration.SPED.uartParity = MODE_00_8N1;
//
// configuration.OPTION.subPacketSetting = SPS_240_00;
// configuration.OPTION.RSSIAmbientNoise = RSSI_AMBIENT_NOISE_DISABLED;
// configuration.OPTION.transmissionPower = POWER_22;
//
// configuration.TRANSMISSION_MODE.enableRSSI = RSSI_DISABLED;
// configuration.TRANSMISSION_MODE.fixedTransmission = FT_FIXED_TRANSMISSION;
// configuration.TRANSMISSION_MODE.enableRepeater = REPEATER_DISABLED;
// configuration.TRANSMISSION_MODE.enableLBT = LBT_DISABLED;
// configuration.TRANSMISSION_MODE.WORTransceiverControl = WOR_RECEIVER;
// configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
// ----------------------- FIXED SENDER RSSI -----------------------
// configuration.ADDL = 0x02;
// configuration.ADDH = 0x00;
// configuration.NETID = 0x00;
//
// configuration.CHAN = 23;
//
// configuration.SPED.uartBaudRate = UART_BPS_9600;
// configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
// configuration.SPED.uartParity = MODE_00_8N1;
//
// configuration.OPTION.subPacketSetting = SPS_240_00;
// configuration.OPTION.RSSIAmbientNoise = RSSI_AMBIENT_NOISE_DISABLED;
// configuration.OPTION.transmissionPower = POWER_22;
//
// configuration.TRANSMISSION_MODE.enableRSSI = RSSI_ENABLED;
// configuration.TRANSMISSION_MODE.fixedTransmission = FT_FIXED_TRANSMISSION;
// configuration.TRANSMISSION_MODE.enableRepeater = REPEATER_DISABLED;
// configuration.TRANSMISSION_MODE.enableLBT = LBT_DISABLED;
// configuration.TRANSMISSION_MODE.WORTransceiverControl = WOR_TRANSMITTER;
// configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
//
// ----------------------- FIXED RECEIVER RSSI -----------------------
// configuration.ADDL = 0x03;
// configuration.ADDH = 0x00;
// configuration.NETID = 0x00;
//
// configuration.CHAN = 23;
//
// configuration.SPED.uartBaudRate = UART_BPS_9600;
// configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
// configuration.SPED.uartParity = MODE_00_8N1;
//
// configuration.OPTION.subPacketSetting = SPS_240_00;
// configuration.OPTION.RSSIAmbientNoise = RSSI_AMBIENT_NOISE_DISABLED;
// configuration.OPTION.transmissionPower = POWER_22;
//
// configuration.TRANSMISSION_MODE.enableRSSI = RSSI_ENABLED;
// configuration.TRANSMISSION_MODE.fixedTransmission = FT_FIXED_TRANSMISSION;
// configuration.TRANSMISSION_MODE.enableRepeater = REPEATER_DISABLED;
// configuration.TRANSMISSION_MODE.enableLBT = LBT_DISABLED;
// configuration.TRANSMISSION_MODE.WORTransceiverControl = WOR_RECEIVER;
// configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
// ----------------------- WOR SENDER -----------------------
// configuration.ADDL = 0x02;
// configuration.ADDH = 0x00;
// configuration.NETID = 0x00;
//
// configuration.CHAN = 23;
//
// configuration.SPED.uartBaudRate = UART_BPS_9600;
// configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
// configuration.SPED.uartParity = MODE_00_8N1;
//
// configuration.OPTION.subPacketSetting = SPS_240_00;
// configuration.OPTION.RSSIAmbientNoise = RSSI_AMBIENT_NOISE_DISABLED;
// configuration.OPTION.transmissionPower = POWER_22;
//
// configuration.TRANSMISSION_MODE.enableRSSI = RSSI_DISABLED;
// configuration.TRANSMISSION_MODE.fixedTransmission = FT_FIXED_TRANSMISSION;
// configuration.TRANSMISSION_MODE.enableRepeater = REPEATER_DISABLED;
// configuration.TRANSMISSION_MODE.enableLBT = LBT_DISABLED;
// configuration.TRANSMISSION_MODE.WORTransceiverControl = WOR_TRANSMITTER;
// configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
//
// ----------------------- WOR RECEIVER -----------------------
// configuration.ADDL = 0x03;
// configuration.ADDH = 0x00;
// configuration.NETID = 0x00;
//
// configuration.CHAN = 23;
//
// configuration.SPED.uartBaudRate = UART_BPS_9600;
// configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
// configuration.SPED.uartParity = MODE_00_8N1;
//
// configuration.OPTION.subPacketSetting = SPS_240_00;
// configuration.OPTION.RSSIAmbientNoise = RSSI_AMBIENT_NOISE_DISABLED;
// configuration.OPTION.transmissionPower = POWER_22;
//
// configuration.TRANSMISSION_MODE.enableRSSI = RSSI_DISABLED;
// configuration.TRANSMISSION_MODE.fixedTransmission = FT_FIXED_TRANSMISSION;
// configuration.TRANSMISSION_MODE.enableRepeater = REPEATER_DISABLED;
// configuration.TRANSMISSION_MODE.enableLBT = LBT_DISABLED;
// configuration.TRANSMISSION_MODE.WORTransceiverControl = WOR_RECEIVER;
// configuration.TRANSMISSION_MODE.WORPeriod = WOR_500_000;
// ----------------------- BROADCAST MESSAGE 1 -----------------------
// configuration.ADDL = 0x04;
// configuration.ADDH = 0x00;
// configuration.NETID = 0x00;
//
// configuration.CHAN = 23;
//
// configuration.SPED.uartBaudRate = UART_BPS_9600;
// configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
// configuration.SPED.uartParity = MODE_00_8N1;
//
// configuration.OPTION.subPacketSetting = SPS_240_00;
// configuration.OPTION.RSSIAmbientNoise = RSSI_AMBIENT_NOISE_DISABLED;
// configuration.OPTION.transmissionPower = POWER_22;
//
// configuration.TRANSMISSION_MODE.enableRSSI = RSSI_DISABLED;
// configuration.TRANSMISSION_MODE.fixedTransmission = FT_FIXED_TRANSMISSION;
// configuration.TRANSMISSION_MODE.enableRepeater = REPEATER_DISABLED;
// configuration.TRANSMISSION_MODE.enableLBT = LBT_DISABLED;
// configuration.TRANSMISSION_MODE.WORTransceiverControl = WOR_RECEIVER;
// configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
// ----------------------- BROADCAST MESSAGE 2 -----------------------
// configuration.ADDL = 0x05;
// configuration.ADDH = 0x00;
// configuration.NETID = 0x00;
//
// configuration.CHAN = 23;
//
// configuration.SPED.uartBaudRate = UART_BPS_9600;
// configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
// configuration.SPED.uartParity = MODE_00_8N1;
//
// configuration.OPTION.subPacketSetting = SPS_240_00;
// configuration.OPTION.RSSIAmbientNoise = RSSI_AMBIENT_NOISE_DISABLED;
// configuration.OPTION.transmissionPower = POWER_22;
//
// configuration.TRANSMISSION_MODE.enableRSSI = RSSI_DISABLED;
// configuration.TRANSMISSION_MODE.fixedTransmission = FT_FIXED_TRANSMISSION;
// configuration.TRANSMISSION_MODE.enableRepeater = REPEATER_DISABLED;
// configuration.TRANSMISSION_MODE.enableLBT = LBT_DISABLED;
// configuration.TRANSMISSION_MODE.WORTransceiverControl = WOR_RECEIVER;
// configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
// ----------------------- BROADCAST MESSAGE 3 -----------------------
// configuration.ADDL = 0x06;
// configuration.ADDH = 0x00;
// configuration.NETID = 0x00;
//
// configuration.CHAN = 23;
//
// configuration.SPED.uartBaudRate = UART_BPS_9600;
// configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
// configuration.SPED.uartParity = MODE_00_8N1;
//
// configuration.OPTION.subPacketSetting = SPS_240_00;
// configuration.OPTION.RSSIAmbientNoise = RSSI_AMBIENT_NOISE_DISABLED;
// configuration.OPTION.transmissionPower = POWER_22;
//
// configuration.TRANSMISSION_MODE.enableRSSI = RSSI_DISABLED;
// configuration.TRANSMISSION_MODE.fixedTransmission = FT_FIXED_TRANSMISSION;
// configuration.TRANSMISSION_MODE.enableRepeater = REPEATER_DISABLED;
// configuration.TRANSMISSION_MODE.enableLBT = LBT_DISABLED;
// configuration.TRANSMISSION_MODE.WORTransceiverControl = WOR_RECEIVER;
// configuration.TRANSMISSION_MODE.WORPeriod = WOR_2000_011;
// Set configuration changed and set to not hold the configuration
ResponseStatus rs = e22ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
Serial.println(rs.getResponseDescription());
Serial.println(rs.code);
c = e22ttl.getConfiguration();
// It's important get configuration pointer before all other operation
configuration = *(Configuration*) c.data;
Serial.println(c.status.getResponseDescription());
Serial.println(c.status.code);
printParameters(configuration);
}
void loop() {
}
void printParameters(struct Configuration configuration) {
Serial.println("----------------------------------------");
Serial.print(F("HEAD : ")); Serial.print(configuration.COMMAND, HEX);Serial.print(" ");Serial.print(configuration.STARTING_ADDRESS, HEX);Serial.print(" ");Serial.println(configuration.LENGHT, HEX);
Serial.println(F(" "));
Serial.print(F("AddH : ")); Serial.println(configuration.ADDH, HEX);
Serial.print(F("AddL : ")); Serial.println(configuration.ADDL, HEX);
Serial.print(F("NetID : ")); Serial.println(configuration.NETID, HEX);
Serial.println(F(" "));
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.getUARTBaudRateDescription());
Serial.print(F("SpeedAirDataRate : ")); Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRateDescription());
Serial.println(F(" "));
Serial.print(F("OptionSubPacketSett: ")); Serial.print(configuration.OPTION.subPacketSetting, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getSubPacketSetting());
Serial.print(F("OptionTranPower : ")); Serial.print(configuration.OPTION.transmissionPower, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getTransmissionPowerDescription());
Serial.print(F("OptionRSSIAmbientNo: ")); Serial.print(configuration.OPTION.RSSIAmbientNoise, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getRSSIAmbientNoiseEnable());
Serial.println(F(" "));
Serial.print(F("TransModeWORPeriod : ")); Serial.print(configuration.TRANSMISSION_MODE.WORPeriod, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getWORPeriodByParamsDescription());
Serial.print(F("TransModeTransContr: ")); Serial.print(configuration.TRANSMISSION_MODE.WORTransceiverControl, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getWORTransceiverControlDescription());
Serial.print(F("TransModeEnableLBT : ")); Serial.print(configuration.TRANSMISSION_MODE.enableLBT, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getLBTEnableByteDescription());
Serial.print(F("TransModeEnableRSSI: ")); Serial.print(configuration.TRANSMISSION_MODE.enableRSSI, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getRSSIEnableByteDescription());
Serial.print(F("TransModeEnabRepeat: ")); Serial.print(configuration.TRANSMISSION_MODE.enableRepeater, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getRepeaterModeEnableByteDescription());
Serial.print(F("TransModeFixedTrans: ")); Serial.print(configuration.TRANSMISSION_MODE.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.TRANSMISSION_MODE.getFixedTransmissionDescription());
Serial.println("----------------------------------------");
}
void printModuleInformation(struct ModuleInformation moduleInformation) {
Serial.println("----------------------------------------");
Serial.print(F("HEAD: ")); Serial.print(moduleInformation.COMMAND, HEX);Serial.print(" ");Serial.print(moduleInformation.STARTING_ADDRESS, HEX);Serial.print(" ");Serial.println(moduleInformation.LENGHT, DEC);
Serial.print(F("Model no.: ")); Serial.println(moduleInformation.model, HEX);
Serial.print(F("Version : ")); Serial.println(moduleInformation.version, HEX);
Serial.print(F("Features : ")); Serial.println(moduleInformation.features, HEX);
Serial.println("----------------------------------------");
}
Here is the result on the console
Connetti alla porta seriale COM19 a 115200
Success
1
----------------------------------------
HEAD : C1 0 9
AddH : 0
AddL : 3
NetID : 0
Chan : 23 -> 433MHz
SpeedParityBit : 0 -> 8N1 (Default)
SpeedUARTDatte : 11 -> 9600bps (default)
SpeedAirDataRate : 10 -> 2.4kbps (default)
OptionSubPacketSett: 0 -> 240bytes (default)
OptionTranPower : 0 -> 22dBm (Default)
OptionRSSIAmbientNo: 0 -> Disabled (default)
TransModeWORPeriod : 0 -> 500ms
TransModeTransContr: 0 -> WOR Receiver (default)
TransModeEnableLBT : 0 -> Disabled (default)
TransModeEnableRSSI: 0 -> Disabled (default)
TransModeEnabRepeat: 0 -> Disabled (default)
TransModeFixedTrans: 1 -> Fixed transmission (first three bytes can be used as high/low address and channel)
----------------------------------------
Success
1
----------------------------------------
HEAD: C1 80 7
Model no.: 16
Version : A
Features : 0
----------------------------------------
Connetti alla porta seriale COM19 a 115200
Success
1
----------------------------------------
HEAD : C1 0 9
AddH : 0
AddL : 3
NetID : 0
Chan : 23 -> 433MHz
SpeedParityBit : 0 -> 8N1 (Default)
SpeedUARTDatte : 11 -> 9600bps (default)
SpeedAirDataRate : 10 -> 2.4kbps (default)
OptionSubPacketSett: 0 -> 240bytes (default)
OptionTranPower : 0 -> 22dBm (Default)
OptionRSSIAmbientNo: 0 -> Disabled (default)
TransModeWORPeriod : 0 -> 500ms
TransModeTransContr: 0 -> WOR Receiver (default)
TransModeEnableLBT : 0 -> Disabled (default)
TransModeEnableRSSI: 0 -> Disabled (default)
TransModeEnabRepeat: 0 -> Disabled (default)
TransModeFixedTrans: 1 -> Fixed transmission (first three bytes can be used as high/low address and channel)
----------------------------------------
Success
1
Success
1
----------------------------------------
HEAD : C1 0 9
AddH : 0
AddL : 3
NetID : 0
Chan : 23 -> 433MHz
SpeedParityBit : 0 -> 8N1 (Default)
SpeedUARTDatte : 11 -> 9600bps (default)
SpeedAirDataRate : 10 -> 2.4kbps (default)
OptionSubPacketSett: 0 -> 240bytes (default)
OptionTranPower : 0 -> 22dBm (Default)
OptionRSSIAmbientNo: 0 -> Disabled (default)
TransModeWORPeriod : 11 -> 2000ms (default)
TransModeTransContr: 0 -> WOR Receiver (default)
TransModeEnableLBT : 0 -> Disabled (default)
TransModeEnableRSSI: 0 -> Disabled (default)
TransModeEnabRepeat: 0 -> Disabled (default)
TransModeFixedTrans: 0 -> Transparent transmission (default)
----------------------------------------
The library is quite simple, but in the next chapter, we will test various device options.
Thanks
- Ebyte LoRa E22 device for Arduino, esp32 or esp8266: settings and basic usage
- Ebyte LoRa E22 device for Arduino, esp32 or esp8266: library
- Ebyte LoRa E22 device for Arduino, esp32 or esp8266: configuration
- Ebyte LoRa E22 device for Arduino, esp32 or esp8266: fixed transmission, broadcast, monitor, and RSSI
- Ebyte LoRa E22 device for Arduino, esp32 or esp8266: power-saving and sending structured data
- Ebyte LoRa E22 device for Arduino, esp32 or esp8266: repeater mode and remote settings
- Ebyte LoRa E22 device for Arduino, esp32 or esp8266: WOR microcontroller and Arduino shield
- Ebyte LoRa E22 device for Arduino, esp32 or esp8266: WOR microcontroller and WeMos D1 shield
- Ebyte LoRa E22 device for Arduino, esp32 or esp8266: WOR microcontroller and esp32 dev v1 shield
Shield and PCB
Hello Renzo. I’m Orhan Furkan Soyaltın from Turkey. My team have a problem. We bought a couple of E22-900T30D and interfaced with arduino uno same as your schematic diagram. We need a tranceiver circuit for taking location info from neo-7m gps. Unfortunately, our coding experience is really poor so we couldn’t manage to run the codes. We really need your help immediately and we have a really short time to deadline for our project so I’ll bring some emails to you for communicate with us. Also we will wait your comment at the forum to help us.
Thank you
Orhan Furkan Soyaltın: ofsoyaltin@gmail.com
Meriç Anıl Alkan: maotun67@gmail.com
Hi Orhan,
sorry but I’m very busy at work, so I can’t communicate in real-time with all people that write to me.
You can use the forum and I try to answer as soon as possible.
Bye Renzo