Ebyte LoRa E32 device for Arduino, esp32 or esp8266: WOR (wake on radio) microcontroller and new WeMos D1 mini shield – Part 7
We have seen how this device (E32 UART LoRa based on popular SX1276/SX1278 Wireless Modules ) manages power saving, but If we use power saving only for the e32 the microcontroller continue to rest active, but we can use AUX pin to resolve this problem.
You can find module here AliExpress (433MHz 5Km) - AliExpress (433MHz 8Km) - AliExpress (433MHz 16Km) - AliExpress (868MHz 915MHz 5.5Km) - AliExpress (868MHz 915MHz 8Km)
If you have trouble like freeze device, you must put a pull-up 4.7k resistor or better connect to the device AUX pin.
Instead the breadboard schema we used since now, but we are going to do some fix, instead of D2 and D3 we are going to use D3 and D4, so SDA and SCL (i2c protocol) remain free.
So the new connection schema become like so:
When you are in Sleep mode the e32 put on the buffer the data recived and go immediately LOW, when data is ready return HIGHT, LOW It’s perfect to wake the microcontroller.
WeMos D1 mini wake up
As the e32 device, WeMos have some sleep type, but for this test we are going to use Light sleep with GPIO wake up.
Refer to “WeMos D1 mini (esp8266), the three type of sleep mode to manage energy savings – Part 4” for a detailed description on sleep mode.
How to put in sleep WeMos D1 mini
The command to put on power down the microcontroller is this
wifi_set_opmode(NULL_MODE);
wifi_fpm_set_sleep_type(LIGHT_SLEEP_T);
wifi_fpm_open();
wifi_fpm_set_wakeup_cb(callback);
wifi_fpm_do_sleep(FPM_SLEEP_MAX_TIME);
delay(1000);
But we must specify that the device must wake when AUX pin go LOW
// Allow wake up pin to trigger interrupt on low.
gpio_pin_wakeup_enable(GPIO_ID_PIN(AUX_PIN), GPIO_PIN_INTR_LOLEVEL);
// Enter light sleep.
wifi_set_opmode(NULL_MODE);
wifi_fpm_set_sleep_type(LIGHT_SLEEP_T);
wifi_fpm_open();
wifi_fpm_set_wakeup_cb(callback);
wifi_fpm_do_sleep(FPM_SLEEP_MAX_TIME);
delay(1000);
So the code to receive transmission become so:
/*
* LoRa E32-TTL-100
* Receive fixed transmission message on channel and wake up.
* https://mischianti.org
*
* E32-TTL-100----- Arduino UNO or esp8266
* M0 ----- LOW
* M1 ----- HIGH
* TX ----- RX PIN D3 (PullUP)
* RX ----- TX PIN D4 (PullUP)
* AUX ----- PIN D5
* VCC ----- 5v
* GND ----- GND
*
*/
#include "Arduino.h"
#include "LoRa_E32.h"
#include <ESP8266WiFi.h>
#define FPM_SLEEP_MAX_TIME 0xFFFFFFF
void callback() {
Serial.println("Callback");
Serial.flush();
}
// ---------- esp8266 pins --------------
LoRa_E32 e32ttl(D3, D4, D5); // Arduino RX <-- e32 TX, Arduino TX --> e32 RX
// -------------------------------------
void printParameters(struct Configuration configuration);
//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;
printParameters(configuration);
configuration.ADDL = 3;
configuration.ADDH = 0;
configuration.CHAN = 0x04;
configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;
configuration.OPTION.wirelessWakeupTime = WAKE_UP_250;
configuration.OPTION.fec = FEC_1_ON;
configuration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS;
configuration.OPTION.transmissionPower = POWER_20;
configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
configuration.SPED.uartBaudRate = UART_BPS_9600;
configuration.SPED.uartParity = MODE_00_8N1;
e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
printParameters(configuration);
// ---------------------------
delay(1000);
Serial.println();
Serial.println("Start sleep!");
//wifi_station_disconnect(); //not needed
gpio_pin_wakeup_enable(GPIO_ID_PIN(D5), GPIO_PIN_INTR_LOLEVEL);
wifi_set_opmode(NULL_MODE);
wifi_fpm_set_sleep_type(LIGHT_SLEEP_T);
wifi_fpm_open();
wifi_fpm_set_wakeup_cb(callback);
wifi_fpm_do_sleep(FPM_SLEEP_MAX_TIME);
delay(1000);
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("----------------------------------------");
}
The result is that the Serial stop on line 91, when we receive the message the e32 wake itself and put AUX LOW, so Arduino wake with interrupt on AUX pin.
Here the sending sketch:
/*
* LoRa E32-TTL-100
* Send fixed broadcast transmission message to a specified channel.
* https://mischianti.org
*
* E32-TTL-100----- Arduino UNO or esp8266
* M0 ----- HIGH
* M1 ----- LOW
* TX ----- RX PIN D3 (PullUP)
* RX ----- TX PIN D4 (PullUP)
* AUX ----- PIN D5
* VCC ----- 5v
* GND ----- GND
*
*/
#include "Arduino.h"
#include "LoRa_E32.h"
LoRa_E32 e32ttl(D3, D4, D5);
// -------------------------------------
void printParameters(struct Configuration configuration);
//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);
while (!e32ttl.begin()) {
delay(2000); // wait for serial port to connect. Needed for native USB
}
e32ttl.setMode(MODE_1_WAKE_UP);
// 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;
printParameters(configuration);
// configuration.SPED.uartBaudRate = UART_BPS_9600;
// configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
configuration.ADDL = 0x01;
configuration.ADDH = 0x00;
configuration.CHAN = 0x04;
configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;
configuration.OPTION.wirelessWakeupTime = WAKE_UP_750;
configuration.OPTION.fec = FEC_1_ON;
configuration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS;
configuration.OPTION.transmissionPower = POWER_20;
configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
configuration.SPED.uartBaudRate = UART_BPS_9600;
configuration.SPED.uartParity = MODE_00_8N1;
e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
printParameters(configuration);
// ---------------------------
}
int i = 0;
// The loop function is called in an endless loop
void loop()
{
i++;
String mess = "Message to 00 03 04 deviceMessage to ";
String compMEss = mess+i;
Serial.print(compMEss);
Serial.print(" - ");
ResponseStatus rs = e32ttl.sendFixedMessage(0, 3, 0x04, compMEss);
Serial.println(rs.getResponseDescription());
delay(8000);
}
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("----------------------------------------");
}
WeMos D1 mini shield
I create also a WeMos D1 mini shield very usefully to use.
The configuration is this:
LoRa_E32 e32ttl(D3, D4, D5, D7, D6);
Than you can use all examples inside the library, you can use pin D6 and D7 to do a full connection or disable they and put M0 and M1 as you want with dipswitch.
Now we are going to soldering.
Ready to go
Here the result of milled PCB
Here the result with ordered PCB
The shield have some jumper and dip switch to configure M0 and M1.
If you want set M0 and M1 to a fixed value you must put jumper to F, if you want control via pin to P.
If you set to F you must put dip switch on property value Low or High.
Shopping List
You can find here AliExpress (433MHz 5Km) - AliExpress (433MHz 8Km) - AliExpress (433MHz 16Km) - AliExpress (868MHz 915MHz 5.5Km) - AliExpress (868MHz 915MHz 8Km)
Amount Part Type Properties 1 Lora E32-TTL-100 variant 1; voltage 3-5V; type Basic 1 DIP SWITCH channels 1; package dipswitch-02 2 Generic male header – 3 pins pins 3; pin spacing 0.1in (2.54mm); hole size 1.0mm,0.508mm; form ♂ (male); package THT; row single 1 WeMos D1 mini type esp8266 3 4.7kΩ Resistor bands 4; tolerance ±5%; pin spacing 400 mil; package THT; resistance 4.7kΩ 3 2kΩ Resistor bands 4; tolerance ±5%; pin spacing 400 mil; package THT; resistance 2kΩ 1 Generic female header – 7 pins Pin spacing 0.1in (2.54mm); 2 Generic male/female header – 8 pins Pin spacing 0.1in (2.54mm);
You can get pcb without additional costs here from PCBWay
Here my Crtistmas present
I chose this manufacturer because at the same cost it offers excellent quality, in the first screen it is possible to make countless options suitable for every need.
The board as you can see on various photo is very beautiful and simply to solder.
Assembly video
Here the soldering video.
Here the result
Thanks
- LoRa E32 device for Arduino, esp32 or esp8266: settings and basic usage
- LoRa E32 device for Arduino, esp32 or esp8266: library
- LoRa E32 device for Arduino, esp32 or esp8266: configuration
- LoRa E32 device for Arduino, esp32 or esp8266: fixed transmission
- LoRa E32 device for Arduino, esp32 or esp8266: power saving and sending structured data
- LoRa E32 device for Arduino, esp32 or esp8266: WOR (wake on radio) microcontroller and Arduino shield
- LoRa E32 device for Arduino, esp32 or esp8266: WOR (wake on radio) microcontroller and WeMos D1 shield
- EByte LoRa E32 device for Arduino, esp32 or esp8266: WOR (wake on radio) and new ESP32 shield
- Ebyte LoRa E32 with STM32: WOR (wake on radio) and new STM32 shield
- Mischianti Arduino LoRa shield (Open source)
- Mischianti WeMos LoRa shield (Open source)
- Mischianti ESP32 DOIT DEV KIT v1 shield (Open source)
- STM32F1 Blue-Pill EByte LoRa E32, E22, and E220 Shield
- STM32F4 Black-Pill EByte LoRa E32, E22, and E220 Shield
Renzo,
I’m using your sketch on page 7 as above, the only difference is that I need pin configeration LoRa_E32 e32ttl(D3, D4, D5, D7, D6); for the connection drawing you have.( if i use just d3,d4,d5 my sketch doesn’t work) The other difference is instead of receiving message in the void loop I’m sending a message.
If I take out the wifi sleep lines and more importantly line gpio_pin_wakeup_enable(GPIO_ID_PIN(D5), GPIO_PIN_INTR_LOLEVEL); it works.
If I only add line gpio_pin_wakeup_enable(GPIO_ID_PIN(D5), GPIO_PIN_INTR_LOLEVEL); it no longer works.
It looks like the interrupt is causing an issue for transmitting a message how do I work around this ?
Hi Craig,
I have a hard time helping you, or better, I understand that you have a trouble to send message on the device where you configure the interrupt.
If you open a topic where you can put your code I try to help you.
Bye Renzo
Renzo,
added info into forum
Thanks
Sir,may I ask you about the Modules?Could it possible connect with TTgo Meshtastic board? I mean soldering on board.I not sure modules can relay or transfer signals from Lilygo Meshtastic board.
Hi kk,
I think no, but if you link the board we can check better.
Bye Renzo
Hello, can you help me? I am really confused about my LoRa E32 module.
What does MIC —> -1 and TX MIC —> -1 mean when I run the getconfiguration program from library example. When I try to get GetParam information from the Ebyte RF setting program, I receive a ‘no response from device’ message. However, when I attempt it using the library, it appears as follows.But when I try to send data, there is no response at all. I am using an ESP32 and connecting it according to the scheme you provided, with a 5V VCC from the ESP32 board.
Hi Srill,
if you use Serial instead of pin, It’s normal to have -1 -1.
For the communication problem, we must check what you are doing. To do this, open a topic forum and explain the code and steps.
Bye Renzo
The E22-900T30D manual shows a screenshot of an E22 configuration application for which I’ve searched the EBYTE website unsuccessfully and also asked their tech support where to get it, with no answer. It suggests to me that it could be used to configure the E22 device to go into repeater and WOR modes when powered up, without a microcontroller attached. This would reduce power consumption. Not having the application, I haven’t been able to confirm this. What do you think?
Hi Sid,
you don’t need the application you must only set the configuration in repeater mode and wiring the M0 and M1 with the correct level.
If you open a forum topic I attach the wiring schema and the configuration parameter.
Bye Renzo