yvesmorele
Published © CC BY-NC

Universal telemetry for rc plane with android application

Universal telemetry for rc plane with android application, GPS, battery voltage, speed and more with vocal query and vocal answer.

IntermediateProtip2 hours441
Universal telemetry for rc plane with android application

Things used in this project

Hardware components

ESP32 LoRa OLED
×1
GPS NEO6MV2
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE
MIT App Inventor 2
MIT App Inventor 2

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Premium Female/Male Extension Jumper Wires, 40 x 6" (150mm)
Premium Female/Male Extension Jumper Wires, 40 x 6" (150mm)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Custom parts and enclosures

emitter top

emitter bottom

Schematics

schematic ESP32 LORA with GPS and Battery Voltage

Code

TRANSMITTER

Arduino
//Libraries for LoRa
#include <SPI.h>
#include <LoRa.h>
#include <TinyGPS++.h>
TinyGPSPlus gps;
//Libraries for OLED Display
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <HardwareSerial.h>
HardwareSerial GPSSerial(1);
//define the pins used by the LoRa transceiver module
#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26
#define dP = 34;
#define GPS_TX 22
#define GPS_RX 23



float maxspeed = 0, speed1 = 0;
int maxhigh = 0, high1 = 0;
int maxsatelite = 0, satelite1 = 0;

int sensorValue = 0;  
  float meters ;


#define BAND 866E6

//OLED pins
#define OLED_SDA 4
#define OLED_SCL 15 
#define OLED_RST 16
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

//packet counter
int counter = 0;
const int potPin = 34;
double Vout;

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RST);

void setup() {
    GPSSerial.begin(9600, SERIAL_8N1, 22, 23);
  //reset OLED display via software
  pinMode(OLED_RST, OUTPUT);
  digitalWrite(OLED_RST, LOW);
  delay(20);
  digitalWrite(OLED_RST, HIGH);

  //initialize OLED
  Wire.begin(OLED_SDA, OLED_SCL);
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false)) { // Address 0x3C for 128x32
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }
  
  display.clearDisplay();
  display.setTextColor(WHITE);
  display.setTextSize(1);
  display.setCursor(0,0);
  display.print("LORA SENDER ");
  display.display();
  
  //initialize Serial Monitor
  Serial.begin(9600);
 
  

  //SPI LoRa pins
  SPI.begin(SCK, MISO, MOSI, SS);
  //setup LoRa transceiver module
  LoRa.setPins(SS, RST, DIO0);
  
  if (!LoRa.begin(BAND)) {
   // Serial.println("Starting LoRa failed!");
    while (1);
  }
  
  display.setCursor(0,10);
  display.print("LoRa Initializing OK!");
  display.display();
  delay(2000);
}

void loop() {
   
  Vout = float(((analogRead(potPin))*(5/4095.00)*8.4803-0.0894)*0.7167143); 
 updateValues();
  //Send LoRa packet to receiver
  LoRa.beginPacket();
  LoRa.print("#"+(String(gps.time.hour()+1)+(":")+(gps.time.minute())+(":")+(gps.time.second())+","+String(gps.location.lat(), 6)+","+String(gps.location.lng(), 6)+(",")+String(gps.altitude.meters(),0)+(",")+String(speed1)));
  LoRa.print(",");
  LoRa.print(Vout);
  LoRa.print(",");
  LoRa.print(counter);
  LoRa.endPacket();
  
  display.clearDisplay();
  display.setCursor(0,0);
  display.print("Voltage Batt : ");
  display.print(Vout);
  display.setCursor(0,9);
  display.print("alitude : ");
  display.print(gps.altitude.meters());             
  display.setCursor(0,18);
   display.print("latitude : ");
  display.print(gps.location.lat() );
  display.setCursor(0,27);
  display.print("longitude : ");
  display.print(gps.location.lng());
   display.setCursor(0,36);
  display.print("vitesse : ");
  display.print(speed1 );
   display.setCursor(0,45);
  display.print("Heure : ");
  display.print(String(gps.time.hour()+1)+(":")+(gps.time.minute())+(":")+(gps.time.second()) );
   display.setCursor(0,54);
  display.print("Date : ");
  display.print(String(gps.date.day())+("/")+(gps.date.month())+("/")+(gps.date.year()) );


  
  display.display();



  
  counter++;
  
  delay(100);
}

void updateValues()
{


while (GPSSerial.available() > 0){
  int data = GPSSerial.read();
    if (gps.encode(data))
   {
      
//Serial.println(GPSSerial.read());
//Serial.println(gps.encode(GPSSerial.read()));
gps.encode(GPSSerial.read());
 Serial.write(GPSSerial.read());
float meters = (gps.altitude.meters());
  
  int airSpeed =( gps.speed.kmph());

speed1 = (gps.speed.kmph());
  //if ( speed1 > maxspeed) {
   // maxspeed = speed1;
  //}
  String Temps=String(gps.time.hour()+1)+(":")+(gps.time.minute())+(":")+(gps.time.second());
  String Date=String(gps.date.day())+("/")+(gps.date.month())+("/")+(gps.date.year());
}
}
}

RECEIVER

Arduino
receive data from transmitter and send data to bluetooth
//Librairies pour LoRa

#include <SPI.h>
#include <LoRa.h>

#include "BluetoothSerial.h"

#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif


BluetoothSerial SerialBT;

//Librairies pour ecran OLED 

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

//definition  des  pins utiliss par l'emetteur  LoRa 

#define SCK 5
#define MISO 19
#define MOSI 27
#define SS 18
#define RST 14
#define DIO0 26

//433E6 pour Asie
//866E6 pour Europe
//915E6 pour Amerique du nord
#define BAND 866E6

// pins ecran OLED

#define OLED_SDA 4
#define OLED_SCL 15 
#define OLED_RST 16
#define SCREEN_WIDTH 128 // largeur OLED , en  pixels
#define SCREEN_HEIGHT 64 // hauteur OLED , en pixels

Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RST);

String LoRaData;

void setup() { 
  
  //reset OLED display 
  pinMode(OLED_RST, OUTPUT);
  digitalWrite(OLED_RST, LOW);
  delay(20);
  digitalWrite(OLED_RST, HIGH);
  
  //initialize OLED
  Wire.begin(OLED_SDA, OLED_SCL);
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false)) { // Address 0x3C for 128x32
    Serial.println(F("SSD1306 allocation mauvaise"));
    for(;;); // boucle en permanence
  }

  display.clearDisplay();
  display.setTextColor(WHITE);
  display.setTextSize(1);
  display.setCursor(0,0);
  display.print("LORA RECEIVER ");
  display.display();
  
  //initialize Serial Monitor
  Serial.begin(115200);
 SerialBT.begin("ESP32test"); // nom du peripherique Bluetooth 
  Serial.println("LoRa Receiver Test");
  
  //SPI LoRa pins
  SPI.begin(SCK, MISO, MOSI, SS);
  //setup LoRa transceiver module
  LoRa.setPins(SS, RST, DIO0);

  if (!LoRa.begin(BAND)) {
    Serial.println("Starting LoRa failed!");
    while (1);
  }
  Serial.println("LoRa Initializing OK!");
  display.setCursor(0,10);
  display.println("LoRa Initializing OK!");
  display.display();  
}

void loop() {

  //essai analyse pauet reu
  int packetSize = LoRa.parsePacket();
  if (packetSize) {
    //reception paquet
    Serial.print("Received packet ");

    //lecture paquet
    while (LoRa.available()) {
      LoRaData = LoRa.readString();
    
    
    }

   // deinition RSSI 
  int rssi = LoRa.packetRssi();
   
  
    // SerialBT.println(LoRa.packetRssi());
    
 //   lecture donnes reues

String readString = (LoRaData);

// divise la chaine lue par un delimiteur predefini qui est la virgule 

int delimiter, delimiter_1, delimiter_2,  delimiter_3 ,  delimiter_4,  delimiter_5,  delimiter_6 ;

delimiter = readString.indexOf("#");
delimiter_1 = readString.indexOf(",", delimiter + 1);
delimiter_2 = readString.indexOf(",", delimiter_1 +1);
delimiter_3 = readString.indexOf(",", delimiter_2 +1);
delimiter_4 = readString.indexOf(",", delimiter_3 +1);
delimiter_5 = readString.indexOf(",", delimiter_4 +1);
delimiter_6 = readString.indexOf(",", delimiter_5 +1);


// definition des noms de variables avec les delimiteurs pour les sous chaines

String heure = readString.substring(delimiter + 1, delimiter_1);
String latitude = readString.substring(delimiter_1 + 1, delimiter_2);
String longitude = readString.substring(delimiter_2 + 1, delimiter_3);
String altitude1 = readString.substring(delimiter_3 + 1, delimiter_4);
String vitesse = readString.substring(delimiter_4 + 1, delimiter_5);
String voltage = readString.substring(delimiter_5 + 1, delimiter_6);
String RSSI = String(rssi);


   display.clearDisplay();
   display.setCursor(0,0);
   display.print("Heure  ");
   display.print(heure);
   
   SerialBT.println("Heure="+ String(heure)+"="+"Latitude="+String(latitude)+"="+"Longitude="+String(longitude)+"="+"Altitude="+String(altitude1)+"="+"vitesse="+String(vitesse)+"="+"VoltageBatt="+String(voltage)+"="+"RSSI="+String(RSSI));
  delay(500);
    
   display.setCursor(0,10);
   display.print("Latitude = ");
   display.print(latitude);
   
  
  
   display.setCursor(0,20);
   display.print("Longitude : ");
   display.print(longitude);
   display.setCursor(0,30);
   display.print("Altitude : ");
   display.print(altitude1);
   display.setCursor(0,40);
   display.print("vitesse : ");
    display.print(vitesse);
   display.setCursor(0,50);
   display.print("Voltage Batt : ");
    display.print(voltage);
    display.setCursor(0,60);
   display.print("RSSI : ");
   display.print(rssi);
   display.display();   
   
   delay(500);
  
 
  }
  }

  

android App

Java
No preview (download only).

Credits

yvesmorele

yvesmorele

9 projects • 30 followers
chemical scientist

Comments