Home / Tutorials / Arduino Tutorial / How to Use the E32-TTL-100 SX1278 LoRa Module
pcbway
E32-TTL-100 SX1278 LoRa Module

How to Use the E32-TTL-100 SX1278 LoRa Module

LoRa is a promising low-power, long-range wireless transmission protocol developed by Semtech as part of the emergence of the Internet of Things (IoT). Simply put, it is a method for sending data separate from WiFi, Zigbee, or Bluetooth. Its low power consumption amidst a very long range of transmission (up to 10 km) makes it a very good choice for microcontroller systems.

The E32-TTL-100 SX1278 LoRA Module

I managed to grab one of those LoRa modules that litter the market today. Mine’s an E32-TTL-100 module which is said to be based on Semtech’s SX1278. Here are the specifications for the module:

  • Module size:21*36mm
  • Antenna type: Standard SMA antenna (FREE)
  • Power supply:2.3V-5.5V DC
  • Communication level:5.2V(max)
  • Transmission distance:3000m(max)
  • Maximum power:2dB(100mW)
  • Air rates:2.4Kbps
  • Emission current:130mA @ 100mW
  • Receiving current:13.5mA @ Mode 0, Mode 1
  • Sleep Current:2.0uA(M1=1,M1=0)
  • Emission length:256 Byte
  • Receive length:256 Byte
  • Communication Interface: UART
  • RSSI support: Yes
  • Working frequency:410MHz-441MHz(Default 433MHz)
  • Operating temperature:-30?~+85?
  • Receiver sensitivity:-130dBm @ 1.2Kbps

A range of 3km! I doubt this is possible for non-LOS (line of sight) but let’s see.

The module has 7 pins as shown:

E32-TTL-100 SX1278 LoRa Module

It’s UART-based so I think RXD, TXD (and of course VCC and GND) are self-explanatory. Let me try to explain the M0, M1, and AUX pins.

Configuring Modes

It turns out, M0 and M1 are used to set the modes of the module. There are four modes: normal, wake-up, power-saving, and sleep. Here’s a useful table:

Mode M1 M0 Explanation
Normal 0 0 UART and the wireless channel is good to go
Wake-Up 0 1 Same as normal but a preamble code is added to transmit data for waking up the receiver.
Power-Saving 1 0 UART is disabled 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 are disabled.

The AUX Pin

The AUX pin serves as a flag for checking if the data has been sent or when data has been received. It’s also used to check if the module is still in self-check procedure which happens during power-on and exit from sleep mode.

When the module is idle, the AUX pin stays high. If there is data is to be sent, the AUX pin stays low 2-3 ms prior to the data being sent to the transmit buffer. The AUX pin goes back to high if the transmit buffer is clear (i.e., the data has been sent wirelessly). Similarly, the AUX pin goes low when there is data on the receive buffer.

The logic states of the AUX pin are summarized below:

Parameter Setting

As mentioned, when the module is in sleep mode (M0=M1=1), we can change some options like baud rate, UART format, etc. The commands for changing parameters must be sent using 9600 baud, 8N1.

The format for changing parameters is 0xC0/0xC2 ADDH ADDL SPED CHAN OPTION. When you want the parameters to be saved to EEPROM, use 0xC0. Otherwise, use 0xC2. The rest are bytes with the following possible values:

Item Description Notes
ADDH Module high address byte (00h by default)
ADDL Module low address byte (00h by default)
SPED UART Baud Rate and Air Data Rate See bit descriptions below.
CHAN Operating Frequency (0x00 to 0xFF corresponding to 410 to 441 MHz. Default is 0x17 – 433 MHz)
OPTION Other options See bit descriptions below.

SPED Bit Descriptions

Bit 7 and 6 Bit 5, 4, 3 Bit 2, 1, 0
UART Parity UART Baud Rate Air Data Rate
00:8N1(default)
01:8O1
10:8E1
11:8N1(equal to 00)
000:1200bps

001:2400bps

010:4800bps

011:9600bps(Default)

100:19200bps

101:38400bps

110:57600bps

111:115200bps

000:0.3kbps

001:1.2kbps

010:2.4kbps(Default)

011:4.8kbps

100:9.6kbps

101:19.2kbps

110:19.2kbps(equal to 101)

111:19.2kbps(equal to 101)

OPTION Bit Descriptions

Bit 7 Bit 6 Bit 5,4,3 Bit 2 Bit 1 and 0
Fixed Transmission I/O Drive Mode Wireless Wake-up Time FEC (Forward Error Correction) Switch Transmission Power
0: transparent transmission (default)

1: fixed transmission (first three bytes can be used as high/low address and channel)

0: TXD, RXD, AUX are open-collectors

1: TXD, RXD, AUX are push-pulls/pull-ups

000:250ms(default)

001:500ms

010:750ms

011:1000ms

100:1250ms

101:1500ms

110:1750ms

111:2000ms

0:Turn off FEC

1:Turn on FEC(Default)

00: 20dBm(Default)

01: 17dBm

10: 14dBm

11: 10dBm

So for example, you want to change the UART baud rate to 115200, 8N1 mode, air data rate to 19.2kbps, use the default 433 MHz operating frequency, fixed transmission mode, push-pull pins, 250 ms wake-up time, FEC on, and 20 dBm transmission power. Set M0 and M1 and send the following data through UART:

0xC0 0x00 0x00 0x3D 0x17 0xC4

For reading the current options, send the commands:

0xC1 0xC1 0xC1

This is for reading the version number:

0xC3 0xC3 0xC3

And for resetting the module:

0xC4 0xC4 0xC4

Bob Chan has created an example sketch for using the E32-100 LoRa module with the Arduino. The library is available at his github repository. His library allows you to change parameters as I have discussed.

To use the above library, follow this connection:

UNO/NANO(5V mode) E32-TTL-100
D7 <———————> M0
D8 <———————> M1
A0 <———————> AUX
D10(Rx) <—> 4.7k Ohm <—> Tx
D11(Tx) <—> 4.7k Ohm <—> Rx

I hope you found this tutorial useful. If you have questions, kindly drop a comment below.

 

Check Also

attribute packed

What is meant by “packed” in Embedded C programming?

In embedded C programming, “packed” refers to a method of organizing data in memory where …

21 comments

  1. Hi,
    Thanks your great info. Your example code works for 1 transmitter + 1 receiver. Now I have 6 transmitters keep sending message to 1 receiver. may I know how the receiver receiver message from 6 transmitters? Still using 1 SoftwareSerial? or using multiple SoftwareSerial and multiplexing the RX TX?

    Please advise.
    Elisa.

    • Hi Elisa,

      You dont multiple serial ports if you have several transmitters. All you need is to identify which transmitter is transmitting and then process it. One way is to add a identification header to the message you are sending. Then when the receiver receives the message and sees the header, it will know which transmitter was sending the message

    • hi
      i know about how to send sensor data to transmitter to reciver
      i upload code in two arduino and use e32ttl100 but when we type message on serial port message is not send
      i have not much knowledge about this
      can you send code and some information how to send sensor data to transmitter to reciver

    • I have a similar configuration for a home monitor i built. I send/receive data using a data structure where the first data is an ID, the receivers are set for a unique ID. The base loops through each ID, sends a request for data, and if the ID matches the sender, it will send data back to the base.

  2. Hi! I have some problems try to configure this chip.

    Im using python code to send commads and the chip dont response.

    When you write into UART, exactly, which set of bytes have to be sent? “C3C3C3” in utf8 or text strings “0xC30xC30xC3” in utf8 too?

    When sending control commands through the serial port, should they be sent separately for a certain period of time? 2 3 4 or N milliseconds?

    Thx for advance!

    Regards!

    • Hello

      I believe you should cast it as byte or convert C3 to decimal (195) and send it as a byte array.

      values = bytearray([195, 195, 195])
      ser.write(values)

      The timing between messages are handled by the AUX pin so you have to wait for it to go high before sending again. You can also add time delays between commands if you want.

      • Hi,

        I tried out to write a uint8_t buffer (0xC0 0x00 0x00 0x3D 0x17 0xC4 ,
        all converted in integers), but now my module doesn‘t work anymore. It worked well with the default settings but now with the same installation the serial monitor only shows zeros (I transmitt some chars). After that i wrote the default parameters into the buffer and sent that to my modules, still nothing works out. But the thing is that this nice program here shows me my parameters in hex format and they are exactly the ones that i wrote to the module. I have no delay between my ser.write(buffer,6) command, is that a problem? It really confuses me that the programm shows all the registers which are equal to my buffer data! …

        maybe one of you could show me a working write-codefragment?

        Thanks for any help!

  3. I am trying to connect two E32-TTL-100 modules using two Raspberry Pi B+.
    So far I have managed to read settings and version using Python pyserial on both modules.
    I’ve managed also to change address of both to x00 x01 and x00 x02 respectively. Both are set to the same channel x17.

    But, when I send data (in mode 0) by sending bytes x00 x02 x17 + actual data, from first module, UART on second Rpi don’t receive anything from RF module. The same is true when I try the other way.

    Both Rpi-s are on the same table, modules are very close to each other. Both modules have a small SMA antenna attached.

    Am I missing something? What else should I check to get it working?

    • Hi Toni,
      I am trying to do the same as you and I face the same difficulties. Could you please share an update? Did you finally succeed? Can we share insights in order to make it work?
      Thanks in advance
      Samuel

      • Almost the same here,

        I use one transceiver as transmitter(A) and the other transceiver as receiver (B)
        Transceiver A parameters are set with the following code:
        0xC2 0x02 0x02 0x1A 0x17 0xc4

        Transceiver B parameters are set with the following code:
        0xC2 0x04 0x04 0x1A 0x17 0xc4

        What i also did is that i increased the distance (to about 1.5 meter) because the transmiter yells at 1 Watt? But maybe this is still too close. Or maybe a too short distance doesnt matter.. Another thing i noticed, that i receive only one time the data and thats it.

        So what i do is i send every second x04(high address) + x04(low address) + x17(channel) + 58 data bytes without any delays in between.

        The first package of 58 bytes i receive. than thats it..

        Harmen

  4. nice post, i have some problem using LORA device with arduino. have you read the datasheet of LORA E32 ? they said the “the purposed current is not less than 300mA”. while arduino has not over than 40mA for each pin (RX TX also). i’ve try to send string data continuesly between arduino, but it work not over 5 minutes. maybe pull up resistor is needed, but dont know spesific size for that.

  5. I tried to communicate in Fixed Transmission mode. I have changed receiver setting by specifying address and change to fixed transmission mode as following

    uint8_t setRadio[] = {0xC0,0x00,0x02,0x1A,0x17,0xC0};

    Then I tried to send a message from transmitter as following

    msg[] = {0x00,0x02,0x17,’Hello’};
    softserial.write(msg,sizeof(msg));

    But at receiver side there are no any incoming messages.
    what am I missing?

  6. Hello,

    how i can communicate with other LoRa Transceivers ? I think it must be possible, if the sync word, the channel and the baud rate are the same.

    Regards,
    Thomas

  7. Hi Toni,

    Hope that you made it worked with Raspberry since.
    I am actually trying E32 with Raspberry 3 and can not receive the messages. Could you please share your insights?
    Thanks,
    Sam

  8. Hi,
    Does anybody know what is the actual purpose/usage of the
    ADDH and ADDL?

    does it need to change for each module?

    thanks

  9. Anyone has Arduino IDE example code for a simple version check?

  10. Hi,
    Thanks your great info. Your example code works for 1 transmitter + 1 receiver. Now I have 6 transmitters keep sending message to 1 receiver. may I know how the receiver receiver message from 5 transmitters?

    how to set the channel and address for 5 transmitters,
    and how to set are the channel and address settings for the recipient?

    • I have a similar project, Keep the signals on one channel. On start-up, send a time signal pulse to all transmitters to give a start time stamp, then for each transmitter, stagger the signal transmission so they don’t collide with each other, ie transmitter 1, go first, then #2 delayed 100ms etc, #3 delay 200ms. depends on packet size, but a surprising amount of data comes through.

      • Good day!
        Where can you see this project of yours?
        I am also very interested in the case when there are several transmitters and one LoRa receiver.

Leave a Reply

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