This is a porting of the Arduino library for EBYTE LoRa E32 devices to RaspberryPi
- 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) the microcontroller and Arduino shield
- LoRa E32 device for Arduino, esp32 or esp8266: WOR (wake on radio) microcontroller and new WeMos D1 mini shield
Changelog
- 2023-12-27 0.0.3 Fix json requirements
- 2023-05-02 0.0.2 Fix 900MHz devices frequency
- 2023-03-21 0.0.1 Fully functional library
Library usage
Here an example of constructor, you must pass the UART interface and (if you want, but It's reccomended)
the AUX pin, M0 and M1.
Installation
To install the library execute the following command:
pip install ebyte-lora-e32-rpi
Initialization
from lora_e32 import LoRaE32
import serial
loraSerial = serial.Serial('/dev/serial0') #, baudrate=9600, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS)
lora = LoRaE32('433T20D', loraSerial, aux_pin=18, m0_pin=23, m1_pin=24)
Start the module transmission
code = lora.begin()
print(ResponseStatusCode.get_description(code))
Get Configuration
from lora_e32 import LoRaE32, print_configuration, Configuration
from lora_e32_operation_constant import ResponseStatusCode
code, configuration = lora.get_configuration()
print(ResponseStatusCode.get_description(code))
print_configuration(configuration)
The result
----------------------------------------
HEAD : 0b11000000 192
AddH : 0
AddL : 2
Chan : 23 -> 433
SpeedParityBit : 0b0 -> 8N1 (Default)
SpeedUARTDatte : 0b11 -> 9600bps (default)
SpeedAirDataRate : 0b10 -> 2.4kbps (default)
OptionTrans : 0b1 -> Fixed transmission (first three bytes can be used a
s high/low address and channel)
OptionPullup : 0b1 -> TXD, RXD, AUX are push-pulls/pull-ups (default)
OptionWakeup : 0b0 -> 250ms (default)
OptionFEC : 0b1 -> Turn on Forward Error Correction Switch (Default)
OptionPower : 0b0 -> 20dBm (Default)
----------------------------------------
Set Configuration
configuration_to_set = Configuration('433T20D')
configuration_to_set.ADDL = 0x02
configuration_to_set.OPTION.fixedTransmission = FixedTransmission.FIXED_TRANSMISSION
code, confSetted = lora.set_configuration(configuration_to_set)
The configuration object has a lot of parameters.
class Configuration:
class Speed:
def __init__(self, model):
self.model = model
self.airDataRate = AirDataRate.AIR_DATA_RATE_010_24
self.uartBaudRate = UARTBaudRate.BPS_9600
self.uartParity = UARTParity.MODE_00_8N1
class Option:
def __init__(self, model):
self.model = model
self.transmissionPower = TransmissionPower(self.model).get_transmission_power().get_default_value()
self.fec = ForwardErrorCorrectionSwitch.FEC_1_ON
self.wirelessWakeupTime = WirelessWakeUpTime.WAKE_UP_250
self.ioDriveMode = IODriveMode.PUSH_PULLS_PULL_UPS
self.fixedTransmission = FixedTransmission.TRANSPARENT_TRANSMISSION
class Configuration:
def __init__(self, model):
self.HEAD = 0
self.ADDH = 0
self.ADDL = 0
self.SPED = Speed(model)
self.CHAN = 23
self.OPTION = Option(model)
I create a CONSTANTS class for each parameter, here a list:
AirDataRate, UARTBaudRate, UARTParity, TransmissionPower, ForwardErrorCorrectionSwitch, WirelessWakeUpTime, IODriveMode, FixedTransmission
Send string message
Here an example of send data, you can pass a string
lora.send_transparent_message('pippo')
lora.send_fixed_message(0, 2, 23, 'pippo')
Here the receiver code
while True:
if lora.available() > 0:
code, value = lora.receive_message()
print(ResponseStatusCode.get_description(code))
print(value)
time.sleep(2)
Result
Success!
pippo
Send dictionary message
Here an example of send data, you can pass a dictionary
lora.send_transparent_dict({'pippo': 'fixed', 'pippo2': 'fixed2'})
lora.send_fixed_dict(0, 0x01, 23, {'pippo': 'fixed', 'pippo2': 'fixed2'})
Here the receiver code
while True:
if lora.available() > 0:
code, value = lora.receive_dict()
print(ResponseStatusCode.get_description(code))
print(value)
print(value['pippo'])
time.sleep(2)
Result
Success!
{'pippo': 'fixed', 'pippo2': 'fixed2'}
fixed
Wiring
Raspberry Pi

LoRa E32 (EBYTE LoRa SX1278/SX1276) series Library for Arduino, esp8266 and esp32-
I create a library to manage EBYTE E32 series of LoRa device, very powerfull, simple and cheap device.

LoRa E32-TTL-100
You can find here AliExpress (3Km device) AliExpress (8Km device)
They can work over a distance of 3000m to 8000m, and they have a lot of features and parameter.
So i create this library to simplify the usage.
Please refer to my article to get updated Schema
Library
You can find my library here.
To download.
Click the DOWNLOADS button in the top right corner, rename the uncompressed folder LoRa_E32.
Check that the LoRa_E32 folder contains LoRa_E32.cpp and LoRa_E32.h.
Place the LoRa_E32 library folder your /libraries/ folder.
You may need to create the libraries subfolder if its your first library.
Restart the IDE.
Pinout

E32 TTL 100
You can buy here AliExpress
| Pin No. |
Pin item |
Pin direction |
Pin application |
| 1 |
M0 |
Input(weak pull-up) |
Work with M1 & decide the four operating modes.Floating is not allowed, can be ground. |
| 2 |
M1 |
Input(weak pull-up) |
Work with M0 & decide the four operating modes.Floating is not allowed, can be ground. |
| 3 |
RXD |
Input |
TTL UART inputs, connects to external (MCU, PC) TXD outputpin. Can be configured as open-drain or pull-up input. |
| 4 |
TXD |
Output |
TTL UART outputs, connects to external RXD (MCU, PC) inputpin. Can be configured as open-drain or push-pull output |
| 5 |
AUX |
Output |
To indicate module’s working status & wakes up the external MCU. During the procedure of self-check initialization, the pin outputs low level. Can be configured as open-drain output orpush-pull output (floating is allowed). |
| 6 |
VCC |
Power supply 2.3V~5.5V DC |
|
| 7 |
GND |
Ground |
As you can see you can set various modes via M0 and M1 pins. |
| Mode |
M1 |
M0 |
Explanation |
| Normal |
0 |
0 |
UART and wireless channel is good to go |
| Wke-Up |
0 |
1 |
Same as normal but a preamble code is added to transmitted data for waking-up the receiver. |
| Power-Saving |
1 |
0 |
UART is disable and wireless is on WOR(wake on radio) mode which means the device will turn on when there is data to be received. Transmission is not allowed. |
| Sleep |
1 |
1 |
Used in setting parameters. Transmitting and receiving disabled. |
As you can see there are some pins that can be use in a static way, but If you connect It to the library you gain in performance and you can control all mode via software, but we are going to explain better next.
Fully connected schema
As I already say It’s not important to connect all pin to the output of microcontroller, you can put M0 and M1 pins to HIGH or LOW to get desidered configuration, and if you don’t connect AUX the library set a reasonable delay to be sure that the operation is complete.
AUX pin
When transmitting data can be used to wake up external MCU and return HIGH on data transfer finish.

LoRa E32 AUX Pin on transmission
When receiving AUX going LOW and return HIGH when buffer is empty.

LoRa e32 AUX pin on reception
It’s also used for self checking to restore normal operation (on power-on and sleep/program mode).

LoRa e32 AUX pin on self-check
esp8266 connection schema is more simple because It work at the same voltage of logical communications (3.3v).

LoRa E32 TTL 100 Wemos D1 fully connected
It’s important to add pull-up resistor (4,7Kohm) to get good stability.
| M0 |
D7 |
| M1 |
D6 |
| RX |
PIN D2 (PullUP 4,7KΩ) |
| TX |
PIN D3 (PullUP 4,7KΩ) |
| AUX |
D5 (Input) |
| 3.3v |
GND |
Arduino working voltage is 5v, so we need to add a voltage divider on RX pin M0 and M1 of LoRa module to prevent damage, you can get more information here Voltage divider: calculator and application.
You can use a 2Kohm resistor to GND and 1Kohm from signal than put together on RX.

LoRa E32 TTL 100 Arduino fully connected
| M0 |
7 (Voltage divider) |
| M1 |
6 (Voltage divider) |
| RX |
PIN D2 (PullUP 4,7KΩ & Voltage divider) |
| TX |
PIN D3 (PullUP 4,7KΩ) |
| AUX |
5 (Input) |
| VCC |
3.3v |
| GND |
GND |
Basic configuration option
| ADDH |
High address byte of module (the default 00H) |
00H-FFH |
| ADDL |
Low address byte of module (the default 00H) |
00H-FFH |
| SPED |
Information about data rate parity bit and Air data rate |
CHAN |
| Communication channel(410M + CHAN*1M), default 17H (433MHz), valid only for 433MHz device |
00H-1FH |
OPTION
Type of transmission, pull-up settings, wake-up time, FEC, Transmission power
SPED detail
UART Parity bit: _UART mode can be different between communication parties