LoRa or Long Range wireless data telemetry is a technology pioneered by Semtech that operates at a lower frequency than NRF24L01 (433 MHz, 868 MHz or 916 MHz agains 2.4 GHz for the NRF24L01) but at thrice and more the distance (from 3000m to 8000m).
You can find It here on Aliexpress
We are going to test E32-TTL-100. It is a wireless transceiver module, operates at 410 441 MHz based on original RFIC SX1278 from SEMTECH, transparent transmission is available, TTL level. The module adopts LORA spread spectrum technology.
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.
Operating and transmission typeThis device have some interesting function:
TransmissionTransparent transmission
This 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 a message on predeterminated Channel.
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.
Program/sleep mode
With this configuration you can change configuration of your device.
SpecificationsHere’s 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 level (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
You must pay attention on communication level that differ from power supply, the second can receive voltage like 3.3v (esp8266 and esp32) and 5v (Arduino), but the first want a 3.3v, so to connecto to an Arduino you must use a Voltage divider (Voltage divider: calculator and application) to prevent damage to the device.
PinoutAs you can see you can set various modes via M0 and M1 pins.
For the next simple test we are going to use Normal mode.
Connecting Wemos D1 mini (esp8266) for a basic usageesp8266 have the advantage to have same voltage of communication interface so the connection schema is more simple than Arduino.
Arduino working voltage is 5v, so we need to add a voltage divider on RX pin of LoRa module to prevent damage, you can get more information here Voltage divider: calculator and application.
If you put to 0 M1 and M0 pin you enter in “Normal” mode, than you can receive and trasmit all the data from device A to B, this modality is defined “Trasparent transmission”.
You can use 2 Arduinos or 2 Wemos D1 mini or one of kind.
At start send a message and if you write on serial from one of device the text is transferred to the other device. You can use 2 Arduinos or 2 Wemos or one and one as you prefer.
Arduino sketch:
/*
* LoRa E32-TTL-100
* Start device or reset to send a message
* https://www.mischianti.org/2019/10/15/lora-e32-device-for-arduino-esp32-or-esp8266-specs-and-basic-usage-part-1/
*
* E32-TTL-100----- Arduino UNO
* M0 ----- GND
* M1 ----- GND
* RX ----- PIN 2 (PullUP & Voltage divider)
* TX ----- PIN 3 (PullUP)
* AUX ----- Not connected
* VCC ----- 3.3v/5v
* GND ----- GND
*
*/
#include "Arduino.h"
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
void setup() {
Serial.begin(9600);
delay(500);
Serial.println("Hi, I'm going to send message!");
mySerial.begin(9600);
mySerial.println("Hello, world?");
}
void loop() {
if (mySerial.available()) {
Serial.write(mySerial.read());
}
if (Serial.available()) {
mySerial.write(Serial.read());
}
}
Wemos D1 mini sketch:
/*
* LoRa E32-TTL-100
* Start device or reset to send a message
* https://www.mischianti.org/2019/10/15/lora-e32-device-for-arduino-esp32-or-esp8266-specs-and-basic-usage-part-1/
*
* E32-TTL-100----- Wemos D1 mini
* M0 ----- GND
* M1 ----- GND
* RX ----- PIN D2 (PullUP)
* TX ----- PIN D3 (PullUP)
* AUX ----- Not connected
* VCC ----- 3.3v/5v
* GND ----- GND
*
*/
#include "Arduino.h"
#include <SoftwareSerial.h>
SoftwareSerial mySerial(D2, D3); // RX, TX
void setup() {
Serial.begin(9600);
delay(500);
Serial.println("Hi, I'm going to send message!");
mySerial.begin(9600);
mySerial.println("Hello, world?");
}
void loop() {
if (mySerial.available()) {
Serial.write(mySerial.read());
}
if (Serial.available()) {
mySerial.write(Serial.read());
}
}
But this basic usage is quite unusefully, so in the next chapter we are going to use my library and go in deep of device features.
LibraryHere the last example with my library:
Arduino sketch:
/*
* LoRa E32-TTL-100
* Write on serial to transfer a message to other device
* https://www.mischianti.org/2019/10/15/lora-e32-device-for-arduino-esp32-or-esp8266-specs-and-basic-usage-part-1/
*
* E32-TTL-100----- Arduino UNO
* M0 ----- GND
* M1 ----- GND
* 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 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);
}
}
Here the Wemos D1 (esp8266) sketch:
/*
* LoRa E32-TTL-100
* Start device or reset to send a message
* https://www.mischianti.org/2019/10/15/lora-e32-device-for-arduino-esp32-or-esp8266-specs-and-basic-usage-part-1/
*
* E32-TTL-100----- Wemos D1 mini
* M0 ----- GND
* M1 ----- GND
* RX ----- PIN D2 (PullUP)
* TX ----- PIN D3 (PullUP)
* AUX ----- Not connected
* VCC ----- 3.3v/5v
* GND ----- GND
*
*/
#include "Arduino.h"
#include "LoRa_E32.h"
LoRa_E32 e32ttl100(D2, D3); // 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);
}
}
If you have already change configuration you must restore base parameter:
// If you have ever change configuration you must restore It
ResponseStructContainer c;
c = e32ttl100.getConfiguration();
Configuration configuration = *(Configuration*) c.data;
Serial.println(c.status.getResponseDescription());
configuration.CHAN = 0x17;
configuration.OPTION.fixedTransmission = FT_TRANSPARENT_TRANSMISSION;
e32ttl100.setConfiguration(configuration, WRITE_CFG_PWR_DWN_SAVE);
but we are going to see It better in the next article.
ThanksBut this kind of usage is very very reductive, in the next articles we are going more in deep, and we start to use massively the library to simplify the complex configuration and settings.
- 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
Comments