Ebyte LoRa E32 & MicroPython: specifications, overview and first use – 1

Spread the love

The Internet of Things (IoT) has become increasingly popular, creating a demand for long-range, low-power communication technologies.

EByte LoRa E32 & MicroPython: specifications, overview and first use
EByte LoRa E32 & MicroPython: specifications, overview and first use

LoRa (Long Range) is a low-power wide-area network (LPWAN) technology designed to meet these requirements, making it ideal for IoT applications. One device that utilizes LoRa technology is the Ebyte LoRa E32 series, a collection of wireless transceiver modules. This article series will explore the Ebyte LoRa E32 device and its integration with MicroPython. This first article will focus on the specifications and basic use of the device.

EByte LoRa E32 detail
EByte LoRa E32 detail

Here my selection of LoRa E32 devices AliExpress (433MHz 5Km) - AliExpress (433MHz 8Km) - AliExpress (433MHz 16Km) - AliExpress (868MHz 915MHz 5.5Km) - AliExpress (868MHz 915MHz 8Km)

We are going to test E32-433T20D, a wireless serial port module based on Semtech’s SX1278 RF chip Block (TTL level), transparent transmission mode, working in the 410-441MHz frequency band (default 433MHz), using LoRa spread spectrum technology.

The SX1278 is a LoRa module that supports spread spectrum technology, offering numerous benefits for low-speed communication applications. With its long communication distance, robust anti-interference capabilities, and strong confidentiality, the SX1278 has become a popular choice in various industries. This article will discuss the key features, advantages, and applications of the SX1278 LoRa module.

SX1278 Overview

The SX1278 LoRa module is designed for optimal performance in low-speed communication applications. It has a default air rate of 2.4 kbps and a transmit power of 20 dBm. The module incorporates an industrial-grade crystal oscillator, ensuring stability, consistency, and an accuracy of less than 10 ppm. Currently, the SX1278 is in stable mass production and is widely utilized in the industry, IoT transformation, and smart furniture applications.

Advantages of the SX1278 LoRa Module

  1. Spread Spectrum Technology: The SX1278 supports advanced LoRa modulation, offering long-distance and anti-interference advantages over traditional GFSK technology.
  2. Communication Distance: Under ideal conditions, the communication distance can reach up to 3 km.
  3. Transmission Modes: The module supports fixed-point transmission, broadcast transmission, and channel monitoring.
  4. Air Wake-Up: The ultra-low power consumption feature makes the SX1278 suitable for battery-powered applications.
  5. Forward Error Correction (FEC): The module supports FEC to improve communication stability.
  6. Adjustable Transmit Power: The maximum transmit power is 100 mW, with multiple software-adjustable levels.
  7. Frequency Band: The SX1278 operates in the global license-free ISM 433 MHz frequency band.
  8. Data Transmission Rate: The module supports data transmission rates ranging from 0.3 kbps to 19.2 kbps.
  9. Power Supply: A 2.3 – 5.5 V power supply is supported, with more than 3.3 V ensuring optimal performance.
  10. Industrial-Grade Design: The SX1278 is designed for long-term use at temperatures ranging from -40°C to +85°C.
  11. Antenna: The SMA-K interface allows for easy connection of a coaxial cable or external antenna.

Data Security and Compression

The SX1278 module offers data encryption and compression functions, providing secure communication. The data transmitted over the air is randomized, and strict encryption and decryption algorithms render intercepted data meaningless. The data compression function helps reduce transmission time, lowers the likelihood of interference, and enhances reliability and transmission efficiency.

Certifications

The E32-433T20D module, which incorporates the SX1278, adheres to FCC, CE, and CCC design specifications, as well as other domestic and international standards. It meets various RF-related certifications and export requirements.

Operating and transmission type

This device has some interesting function:

Transmission

LoRa E32 transmitting scenarios

Transparent transmission

This can be considered a “Demo mode”, by default, you can send messages to all devices of the same configured address and channel.

Fixed transmission

In this type of transmission, you can specify an address and a channel where you want to send the message.
You can send a message to a:

  • A specified device with a predetermined Address Low, Address High, and Channel.
LoRa E32 Fixed message to a specified device
  • Broadcast a message on a predetermined Channel.
Broadcast messages to a set of channel devices

Normal mode

Simply send a message.

Wake-up mode and power-saving mode

As you can intend, if a device is in Wake-up mode can “wake” one or more devices that are in power-saving mode with a preamble communication.

Program/sleep mode

With this configuration, you can change the configuration of your device.

Specifications

Here are the specifications for the module:

  • Module size: 21*36mm
  • Antenna type: SMA-K (50Ω impedance)
  • Transmission distance: 3000m(max)
  • Maximum power: 2dB(100mW)
  • Air rates: 2.4Kbps (6 optional levels (0.3, 1.2, 2.4, 4.8, 9.6, 19.2kbps)
  • Emission length: 512Byte
  • Receive length: 512Byte
  • Communication Interface: UART – 8N1, 8E1, 8O1, Eight kinds of UART baud Rate, from 1200 to 115200bps (Default: 9600)
  • RSSI support: No (Built-in intelligent processing)
  • Working frequency: 410MHz-441MHz (Default 433MHz), Channel: 32
Electronic parameterMin.Typ.Max.Unit
Power supply2.33.35.5V
Communication level3.03.33.6V
Transmitting current102110118mA
Receiving current121518mA
Sleep current358μA
Operating temperature-4020+85
Operating humidity106090%
Storage temperature-4020+125

You must pay attention to the communication level that differs from the power supply, the second can receive voltage like 3.3v and 5v, but the first wants a 3.3v.

Pinout

EByte LoRa Exx pinout
EByte LoRa Exx pinout
Pin No.Pin itemPin directionPin application
1M0Input(weak pull-up)Work with M1 & decide on the four operating modes. Floating is not allowed, it can be ground.
2M1Input(weak pull-up)Work with M0 & decide on the four operating modes. Floating is not allowed, it can be ground.
3RXDInputTTL UART inputs connect to external (MCU, PC) TXD output pin. It can be configured as open-drain or pull-up input.
4TXDOutputTTL UART outputs connect to external RXD (MCU, PC) input pin. It 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).
6VCCPower supply 2.3V~5.5V DC
7GNDGround

As you can see, you can set various modes via M0 and M1 pins.

ModeM1M0Explanation
Normal00UART and the wireless channel are good to go
Wake-Up01Same as normal but a preamble code is added to transmitted data for waking-up the receiver.
Power-Saving10UART 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.
Sleep11Used in setting parameters. Transmitting and receiving disabled.

For the next simple test, we are going to use Normal mode.

Wiring

STM32

STM32 STM32F411 STM32F411CEU6 pinout low resolution
STM32 STM32F411 STM32F411CEU6 pinout low resolution

Here my selection of STM32 STM32F103C8T6 STM32F401 STM32F411 ST-Link v2 ST-Link v2 official

To put on work transparent transmission, we can put the M0 and M1 to GND.

STM32F4 EByte LoRa Exx normal mode
STM32F4 EByte LoRa Exx normal mode

You can remove AUX wiring for this test, but it’s better if you cannect It.

E32STM32F4
M0GND (Set normal mode)
M1GND (Set normal mode)
RXPA10 (PullUP 4,7KΩ)
TXPA9 (PullUP 4,7KΩ)
AUXNot connected (better if you set a pin, but not needed for this test)
VCC5v
GNDGND

esp32

ESP32 DOIT DEV KIT v1 pinout
ESP32 DOIT DEV KIT v1 pinout

Here my selection of esp32 ESP32 Dev Kit v1 - TTGO T-Display 1.14 ESP32 - NodeMCU V3 V2 ESP8266 Lolin32 - NodeMCU ESP-32S - WeMos Lolin32 - WeMos Lolin32 mini - ESP32-CAM programmer - ESP32-CAM bundle - ESP32-WROOM-32 - ESP32-S

The wiring diagram is quite simple, and for now, I put M0 and M1 directly to GND for the test.

Ebyte LoRa E32 E22 E220 ESP32 DEV KIT V1 normal mode breadboard
Ebyte LoRa E32 E22 E220 ESP32 DEV KIT V1 normal mode breadboard
E32esp32
M0GND (Set normal mode)
M1GND (Set normal mode)
RXTX2 (PullUP 4,7KΩ)
TXRX2 (PullUP 4,7KΩ)
AUXNot connected (better if you set a pin, but not needed for this test)
VCC5v
GNDGND

Raspberry Pi Pico

Raspberry Pi Pico rp2040 pinout low resolution
Raspberry Pi Pico rp2040 pinout low resolution

Here the rp2040 selection Official Pi Pico - Official Pi Pico W - Waveshare rp2040-zero - WeAct Studio rp2040

And here is the connection diagram, for this test, you can remove the AUX pin connection. You can also see that I use a different default Serial port because It differs from the Arduino environment.

Raspberry Pi Pico EByte LoRa E32 E220: normal mode
Raspberry Pi Pico EByte LoRa E32 E220: normal mode

Pay attention UART(1) use different pin in MicroPython than Arduino environment Serial1

E32rp2040
M0GND (Set normal mode)
M1GND (Set normal mode)
RXTX1 GPIO4 (PullUP 4,7KΩ)
TXRX1 GPIO5 (PullUP 4,7KΩ)
AUX2 (better if you set a pin, but not needed for this test)
VCC5v
GNDGND

For the Arduino standard pinout, you must change the UART declaration so
uart2 = UART(1, rx=Pin(9), tx=Pin(8))

Simple communication sketch

Now, we are going to do a simple sketch, without any library, that transfer a message by using the transparent transmission that is the default setting for these LoRa devices.

#############################
#
# Simple send receive test
#
# by Renzo Mischianti
# www.mischianti.org
#
#############################

from machine import UART, Pin
import utime

# UART configuration Raspberry Pi Pico (Arduino)
uart1 = UART(1, 9600, rx=Pin(9), tx=Pin(8))
# UART configuration Raspberry Pi Pico (MicroPython)
# uart1 = UART(1, 9600)
# UART configuration ESP32
# uart1 = UART(2, 9600)

print("Hi, I'm going to send message!")

uart1.write("Hello, world?")
utime.sleep_ms(500)

while True:
    if uart1.any():
        char = uart1.read(1).decode('utf-8')
        print(char, end='')

Here is the print of the first started device

Hi, I'm going to send message!
13
Hello, world?

Library

Now we do the same example with the ebyte-lora-e32 MicroPython library. Naturally, this is a trivial example, and you can’t understand the potential of the library, but you can understand how to use It.

To install the library, you can download It from this GitHub repository:

Or you can install it via Pypi with the command:

pip install ebyte-lora-e32

On Thonny IDE, you can use Tools --> Manage plug-ins... .

EByte LoRa E32 MicroPython: pypi, pip library Thonny
EByte LoRa E32 MicroPython: PyPi, pip library Thonny

Communication sketch with the library

Now we do the previous example with the library.

#############################
#
# Simple send receive test
# with the micropython library
# pip install ebyte-lora-e32
#
# by Renzo Mischianti
# www.mischianti.org
#
#############################

from lora_e32 import LoRaE32, print_configuration, Configuration
from lora_e32_operation_constant import ResponseStatusCode
from machine import UART, Pin

# Initialize the LoRaE32 module
# UART configuration Raspberry Pi Pico (Arduino)
uart1 = UART(1, 9600, rx=Pin(9), tx=Pin(8))
# UART configuration Raspberry Pi Pico (MicroPython)
# uart1 = UART(1, 9600)
# UART configuration ESP32
# uart1 = UART(2, 9600)

lora = LoRaE32('433T20D', uart1)
code = lora.begin()
print("Initialization: ", ResponseStatusCode.get_description(code))

# Send a string message (transparent)
message = 'Hello, world!'
code = lora.send_transparent_message(message)
print("Send message: ", ResponseStatusCode.get_description(code))

# Receive a string message (transparent)
while True:
    if lora.available() > 0:
        code, value = lora.receive_message()
        print(ResponseStatusCode.get_description(code))

        print(value)

The result in the REPL console is:

Initialization:  Success
Send message:  Success
Success
Hello, world!

Thanks

As you can see, for the simple operation, the library doesn’t add any additional features, but in the real-world example, we can find It very useful, but we look in deep in the following articles.

  1. EByte LoRa E32 & MicroPython: specifications, overview and first use
  2. EByte LoRa E32 & MicroPython: exploring MicroPython library
  3. EByte LoRa E32 & MicroPython: detailed look at the configuration
  4. EByte LoRa E32 & MicroPython: a deep dive into transmission types

Spread the love

2 Responses

  1. Peter Chovanec says:

    After uploading the code with the library I get the following error:

    E (1669) uart: tout_thresh = 244 > maximum value = 101
    Traceback (most recent call last):
    File “main.py”, line 25, in
    File “lora_e32.py”, line 305, in begin
    OSError: (-258, ‘ESP_ERR_INVALID_ARG’)
    MicroPython v1.22.2 on 2024-02-22; Generic ESP32 module with ESP32
    Type “help()” for more information.

    I use the configuration “uart1 = UART(2, 9600) for ESP32 .
    The previous code without the library works fine.

Leave a Reply

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