Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
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 hours2,836
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
Grove - Barometer Sensor (BMP280)
Seeed Studio Grove - Barometer Sensor (BMP280)
×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 without vario

schematic ESP32 LORA with GPS and Battery Voltage

UPDATE with vario

schematic ESP32 LORA with GPS and Battery Voltage and vario

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 update vario source code mit app inventor

Java
aia file for mit app inventor
No preview (download only).

Frank Reijn udate with CRC

Arduino
transmitter
Error opening file.

Frank Reijn udate with CRC receiver

Arduino
receiver code with CRC
Error opening file.

android App

Java
No preview (download only).

telemetrie_lora_emetteur_yves_v1_1_a.ino

Arduino
update vario
//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 <Adafruit_BMP280.h>


Adafruit_BMP280 bmp; // I2C
#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 2
#define GPS_RX 23

// CODE FROM ANDREI's Project https://www.instructables.com/id/DIY-Arduino-Variometer-for-Paragliding
float vario = 0;    
byte samples = 40;    
byte maxsamples = 50;
float alt[51];                                                       
float tim[51];  
float tempo = millis();             // Beschreibung einer Tempovariablen vom Typ float und Zuweisung eines Wertes mit der Funktion millis () - Zhlt die Zeit ab Programmstart in Millisekunden
float N1 = 0;                       // Variable zur Mittelwertbildung                                 
float N2 = 0;                       // Variable zur Mittelwertbildung                                
float N3 = 0;                       // Variable zur Mittelwertbildung                                 
float D1 = 0;                       // Variable zur Mittelwertbildung                               
float D2 = 0;                       // Variable zur Mittelwertbildung       



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

int sensorValue = 0;  
  float meters ;
  float metersbmp280 ;
float temperaturebmp280 ;

#define BAND 866E6

//OLED pins
#define BMP_SDA 21
#define BMP_SCL 22
#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;
int Time_GPS_seconds;

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



void setup() {
    GPSSerial.begin(9600, SERIAL_8N1, 23, 2);

    if (!bmp.begin(0x76)) {
    Serial.println(F("Could not find a valid BMP280 sensor, check wiring!"));
    while (1);
  }
  //reset OLED display via software
  pinMode(OLED_RST, OUTPUT);
  digitalWrite(OLED_RST, LOW);
  delay(20);
  digitalWrite(OLED_RST, HIGH);


  
 /* Default settings from datasheet. */
  bmp.setSampling(Adafruit_BMP280::MODE_NORMAL,     /* Operating Mode. */
                  Adafruit_BMP280::SAMPLING_X2,     /* Temp. oversampling */
                  Adafruit_BMP280::SAMPLING_X16,    /* Pressure oversampling */
                  Adafruit_BMP280::FILTER_X16,      /* Filtering. */
                  Adafruit_BMP280::STANDBY_MS_500); /* Standby time. */

altitude0BMP280=(bmp.readAltitude(1023.5));

  //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() {
  Wire.begin(BMP_SDA, BMP_SCL);
   bmp280();
  Vout = float(((analogRead(potPin))*(5/4095.00)*8.4803-0.0894)*0.7167143); 

  Serial.print(F("Temperature = "));
    Serial.print(bmp.readTemperature());
    Serial.println(" *C");

    Serial.print(F("Pressure = "));
    Serial.print(bmp.readPressure());
    Serial.println(" Pa");

    Serial.print(F("Approx altitude = "));
    Serial.print(bmp.readAltitude(1030)); /* Adjusted to local forecast! */
    Serial.println(" m");

 updateValues();

  VarioMSCalculation();
  
  //Send LoRa packet to receiver
  LoRa.beginPacket();
  LoRa.print("#"+(String(gps.time.hour()+2)+(":")+(gps.time.minute())+(":")+(gps.time.second())+","+String(gps.location.lat(), 6)+","+String(gps.location.lng(), 6)+(",")+String(gps.altitude.meters(),0)+(",")+String(gps.speed.kmph())));
  LoRa.print(",");
  LoRa.print(Vout);
  LoRa.print(",");
  LoRa.print((metersbmp280-altitude0BMP280),1 );
  LoRa.print(",");
  LoRa.print(temperaturebmp280,0  );
  LoRa.print(",");
  LoRa.print(vario);
  LoRa.print(",");
  LoRa.print(GPS_Distance);
  LoRa.print(",");
  LoRa.print(String(Time_GPS_seconds));
  LoRa.print(",");
  LoRa.print(counter);
  LoRa.endPacket();



  
  Wire.begin(OLED_SDA, OLED_SCL);
  display.clearDisplay();
  display.setCursor(0,0);
  display.print("Vbat:");
  display.print(Vout);
  display.print(" Alt:");
  display.print(gps.altitude.meters(),0); 
  display.setCursor(0,9);
  display.print("lat : ");
  display.print(gps.location.lat(),4 );            
  display.setCursor(0,18);
  display.print(" long : ");
  display.print(gps.location.lng(),4);
  display.setCursor(0,27);
  display.print("Vitesse: ");
  display.print((gps.speed.kmph()) );
   display.setCursor(0,36);
  display.print("Heure : ");
  display.print(String(gps.time.hour()+2)+(":")+(gps.time.minute())+(":")+(gps.time.second()) );
   display.setCursor(0,45);
  display.print("Vario : ");
  display.print (vario);
  display.print("    m/s ");
   display.setCursor(0,54);
  display.print("Hbmp:");
  display.print((metersbmp280-altitude0BMP280),1 );
display.print("  Tbmp:");
  display.print(temperaturebmp280,0 );

  
  display.display();



  
  counter++;
  
  delay(100);
}

void updateValues()
{


while (GPSSerial.available() > 0){
  int data = GPSSerial.read();
  Serial.println(data);
   

    if (gps.encode(data))
   {
    float Starting_Latitude = 0;
  float Starting_Longitude = 0;  

gps.encode(GPSSerial.read());
 Serial.write(GPSSerial.read());
float meters = (gps.altitude.meters());
  
  int airSpeed =( gps.speed.kmph());
  
if ( gps.location.lat() > 0.0 and gps.location.lng() > 0.0)
  {
   Starting_Longitude = gps.location.lng();
    Starting_Latitude = gps.location.lat();
    
  }
  
     
  GPS_Distance = (gps.distanceBetween( gps.location.lat(), gps.location.lng(), Starting_Latitude, Starting_Longitude)) ;
   
speed1 = (gps.speed.kmph(),0);
  
  String Temps=String(gps.time.hour()+2)+(":")+(gps.time.minute())+(":")+(gps.time.second());
  String Date=String(gps.date.day())+("/")+(gps.date.month())+("/")+(gps.date.year());
  Time_GPS_seconds=((gps.time.hour()+2)*3600)+((gps.time.minute())*60)+(gps.time.second());
}
}
}

void bmp280()
{
  metersbmp280=(bmp.readAltitude(1023.5));
  temperaturebmp280=(bmp.readTemperature());
}

// Variofunktion FROM ANDREI's Project https://www.instructables.com/id/DIY-Arduino-Variometer-for-Paragliding
void VarioMSCalculation(){
  tempo = millis();                                                       // Beschreibung einer Tempovariablen vom Typ float und Zuweisung eines Wertes mit der Funktion millis () - Zhlt die Zeit ab Programmstart in Millisekunden
  N1 = 0;                                                                 // Variable zur Mittelwertbildung
  N2 = 0;                                                                 // Variable zur Mittelwertbildung
  N3 = 0;                                                                 // Variable zur Mittelwertbildung
  D1 = 0;                                                                 // Variable zur Mittelwertbildung
  D2 = 0;                                                                 // Variable zur Mittelwertbildung
  
  ////// ZERO VARIO /////
  vario = 0;       
  
  
  for(int cc=1; cc<=maxsamples; cc++)                                     // Averager 
  {                                                                       // 
    alt[(cc-1)] = alt[cc];                                                // http://www.instructables.com/id/GoFly-paraglidinghanglidinggliding-altimeter-v/?ALLSTEPS
    tim[(cc-1)] = tim[cc];                                                // http://redhats.ru/variometer-arduino-2015/
  }                                                                       //
                                                                          //
  alt[maxsamples] = bmp.readAltitude();                                   //
  tim[maxsamples] = tempo;                                                //
  float stime = tim[maxsamples-samples];                                  //
                                                                          //
  for(int cc=(maxsamples-samples); cc<maxsamples; cc++)                   //
  {                                                                       //
    N1+=(tim[cc]-stime)*alt[cc];                                          //
    N2+=(tim[cc]-stime);                                                  //
    N3+=(alt[cc]);                                                        //
    D1+=(tim[cc]-stime)*(tim[cc]-stime);                                  //
    D2+=(tim[cc]-stime);                                                  //
  }                                                                       // Durchschnittliches Krperende 
  
  /////VARIO VALUES CALCULATING /////
  vario=1000*((samples*N1)-N2*N3)/(samples*D1-D2*D2);                     // BERECHNUNG VON VARIOMETERWERTEN

  

}

telemetrie_lora_recepteur_yves_v1_1_a.ino

Arduino
update vario
//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_7, delimiter_8 , delimiter_9, delimiter_10 , delimiter_11;

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);
delimiter_7 = readString.indexOf(",", delimiter_6 +1);
delimiter_8 = readString.indexOf(",", delimiter_7 +1);
delimiter_9 = readString.indexOf(",", delimiter_8 +1);
delimiter_10 = readString.indexOf(",", delimiter_9 +1);
delimiter_11 = readString.indexOf(",", delimiter_10 +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 Hbmp = readString.substring(delimiter_6 + 1, delimiter_7);
String Tbmp = readString.substring(delimiter_7 + 1, delimiter_8);
String Vario = readString.substring(delimiter_8 + 1, delimiter_9);
String Distance = readString.substring(delimiter_9 + 1, delimiter_10);
String Time_gps_seconds = readString.substring(delimiter_10 + 1, delimiter_11);

String RSSI = String(rssi);


   display.clearDisplay();
   display.setCursor(0,0);
   display.print("Lat:");
   display.print(latitude);
   
   SerialBT.println("Heure="+ String(heure)+"="+"Latitude="+String(latitude)+"="+"Longitude="+String(longitude)+"="+"Altitude="+String(altitude1)+"="+"vitesse="+String(vitesse)+"="+"VoltageBatt="+String(voltage)+"="+"Hbmp="+String(Hbmp)+"="+"Tbmp="+String(Tbmp)+"="+"Vario="+String(Vario)+"="+"Distance="+String(Distance)+"=""Secondes="+String(Time_gps_seconds)+"="+"RSSI="+String(RSSI));
  delay(500);
    
   display.setCursor(0,10);
   display.print("Long:");
   display.print(longitude);
   display.setCursor(0,20);
    display.print("Alt:");
   display.print(altitude1);
    display.print("  Vgps:");
    display.print(vitesse);
    display.setCursor(0,30);
    display.print("Hbmp :");
    display.print(Hbmp); 
   display.setCursor(0,40);
    display.print("Vario:");
    display.print(Vario);
    display.print(" Dist:");
    display.print(Distance);
    display.setCursor(0,50);
  display.print("Vbat ");
    display.print(voltage);
    display.print(" RSSI:");
    display.print(rssi);
   
   display.display();   
   
   delay(500);
  
 
  }
  }

  

android App update vario

Java
No preview (download only).

tiny gps++

Credits

yvesmorele
9 projects • 47 followers
chemical scientist

Comments