WeMos D1 (esp8266): HardwareSerial shield for Ebyte E32 E22 E220 LoRa devices
I created a library for the EByte LoRa device and also a shield. However, when I used it in another project I had the problem of the reduced number of pins since 2 were used by the SoftwareSerial. To solve these problems I switched to HardwareSerial. The amps could be insufficient so I add a voltage regulator to power the EByte e32 in one and in the other shield directly from the 5v.
SoftwareSerial shield
So this shield is quite different from one shown on “LoRa E32 device for Arduino, esp32 or esp8266: WOR (wake on radio) microcontroller and new WeMos D1 mini shield” the previous schema is this
And the result is
WeMos LoRa shield with SoftwareSerial PCBWay
HardwareSerial shield with 3.3v voltage regulator
The new shield is similar to the previous one, but has more functionality, but has the 3.3v limit for powering the LoRa device, thereby limiting its power.
As you can see now, there is a voltage regulator to power the e32 device, and RX, TX is connected to TX and RX of microcontroller, a pin is free to connect Serial to USB to debug on Serial1.
So the PCB schema become so
More complex and with more pins and buttons, now AUX, M0, and M1 are selectable, and you have two options for every e32 input.
Here is the milled prototype.
And here are all the options
Here the BOM
N° | Object | Desc |
---|---|---|
2 | Electrolytic Capacitor | capacitance 10µF |
2 | Generic female header – 8 pins | 2.54mm ♀ |
1 | Generic female header – 7 pins | 2.54mm ♀ |
7 | Generic male header – 2 pins | 2.54mm ♂ |
3 | Generic male header – 3 pins | 2.54mm ♂ |
1 | DIP SWITCH | package dipswitch-03; channels 1 |
1 | Lora E32 | voltage 3-5V; type Basic |
3 | 4.7kΩ Resistor | |
2 | 10kΩ Resistor | |
1 | LD1117V33 | package 78xxl; voltage regulator 3.3V; chip LD1117VXX |
1 | WeMos D1 Mini | CPU ESP-8266EX |
You can find WeMos D1 on WeMos D1 mini - NodeMCU V2 V2.1 V3 - esp01 - esp01 programmer
You can find EBYTE e32 devices on AliExpress (433MHz 5Km) - AliExpress (433MHz 8Km) - AliExpress (433MHz 16Km) - AliExpress (868MHz 915MHz 5.5Km) - AliExpress (868MHz 915MHz 8Km)
You can find 3.3v voltage regulator on AliExpress SMD (AMS1117) - AliExpress 3.3v (LM1117) - AliExpress 5v (7805) - AliExpress 9v (7809)AliExpress 12v (7812) - AliExpress 3.3v TO-92 (78L33)
You can find dip switch on AliExpressSoldering video
Get the PCB.
WeMos LoRa shield with 3.3v voltage regulator PCBWay
HardwareSerial shield 5v version
After a while, I understand that to have a good range, I need to power the LoRa device with 5v, and I redò the shield like the photo.
The soldering steps are the same, but I remove the voltage regulator and add a 3.3V switch to the 5V USB power supply.
Here is the list of parts.
N° | Object | Desc |
---|---|---|
2 | Generic female header – 8 pins | 2.54mm ♀ |
1 | Generic female header – 7 pins | 2.54mm ♀ |
7 | Generic male header – 2 pins | 2.54mm ♂ |
3 | Generic male header – 3 pins | 2.54mm ♂ |
1 | DIP SWITCH | package dipswitch-03; channels 1 |
1 | Lora E32 | voltage 3-5V; type Basic |
3 | 4.7kΩ Resistor | |
2 | 10kΩ Resistor | |
1 | WeMos D1 Mini | CPU ESP-8266EX |
You can find WeMos D1 on WeMos D1 mini - NodeMCU V2 V2.1 V3 - esp01 - esp01 programmer
You can find EBYTE e32 devices on AliExpress (433MHz 5Km) - AliExpress (433MHz 8Km) - AliExpress (433MHz 16Km) - AliExpress (868MHz 915MHz 5.5Km) - AliExpress (868MHz 915MHz 8Km)
You can find dip switch on AliExpress
And here is the final result.
Get the PCB.
WeMos LoRa shield with 3.3v and 5v switch PCBWay
Example
An example of a configuration of the shield is
LoRa_E32 e32ttl(&Serial, D3, D0, D8);
But remember, AUX with a change jumper can take D3 or D6 pins, M0 can be D0 or D5, M1 can be D8 or D7.
Here is a simple sketch to retrieve the device’s configuration; refer to the full tutorial of the library for more detail on “LoRa e32 devices“.
/*
* LoRa E32-TTL-100
* Get configuration.
* https://mischianti.org
*
*/
#include "Arduino.h"
#include "LoRa_E32.h"
LoRa_E32 e32ttl(&Serial, D3, D0, D8);
void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
void setup() {
Serial.begin(9600);
delay(500);
// Startup all pins and UART
e32ttl100.begin();
ResponseStructContainer c;
c = e32ttl100.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 = e32ttl100.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 BIN: ")); 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 BIN: ")); Serial.println(configuration.ADDH, BIN);
Serial.print(F("AddL BIN: ")); Serial.println(configuration.ADDL, BIN);
Serial.print(F("Chan BIN: ")); Serial.print(configuration.CHAN, DEC); Serial.print(" -> "); Serial.println(configuration.getChannelDescription());
Serial.println(F(" "));
Serial.print(F("SpeedParityBit BIN : ")); Serial.print(configuration.SPED.uartParity, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTParityDescription());
Serial.print(F("SpeedUARTDataRate BIN : ")); Serial.print(configuration.SPED.uartBaudRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTBaudRate());
Serial.print(F("SpeedAirDataRate BIN : ")); Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRate());
Serial.print(F("OptionTrans BIN : ")); Serial.print(configuration.OPTION.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFixedTransmissionDescription());
Serial.print(F("OptionPullup BIN : ")); Serial.print(configuration.OPTION.ioDriveMode, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getIODroveModeDescription());
Serial.print(F("OptionWakeup BIN : ")); Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());
Serial.print(F("OptionFEC BIN : ")); Serial.print(configuration.OPTION.fec, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFECDescription());
Serial.print(F("OptionPower BIN : ")); 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("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("----------------------------------------");
}
Thanks
- WeMos D1 (esp8266): i2c shield to manage encoder, multiple buttons, and LEDs
- WeMos D1 (esp8266): relay shield
- WeMos D1 (esp8266): Ebyte LoRa shield (e32, e22 and e220)