Klinsman Jorge
Published © MIT

Two Arduinos communicating at 3km distance

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

IntermediateProtip1 hour13,706
Two Arduinos communicating at 3km distance

Things used in this project

Story

Read more

Schematics

TX

RX

Code

TX Code

Arduino
#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 Code

Arduino
#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
}

Credits

Klinsman Jorge

Klinsman Jorge

1 project • 7 followers

Comments

Add projectSign up / Login