Two Arduinos communicating at 3km distance

Two Arduinos communicating at 3km distance © MIT

Simple communication system with lora E32 and Arduino, ideal for simple telemetry.

  • 7,591 views
  • 1 comment
  • 19 respects

Components and supplies

About this project

LoRa (Long Range) is a long-range, low-power wireless communication technology. These characteristics make LoRa an excellent technology for use in wireless IoT (Internet of Things) networks, and in this post we will use LoRa with Arduino, performing a basic communication between two boards using the LoRa 433MHz module.

Module LoRa 433MHz

The LoRa 433MHz module works through a serial interface with TX and RX pins. So we were able to easily integrate it with Arduino and use the Serial functions already well known by Arduino programmers.

The communication distance can reach up to 3 km depending on the antennas used, ambient conditions and radio and magnetic interference.

The LoRa 433MHz module works through a serial interface with TX and RX pins. So we were able to easily integrate it with Arduino and use the Serial functions already well known by Arduino programmers.

The supply can be 3.3V or 5V and the serial communication is TTL with a recommended level of 3.6V maximum. This means that a secure connection can be made with 3.3V cards such as ESP8266. We did a test connecting the module to the Arduino with 5V level communication and it also worked, but note that it is not recommended.

This module has 4 operating modes. The most basic mode for simple communication is Normal Mode. For this mode, pins M0 and M1 must be set to GND (level 0). In other posts we will explore other modes of operation such as Power Saving, Sleep and Wake-up Mode.

Connection circuit (TX)

The connections with the Arduino are extremely simple, only two digital pins one for the TX of the module and the other for the RX.

Connection circuit (RX)

On the receiver side we follow the same idea but we add an LED strip to indicate when the receiver has received data, so whenever the LED strip flashes it means that the receiver is receiving some data packet.

Bonus PCB Shield

I decided to go a little further and designed a simple shield to attach the Lora E32 module using an arduino for mini, the project is more compact and looks like a final product, you can download the Gerber file and produce it at https://jlcpcb.com/

gerber_file: https://bit.ly/3ntaEzh



Code

TX CodeArduino
#include <SoftwareSerial.h>

SoftwareSerial loraSerial(2, 3); // TX, RX pinos digitais do lora e32


void setup() {
  Serial.begin(9600);
  loraSerial.begin(9600); // velocidade da porta serial do mdulo configurada antes

}

void loop() {
   loraSerial.println("Hello RX");
   Serial.println("Sending");
   delay(1000);
}
RX CodeArduino
#include <SoftwareSerial.h>
#include <Adafruit_NeoPixel.h> // biblioteca para controle da fita de led

Adafruit_NeoPixel pixels(6, 5, NEO_GRB + NEO_KHZ800); // numero de leds e pino de controle

SoftwareSerial loraSerial(2, 3); // TX, RX pinos digitais do lora e32


void setup() {
  Serial.begin(9600);
  loraSerial.begin(9600); // velocidade da porta serial do mdulo configurada antes
  pixels.begin();

}

void loop() {
  while (loraSerial.available()) {
    Serial.write(loraSerial.read());// mostra no monitor serial a mensagem recebida
    
    for (int i = 0; i < 6; i++) { //liga todos os leds da fita
      pixels.setPixelColor(i, pixels.Color(0, 255, 0));
      pixels.show();
    }
  }
  pixels.clear(); // apaga os leds quando no h mensagens para ler
}

Schematics

Comments

Similar projects you might like

Measuring Distance with Sound

by Giannis Arvanitakis

  • 16,404 views
  • 2 comments
  • 39 respects

Distance Measurement Vehicle via Websocket

Project tutorial by Matthew Lee

  • 16,731 views
  • 2 comments
  • 88 respects

How to communicate two Arduinos via RS485

Project tutorial by Moreira

  • 228 views
  • 0 comments
  • 1 respect

Simple Ultrasonic Distance Measurer With LCD Display

Project showcase by onatto22

  • 19,055 views
  • 6 comments
  • 38 respects
Add projectSign up / Login