5Hz GPS+BaroAlt to Bluetooth/Android over Audio channel

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
serveurperso
Posts: 7
Joined: Fri May 10, 2013 9:02 am

5Hz GPS+BaroAlt to Bluetooth/Android over Audio channel

Post by serveurperso »

Hi,

I give the code for an unidirectionnal Audio telemetry, I make this because I want very smooth display on Google Map or any other app for Android, and long range with only one powerfull TX on the Drone / one powerfull TX on groundstation with sensitive receivers.

I use the DS8500 AFSK 1200 Hart modem chip, but it work perfectly with Arduino AFSK SoftModem library on each side (I can give the code for Serial -> AFSK / AFSK -> Serial).
DS8500-KIT "plug'n'play" evaluation board on MOUSER http://fr.mouser.com/ProductDetail/Maxi ... IazpdPmg==

On GroundStation my smartphone run "Bluetooth GPS" + "Google Map" (and any other GPS recorder app), Baro Altitude is used as GPS Altitude inside groundstation NMEA generator. It is easy to add more data (for the groundstation telemetry) because there is free space inside frames for 5Hz operation.

MultiWii part :

Inside CONFIG.H

Code: Select all

  /********************************************************************/
  /****                             Pascal                         ****/
  /********************************************************************/
    #define GPSTOMODEM
    #define GPSTOMODEM_SERIAL_PORT 1 // must be 0 on Pro Mini and single serial boards; Set to your choice on any Mega based board
    #define GPSTOMODEM_FREQ 64       // 5Hz


Inside SERIAL.INO

Code: Select all

// Pascal
void gpsToModem(){
  #if !defined(PROMINI)
    CURRENTPORT=GPSTOMODEM_SERIAL_PORT;
  #endif
  serialize8('$');
  checksum[CURRENTPORT] = 0;
  serialize32(GPS_coord[LAT]);
  serialize32(GPS_coord[LON]);
  serialize32(EstAlt);
  tailSerialReply();
}


Only for DS8500 use, inside SERIAL.INO also I add "UCSR1C |= (1<<UPM11)" because DS8500 need ODD parity serial input :
For a modem on SERIAL PORT 1 replace :

Code: Select all

      case 1: UCSR1A  = (1<<U2X1); UBRR1H = h; UBRR1L = l; UCSR1B |= (1<<RXEN1)|(1<<TXEN1)|(1<<RXCIE1); break;

With :

Code: Select all

      case 1: UCSR1A  = (1<<U2X1); UBRR1H = h; UBRR1L = l; UCSR1B |= (1<<RXEN1)|(1<<TXEN1)|(1<<RXCIE1); UCSR1C |= (1<<UPM11); break;


Inside MULTIWII.INO main() loop

Code: Select all

  #ifdef GPSTOMODEM
    static uint8_t trackerTimer = 0;
    if (!(++trackerTimer % GPSTOMODEM_FREQ)) {
      gpsToModem();
    }
  #endif


Inside your Ground station main loop, call this function (bluetooth on Serial0 and modem on Serial1), I still work on it, I use a ChipKit PIC32 Arduino like board (groundstation do any other task).

Code: Select all

void modemToGps() {
 static uint8_t current;
 static uint8_t n = 0;
 static uint8_t sum = 0;
 static uint8_t frame[FRAMESIZE];

 static int32_t lat;
 static int32_t lon;
 static uint8_t ns;
 static uint8_t ew;
 static uint32_t latdeg;
 static uint32_t londeg;
 static uint32_t latmin;
 static uint32_t lonmin;
 static int32_t alt;
 static uint32_t aAlt;

 while(Serial1.available()) {
  current = Serial1.read();

  switch(n) {

   case 0:
    if(current == '$')
     n = 1;
    break;

   case 1: case 2: case 3: case 4:
   case 5: case 6: case 7: case 8:
   case 9: case 10: case 11: case 12:
    frame[n++ - 1] = current;
    sum ^= current;
    break;

   case 13:
    if(current == sum) {
     lat = (frame[3] << 24) + (frame[2] << 16) + (frame[1] << 8) + frame[0];
     lon = (frame[7] << 24) + (frame[6] << 16) + (frame[5] << 8) + frame[4];
     alt = (frame[11] << 24) + (frame[10] << 16) + (frame[9] << 8) + frame[8];
     ns = lat < 0 ? 'S' : 'N';
     ew = lon < 0 ? 'W' : 'E';
     lat = abs(lat);
     lon = abs(lon);
     aAlt = abs(alt);
     latdeg = lat / 10000000;
     londeg = lon / 10000000;
     latmin = lat % 10000000 * 6;
     lonmin = lon % 10000000 * 6;

     Serial.print("$GPGGA,120000,");
     Serial.print(latdeg);
     Serial.print(latmin / 1000000);
     Serial.print('.');
     Serial.print(latmin % 1000000);
     Serial.print(',');
     Serial.print(ns);
     Serial.print(',');

     Serial.print(londeg);
     Serial.print(lonmin / 1000000);
     Serial.print('.');
     Serial.print(lonmin % 1000000);
     Serial.print(',');
     Serial.print(ew);
     Serial.print(",1,10,1,");

     if(alt < 0)
      Serial.print('-');
     Serial.print(aAlt / 100);
     Serial.print('.');
     Serial.print(aAlt % 100);
     Serial.println(",M,,,,*00");

     tone(SPKPIN, 500, 10);
    } else
     tone(SPKPIN, 400, 10);
    n = 0;
    sum = 0;
    break;
  }
 }
}


Pascal

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: 5Hz GPS+BaroAlt to Bluetooth/Android over Audio channel

Post by Alexinparis »

Hello mister long range ;)

I understand the motivation. And I predict onboard OSDs will progressively become has been for FPV users
The video overlay process is something that must stay on the ground.

I have a little bit different approach: the replacement of the RC link to transmit&received everything we need in a half duplex mode.

serveurperso
Posts: 7
Joined: Fri May 10, 2013 9:02 am

Re: 5Hz GPS+BaroAlt to Bluetooth/Android over Audio channel

Post by serveurperso »

Hello Alex! It work now :D

First I love MultiWii code because code is CLEAR and it's easy to add custom function:D

[youtube]
http://www.youtube.com/watch?v=-r_TRvNPS7U
[/youtube]

My approach is, Only one very powerful transmitter go on the Drone or Plane - 1.2GHz 1W LawMate for my tiny hexa - or special very high power 1.2GHz RA18H1213G - 25 Watts hybrid LPA (drived by a small TX like RaceWood one). No laptop on groudstation No PC...

For a optimized project (like multiwii) 1200 low rate is enough to make a full autonomous drone.

In practice, during a FPV flight, Google Map on a smartphone and no more!!! I never need the MultiWii interface on field during flight, I just wanted the smartphone in my pocket to recover hardware if needed:D

For the future autonomous drone, for it uplink, I can replace futaba module with UNIdirectionnal data modems OR better, I have the idea of ​​a low-speed uplink protocol using a PWM channel for support, like one full byte per PWM symbol. it is more than enough to ask for things to drone with a custom GUI or CLI interface (go to xxxxx yyyyyy zzzzzzz coordinate = 1 clic on a "google Earth" like interface / or "go 100m North" on a CLI).

Sorry for my english

Pascal

serveurperso
Posts: 7
Joined: Fri May 10, 2013 9:02 am

Re: 5Hz GPS+BaroAlt to Bluetooth/Android over Audio channel

Post by serveurperso »

FPV + Google Map & "Mes Parcours" logger app : http://www.youtube.com/watch?v=m93tQNuLMqM

Post Reply