Project tutorial
Simple Arduino LoRa Communciation (8km)

Simple Arduino LoRa Communciation (8km) © CC BY-NC-SA

We are going to test EByte E32-TTL-100 with my library. It is a wireless transceiver module, operates at 410 441 MHz (or 868MHz or 915MHz).

  • 16,216 views
  • 0 comments
  • 8 respects

Components and supplies

Apps and online services

About this project

We are going to test E32-TTL-100. It is a wireless transceiver module, operates at 410 441 MHz (or 868MHz or 915MHz) based on original RFIC SX1278 from SEMTECH, transparent transmission is available, TTL level. The module adopts LORA spread spectrum technology.

Supplies:

Optional

Devices Specs

The module features FEC Forward Error Correction algorithm, which ensure its high coding efficiency & good correction performance. In the case of sudden interference, it can correct the interfered data packets automatically, so that the reliability and transmission range are improved correspondingly. But without FEC, those da te packets can only be dropped. And with the rigorous encryption & decryption, data interception becomes pointless. The function of data compression can decrease the transmission time & probability of being interference, while improving the reliability & transmission efficiency.

  • Module size: 21*36mm
  • Antenna type: SMA-K (50Ω impedance)
  • Transmission distance: 3000m(max)
  • Maximum power: 2dB(100mW)
  • Air rates: 2.4Kbps (6 optional level (0.3, 1.2, 2.4, 4.8, 9.6, 19.2kbps)
  • Emission length: 512ByteReceive
  • 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)

Transmission Type

Transparent transmissionThis can be considered like a “Demo mode”, by default you can send message to all device of same configured address and channel.

Fixed transmission

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

  • Specified device with a predeterminated Address Low, Address High and Channel.
  • Broadcast message to a set of channel devices Normal mode Simply send message.

Device Mode

Normal mode

Simply send 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.

You can Wake Up device and microcontroller via WOR.

Program/sleep mode

With this configuration you can change configuration of your device.

Wiring Device

Here the schema of connection of the device, this is a fully connected, with management of M0 and M1 pin permit to change modality of the device, so you can switch to configuration or wake up mode with program, the library help you in all this operation.

Configuration

Exist a specified command to set and get configuration

/*
* LoRa E32-TTL-100
* Get configuration.
* https://www.mischianti.org
*
* E32-TTL-100----- Arduino UNO
* M0 ----- 3.3v
* M1 ----- 3.3v
* RX ----- PIN 2 (PullUP & Voltage divider)
* TX ----- PIN 3 (PullUP)
* AUX ----- Not connected
* VCC ----- 3.3v/5v
* GND ----- GND
*
*/
#include "Arduino.h"
#include "LoRa_E32.h"

LoRa_E32 e32ttl100(2, 3); // RX, TX
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 : ")); 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 : ")); Serial.println(configuration.ADDH, BIN);
Serial.print(F("AddL : ")); Serial.println(configuration.ADDL, BIN);
Serial.print(F("Chan : ")); Serial.print(configuration.CHAN, DEC); Serial.print(" -> "); Serial.println(configuration.getChannelDescription());
Serial.println(F(" "));
Serial.print(F("SpeedParityBit : ")); Serial.print(configuration.SPED.uartParity, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTParityDescription());
Serial.print(F("SpeedUARTDataRate : ")); Serial.print(configuration.SPED.uartBaudRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTBaudRate());
Serial.print(F("SpeedAirDataRate : ")); Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRate());

Serial.print(F("OptionTrans : ")); Serial.print(configuration.OPTION.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFixedTransmissionDescription());
Serial.print(F("OptionPullup : ")); Serial.print(configuration.OPTION.ioDriveMode, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getIODroveModeDescription());
Serial.print(F("OptionWakeup : ")); Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());
Serial.print(F("OptionFEC : ")); Serial.print(configuration.OPTION.fec, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFECDescription());
Serial.print(F("OptionPower : ")); 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 : ")); 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("----------------------------------------");

}

Configuration Result

And the result become

Begin
Success
1
----------------------------------------
HEAD : 11000000 192 C0
AddH : 0
AddL : 0
Chan : 23 -> 433MHz
SpeedParityBit : 0 -> 8N1 (Default)
SpeedUARTDataRate : 11 -> 9600bps (default)
SpeedAirDataRate : 10 -> 2.4kbps (default)
OptionTrans : 0 -> Transparent transmission (default)
OptionPullup : 1 -> TXD, RXD, AUX are push-pulls/pull-ups
OptionWakeup : 0 -> 250ms (default)
OptionFEC : 1 -> Turn on Forward Error Correction Switch (Default)
OptionPower : 0 -> 20dBm (Default)
----------------------------------------
Success
1
----------------------------------------
HEAD : 11000011 195 C3
Model no.: 32
Version : 44
Features : 14
----------------------------------------Step 7: Send Message

Send simple message

Here a simple sketch to send a message to all device attached to the channel

/*
* LoRa E32-TTL-100
* Write on serial to transfer a message to other device
* https://www.mischianti.org
*
* E32-TTL-100----- Arduino UNO
* M0 ----- GND
* M1 ----- GND
* TX ----- RX PIN 2 (PullUP)
* RX ----- TX PIN 3 (PullUP & Voltage divider)
* AUX ----- Not connected
* VCC ----- 3.3v/5v
* GND ----- GND
*
*/
#include "Arduino.h"
#include "LoRa_E32.h"

LoRa_E32 e32ttl100(2, 3); // RX, TX

void setup() {
Serial.begin(9600);
delay(500);

Serial.println("Hi, I'm going to send message!");

// Startup all pins and UART
e32ttl100.begin();

// Send message
ResponseStatus rs = e32ttl100.sendMessage("Hello, world?");
// Check If there is some problem of succesfully send
Serial.println(rs.getResponseDescription());
}

void loop() {
// If something available
if (e32ttl100.available()>1) {
// read the String message
ResponseContainer rc = e32ttl100.receiveMessage();
// Is something goes wrong print error
if (rc.status.code!=1){
rc.status.getResponseDescription();
}else{
// Print the data received
Serial.println(rc.data);
}
}
if (Serial.available()) {
String input = Serial.readString();
e32ttl100.sendMessage(input);
}
}

WOR Wake on radio

You can also send a wake message and wake a microcontroller in sleep mode, a fantastic and usefully features to manage sensors reading in a wide area.

Here a simple sketch that receive message and wake the device and the microcontroller.

/*
* LoRa E32-TTL-100
* Receive fixed transmission message on channel.
* https://www.mischianti.org/2019/12/28/lora-e32-device-for-arduino-esp32-or-esp8266-wor-wake-on-radio-the-microcontroller-also-and-new-arduino-shield-part-6/
*
* E32-TTL-100----- Arduino UNO or esp8266
* M0 ----- 3.3v (To config) GND (To send) 7 (To dinamically manage)
* M1 ----- 3.3v (To config) GND (To send) 6 (To dinamically manage)
* TX ----- RX PIN 3 (PullUP)
* RX ----- TX PIN 4 (PullUP & Voltage divider)
* AUX ----- PIN 2 (PullUP)
* VCC ----- 3.3v/5v
* GND ----- GND
*
*/
#include "Arduino.h"
#include "LowPower.h"
#include "LoRa_E32.h"
// ---------- Arduino pins --------------
//LoRa_E32 e32ttl(4, 5, 3, 7, 6);
LoRa_E32 e32ttl(4, 5, 3); // Config without connect M0 M1
// Use pin 2 as wake up pin
const int wakeUpPin = 3;
//#include <SoftwareSerial.h>
//SoftwareSerial mySerial(4, 5); // Arduino RX <-- e32 TX, Arduino TX --> e32 RX
//LoRa_E32 e32ttl(&amp;mySerial, 3, 7, 6);
// -------------------------------------
void printParameters(struct Configuration configuration);
void printModuleInformation(struct ModuleInformation moduleInformation);
void wakeUp()
{
Serial.println("WAKE!");
}
//The setup function is called once at startup of the sketch
void setup()
{
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB
}
delay(100);
e32ttl.begin();
// e32ttl.resetModule();
// After set configuration comment set M0 and M1 to low
// and reboot if you directly set HIGH M0 and M1 to program
// ResponseStructContainer c;
// c = e32ttl.getConfiguration();
// Configuration configuration = *(Configuration*) c.data;
// configuration.ADDL = 3;
// configuration.ADDH = 0;
// configuration.CHAN = 0x04;
// configuration.OPTION.fixedTransmission = FT_FIXED_TRANSMISSION;
// configuration.OPTION.wirelessWakeupTime = WAKE_UP_250;
//
// configuration.OPTION.fec = FEC_1_ON;
// configuration.OPTION.ioDriveMode = IO_D_MODE_PUSH_PULLS_PULL_UPS;
// configuration.OPTION.transmissionPower = POWER_20;
//
// configuration.SPED.airDataRate = AIR_DATA_RATE_010_24;
// configuration.SPED.uartBaudRate = UART_BPS_9600;
// configuration.SPED.uartParity = MODE_00_8N1;
//
// e32ttl.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
// printParameters(configuration);
// ---------------------------
Serial.println();
Serial.println("Start listening!");
e32ttl.setMode(MODE_2_POWER_SAVING);
// Allow wake up pin to trigger interrupt on low.
attachInterrupt(0, wakeUp, LOW);
// Enter power down state with ADC and BOD module disabled.
// Wake up when wake up pin is low.
LowPower.powerDown(SLEEP_FOREVER, ADC_OFF, BOD_OFF);
// Disable external pin interrupt on wake up pin.
detachInterrupt(0);
Serial.println("OK listening!");
}
// The loop function is called in an endless loop
void loop()
{
if (e32ttl.available() > 1){
ResponseContainer rs = e32ttl.receiveMessage();
// First of all get the data
String message = rs.data;
Serial.print("Received --> ");
Serial.print(rs.status.getResponseDescription());
Serial.print(" - ");
Serial.println(message);
}
delay(125);
}
void printParameters(struct Configuration configuration) {
Serial.println("----------------------------------------");
Serial.print(F("HEAD : ")); 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 : ")); Serial.println(configuration.ADDH, DEC);
Serial.print(F("AddL : ")); Serial.println(configuration.ADDL, DEC);
Serial.print(F("Chan : ")); Serial.print(configuration.CHAN, DEC); Serial.print(" -> "); Serial.println(configuration.getChannelDescription());
Serial.println(F(" "));
Serial.print(F("SpeedParityBit : ")); Serial.print(configuration.SPED.uartParity, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTParityDescription());
Serial.print(F("SpeedUARTDatte : ")); Serial.print(configuration.SPED.uartBaudRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getUARTBaudRate());
Serial.print(F("SpeedAirDataRate : ")); Serial.print(configuration.SPED.airDataRate, BIN);Serial.print(" -> "); Serial.println(configuration.SPED.getAirDataRate());
Serial.print(F("OptionTrans : ")); Serial.print(configuration.OPTION.fixedTransmission, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFixedTransmissionDescription());
Serial.print(F("OptionPullup : ")); Serial.print(configuration.OPTION.ioDriveMode, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getIODroveModeDescription());
Serial.print(F("OptionWakeup : ")); Serial.print(configuration.OPTION.wirelessWakeupTime, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getWirelessWakeUPTimeDescription());
Serial.print(F("OptionFEC : ")); Serial.print(configuration.OPTION.fec, BIN);Serial.print(" -> "); Serial.println(configuration.OPTION.getFECDescription());
Serial.print(F("OptionPower : ")); 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("----------------------------------------");
}

Arduino and esp8266 shield

I create also a shield for Arduino that become very usefully for prototyping.

And I release It as open source project here

https://www.pcbway.com/project/shareproject/LoRa_E32_Series_device_Arduino_shield.html

https://www.pcbway.com/project/shareproject/LoRa_E32_Series_device_WeMos_D1_mini_shield_RF_8km_range.html

Library

GitHub repository https://github.com/xreef/LoRa_E32_Series_Library

Support forum

Additional documentation

Code

Github
https://github.com/xreef/LoRa_E32_Series_Library

Schematics

Arduino connection schema for e32
Fdi5q81kb6ie13u large1 mtdakyojot

Comments

Similar projects you might like

LoRa E32 Device for Arduino, ESP32 or ESP8266: Library

Project tutorial by Renzo Mischianti

  • 15,226 views
  • 3 comments
  • 23 respects

Using the RAK811 LoRa module with Arduino

Project tutorial by Naresh krish

  • 19,885 views
  • 5 comments
  • 15 respects

Simple Arduino Optical Chopper

Project tutorial by Brendan Sweeny

  • 4,411 views
  • 0 comments
  • 7 respects

*Duino LoRa Field Gateway Clients

Project tutorial by Bryn Lewis

  • 3,348 views
  • 0 comments
  • 8 respects

Simple Arduino Uno - ESP 8266 Integration

Project tutorial by circuito.io team

  • 132,014 views
  • 26 comments
  • 109 respects

Mobile Controlled Bluetooth Car || Easy || Simple || HC-05

Project tutorial by Vishal soni

  • 45,019 views
  • 6 comments
  • 34 respects
Add projectSign up / Login