SkillAgentSearch skills...

LoraE32

A MicroPython class for the Ebyte E32 Series LoRa modules

Install / Use

/learn @effevee/LoraE32
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

EBYTE E32 series LoRa modules

User manual EBYTE E32 series

E32-868T20D

User manual EBYTE E32-868T20D

E32-868T20D

Features

E32-868T20D is a wireless serial port module (UART) based on SEMTECH's SX1276 RF chip. It has multiple transmission modes working in the 862MHz~893MHz range (default 868MHz).

  • Communication distance tested is up to 3km
  • Maximum transmission power of 100mW, software multi-level adjustable;
  • Support the global license-free ISM 868MHz band;
  • Support air date rate of 0.3kbps~19.2kbps;
  • Low power consumption for battery supplied applications;
  • Support 2.3V~5.2V power supply;
  • Industrial grade standard design, support -40 ~ 85 °C for working over a long time;
  • SMA access point, Easy connection of coaxial cable or external antenna

Pin layout

E32-868T20D

No|Pin|Description :--:|:--:|----------- 1|M0*|Work with M1 to set 1 of 4 operating modes. 2|M1*|Work with M0 to set 1 of 4 operating modes. 3|RXD*|TTL UART input. Can be configured as open-drain or pull-up input. 4|TXD*|TTL UART output. Can be configured as open-drain or push-pull output. 5|AUX*|Indicates module’s working status. Can be configured as open-drain output orpush-pull output (floating is allowed). 6|VCC|Power supply 2.3-5.2V DC 7|GND|Ground.

(*) All communication pins are 3.3V only !!!

Operating modes

No|Mode|M1|M0|Description :--:|:--:|:--:|:--:|----------- 0|Normal|0|0|UART and LoRa radio are on. 1|Wake Up|0|1|Same as normal but preamble code is added to transmitted data to wake up the receiver. 2|Power Save|1|0|UART is off, LoRa radio 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. 3|Sleep|1|1|UART is on, LoRa radio is off. Is used to get/set module parameters or to reset the module.

Module frequency

For the E32-868T20D, the minimum frequency is 862 MHz and the maximum is 893 MHz. The working frequency of the module is set by the channel number. The formula is :

  • Module frequency = Minimum frequency + channel_number * 1 MHz The default channel number for the E32-868T20D module is 6, so the working frequency defaults to 862 MHz + 6*1 MHz = 868 MHz

Transmission modes

E32-868T20D

  1. Transparent transmission
    All modules have the same address and channel and can send/receive messages to/from each other (demo mode). The messages don't include address and channel information.

  2. Fixed transmission
    All modules can have different addresses and channels. The transmission messages are prefixed with the destination address and channel information. If these differ from the settings of the transmitter, then the configuration of the module will be changed before the transmission. After the transmission is complete, the transmitter will revert to its prior configuration.

    • Fixed transmission P2P
      The transmitted message has the address and channel information of the receiver. Only this module will receive the message. This is a point to point transmission between 2 modules.
      E32-868T20D

    • Fixed transmission broadcast
      The transmitted message has address FFFF and a channel. All modules with any address and the same channel of the message will receive it.
      E32-868T20D

    • Fixed transmission monitoring
      The receiver has adress FFFF and a channel. It will receive messages from all modules with any address and the same channel as the receiver.

Module configuration

The module can only be configured when in sleep operating mode (M0 high & M1 high). The UART baudrate has to be 9600 and parity 8N1.

No|Command|Description :--:|:--:|----------- 1|C0 + config*|Set the configuration persistently. Send C0 + 5 configuration bytes in hex format. 2|C1+C1+C1*|Get the module configuration. Send 3x C1 in hex format. 3|C2 + config*|Set the configuration temporary. Send C2 + 5 configuration bytes in hex format. 4|C3+C3+C3**|Get the module version information. Send 3x C3 in hex format. 5|C4+C4+C4|Reset the module

(*) Default configuration bytes for E32-868T20D : C0 00 00 1A 06 44
(**) Default version bytes for E32-868T20D : C3 45 0D 14

Configuration bytes

E32-868T20D

Version bytes

No|Item|Description|Remark :--:|:--:|-----------|------ 0|HEAD|Header|0xC3 1|FREQ|Frequency (MHz)|0x32=433, 0x38=470, 0x45=868, 0x44=915, 0x46=170 2|VERS|Version number|0x0D 3|FEAT|Features number|0x14

Communication pins signal analysis

To make sense of the different communication pins of the E32 LoRa module, a simple USB logic analyzer and an opensource software comes to the rescue :)
I looked at these scenario's :

  1. Transparent transmission
    The device is in normal mode (M0 and M1 both low). Some time after the message data is received on the RXD pin of the module, the AUX pin goes low. The AUX pin stays low until all data has been transmitted by the LoRa radio, after which it goes high again. E32-868T20D

  2. Fixed transmission in normal mode
    The device is in normal mode (M0 and M1 both low). Some time after the message data is received on the RXD pin of the module, the AUX pin goes low. The message is prefixed with the address and channel info. The AUX pin stays low until all data has been transmitted by the LoRa radio, after which it goes high again. E32-868T20D

  3. Fixed transmission in wakeup mode
    The device is in wakeup mode (M0 high, M1 low). Some time after the message data is received on the RXD pin of the module, the AUX pin goes low. The message is prefixed with the preamble wakeup signal, the address and channel info. The AUX pin stays low until all data has been transmitted by the LoRa radio, after which it goes high again. E32-868T20D

  4. Receiving
    The device is in normal mode (M0 and M1 both low). When the LoRa radio receives a signal, the AUX pin goes low. The AUX pin stays low until all data has been sent to the TXD pin, after which it goes high again. E32-868T20D

  5. Command set config with persistent save
    The device is in sleep mode (both M0 and M1 high). Some time after the set config command is received on the RXD pin of the module, the AUX pin goes low. After the config response is sent to the TXD pin, the AUX pin goes high. E32-868T20D

  6. Command set config with temporary save
    The device is in sleep mode (both M0 and M1 high). Some time after the set config command is received on the RXD pin of the module, the AUX pin goes low. After the config response is sent to the TXD pin, the AUX pin goes high. E32-868T20D

  7. Command get config
    The device is in sleep mode (both M0 and M1 high). Some time after the get config command is received on the RXD pin of the module, the AUX pin goes low. After the config response is sent to the TXD pin, the AUX pin goes high. E32-868T20D

  8. Command get version
    The device is in sleep mode (both M0 and M1 high). Some time after the get version command is received on the RXD pin of the module, the AUX pin goes low. After the version response is sent to the TXD pin, the AUX pin goes high. E32-868T20D

  9. Command reset device
    The device is in sleep mode (both M0 and M1 high). Some time after the reset command is received on the RXD pin of the module, the AUX pin goes low and stays low while the device is resetting. After the module is ready again, the AUX pin goes high.
    E32-868T20D

Test setup with ESP32

E32-868T20D

E32 Pin|Wire|ESP32 pin :-----:|:--:|:-------: M0|cyan|GPIO25 M1|cyan|GPIO26 RXD|yellow|SD3 (UART1-TXD) TXD|green|SD2 (UART1-RXD) AUX|purple|GPIO27 VCC|red|3.3V GND|black|GND

  • Because both the ESP32 and the E32 LoRa module are 3.3V compliant, no voltage dividers are necessary for communication.
  • To stabilize the power supply for the E32 LoRa module, an electrolytic capacitor of 100 µF is placed on the power rail of the breadboard.

MicroPython code

class

class ebyteE32:
    ''' class to interface an ESP32 via serial commands to the EBYTE E32 Series LoRa modules '''

constructor

def __init__(self, PinM0, PinM1, PinAUX, Model='868T20D', Port='U1', Baudrate=9600, Parity='8N1', AirDataRate='2.4k', Address=0x0000, Channel=0x06, debug=False):
    ''' constructor for ebyte E32 LoRa module '''

methods

def start(self):
    ''' Start the ebyte E32 LoRa module '''

def sendMessage(self, to_address, to_channel, payload, useChecksum=False):
    ''' Send the payload to ebyte E32 LoRa modules in transparent or fixed mode. The payload is a data dictionary to
        accomodate key value pairs commonly used to store sensor data and is converted to a JSON string before sending.
        The payload can be appended with a 2's complement checksum to validate correct transmission.
        - transparent mode : all modules with the same address and channel of the transmitter will receive the payload
        - fixed mode : only the module with this address and channel will receive the payload;
                        if the address is 0xFFFF all modules with the same channel will receive the payload'''

def recvMessage(self, from_address, from_channel, useChecksum=False):
    
View on GitHub
GitHub Stars38
CategoryDevelopment
Updated6mo ago
Forks7

Languages

Python

Security Score

82/100

Audited on Oct 4, 2025

No findings