RC Groups

RC Groups
    DIY Electronics
        Discussion DIY simple and inexpensive Arduino-based sailplane variometer

#1 kapteinkuk Oct 10, 2012 06:14 PM

DIY simple and inexpensive Arduino-based sailplane variometer
 
9 Attachment(s)
http://static.rcgroups.net/forums/at...g?d=1349909510

My DIY Audio Variometer Demo (R/C sailplane thermalling) (1 min 43 sec)

My simple and inexpensive Arduino-based sailplane vario (1 min 41 sec)


This is my second vario design. The previous one was expensive and bulky. Also the pressure sensor used turned out to be sensitive for RF. This one has no such problems.

This is the best investment I have done regarding sailplanes. Makes it way easier to find lift!

Any AM/OOK TX/RX can be used, but I had most success with the 433MHz modules from RF-Solutions. Much better than the cheap Ebay ones.

The RX audio is fed to a portable, battery operated FM radio. I build the RX into the radio, and connected the audio to the FM radio's volume potmeter.

See attachments for schematics.

Code:


// All code by Rolf R Bakke, Oct 2012


#include <Wire.h>

const byte led = 13;

unsigned int calibrationData[7];
unsigned long time = 0;

float toneFreq, toneFreqLowpass, pressure, lowpassFast, lowpassSlow ;

int ddsAcc;


void setup()
{
  Wire.begin();
  Serial.begin(115200);
  setupSensor();
 
  pressure = getPressure();
  lowpassFast = lowpassSlow = pressure;
}


void loop()
{
  pressure = getPressure();
 
  lowpassFast = lowpassFast + (pressure - lowpassFast) * 0.1;
  lowpassSlow = lowpassSlow + (pressure - lowpassSlow) * 0.05;
 
  toneFreq = (lowpassSlow - lowpassFast) * 50;
 
  toneFreqLowpass = toneFreqLowpass + (toneFreq - toneFreqLowpass) * 0.1;
 
  toneFreq = constrain(toneFreqLowpass, -500, 500);
 
  ddsAcc += toneFreq * 100 + 2000;
 
  if (toneFreq < 0 || ddsAcc > 0)
  {
    tone(2, toneFreq + 510); 
  }
  else
  {
    noTone(2);
  }
 
  ledOff();
  while (millis() < time);        //loop frequency timer
  time += 20;
  ledOn();
}


long getPressure()
{
  long D1, D2, dT, P;
  float TEMP;
  int64_t OFF, SENS;
 
  D1 = getData(0x48, 10);
  D2 = getData(0x50, 1);

  dT = D2 - ((long)calibrationData[5] << 8);
  TEMP = (2000 + (((int64_t)dT * (int64_t)calibrationData[6]) >> 23)) / (float)100;
  OFF = ((unsigned long)calibrationData[2] << 16) + (((int64_t)calibrationData[4] * dT) >> 7);
  SENS = ((unsigned long)calibrationData[1] << 15) + (((int64_t)calibrationData[3] * dT) >> 8);
  P = (((D1 * SENS) >> 21) - OFF) >> 15;
 
  //Serial.println(TEMP);
  //Serial.println(P);
 
  return P;
}


long getData(byte command, byte del)
{
  long result = 0;
  twiSendCommand(0x77, command);
  delay(del);
  twiSendCommand(0x77, 0x00);
  Wire.requestFrom(0x77, 3);
  if(Wire.available()!=3) Serial.println("Error: raw data not available");
  for (int i = 0; i <= 2; i++)
  {
    result = (result<<8) | Wire.read();
  }
  return result;
}


void setupSensor()
{
  twiSendCommand(0x77, 0x1e);
  delay(100);
 
  for (byte i = 1; i <=6; i++)
  {
    unsigned int low, high;

    twiSendCommand(0x77, 0xa0 + i * 2);
    Wire.requestFrom(0x77, 2);
    if(Wire.available()!=2) Serial.println("Error: calibration data not available");
    high = Wire.read();
    low = Wire.read();
    calibrationData[i] = high<<8 | low;
    Serial.print("calibration data #");
    Serial.print(i);
    Serial.print(" = ");
    Serial.println( calibrationData[i] );
  }
}


void twiSendCommand(byte address, byte command)
{
  Wire.beginTransmission(address);
  if (!Wire.write(command)) Serial.println("Error: write()");
  if (Wire.endTransmission())
  {
    Serial.print("Error when sending command: ");
    Serial.println(command, HEX);
  }
}


void ledOn()
{
  digitalWrite(led,1);
}


void ledOff()
{
  digitalWrite(led,0);
}


...and remember: bigger the blob, better the job!

#2 chiloschista Oct 11, 2012 03:52 AM

Hi KK,
great work !

It could even be greater if you would add Total Energy Compensation feature.
Do you plan something this way ?
Anyway the response of this vario seems pretty sensible and immediate.

Another feature I would like is to have a serial port to transmit over an Xbee or similar (maybe it already work this way ?) or over MAVlink, or M-link. This last one could let use downlink channel of M-link capable RC systems like Multiplex or ACT (which I use :D ) and avoiding the usage of another frequency.
I think Graupner Hott and Jeti Duplex work on a similar way.

Best regards,

Ric

#3 schumixmd Oct 11, 2012 05:23 AM

very nice work Rolf.
easiest implementation I ever saw.

#4 Andy W Oct 11, 2012 06:16 AM

Just dang! Electronics is becoming programming! :)
..a

#5 renatoa Oct 11, 2012 06:25 AM

Lol... in '84, while working for my license thesis, a Z80 based system, I realized this truth: the best hardware is the software !

#6 Iron Savior Oct 11, 2012 10:16 AM

Quote:

Originally Posted by Andy W (Post 22970649)
Just dang! Electronics is becoming programming! :)
..a

When programmable computers get so cheap and draw so little power, I find it's easier to express a system in code rather than components. But then, I was always a better programmer than a circuit designer.

#7 MAVA Oct 11, 2012 12:48 PM

Thank you for posting your design and code. I've been tinkering with one my self, but mine has way-to-many parts. This is a lot simpler.

Here in the USA I found Digi Key sells the RF components, but not the same as the RT14 series.Would you recommend any from this list:

http://www.digikey.com/product-searc...fffc0165&chp=0

Also, the pressure sensor you used comes in a module as all I found were bare sensors. Can you provide the whole part number to the sensor? Maybe I can match-up the specifications to yours.

http://www.meas-spec.com/pressure-se...r-modules.aspx

Thank you for your help

Martin

#8 kapteinkuk Oct 11, 2012 05:44 PM

Quote:

Originally Posted by chiloschista (Post 22970178)
Hi KK,
great work !

It could even be greater if you would add Total Energy Compensation feature.
Do you plan something this way ?

No, TEC requires airspeed also in the calculation.
Quote:

Anyway the response of this vario seems pretty sensible and immediate.
Another feature I would like is to have a serial port to transmit over an Xbee or similar
The serial port on the Arduino is free, so that can be done.
Quote:

(maybe it already work this way ?) or over MAVlink, or M-link. This last one could let use downlink channel of M-link capable RC systems like Multiplex or ACT (which I use :D ) and avoiding the usage of another frequency.
I think Graupner Hott and Jeti Duplex work on a similar way.

Best regards,

Ric

#9 kapteinkuk Oct 11, 2012 06:17 PM

Quote:

Originally Posted by MAVA (Post 22973497)
Thank you for posting your design and code. I've been tinkering with one my self, but mine has way-to-many parts. This is a lot simpler.

Here in the USA I found Digi Key sells the RF components, but not the same as the RT14 series.Would you recommend any from this list:

http://www.digikey.com/product-searc...fffc0165&chp=0

QAM-TX1-433, but is does not say output power anywhere. The RT14 is the strongest I have found, 14dbm.
If you can, check out RS components, where I bought mine.

My friend uses inexpensive modules from China, and is happy with that.
Quote:



Also, the pressure sensor you used comes in a module as all I found were bare sensors. Can you provide the whole part number to the sensor? Maybe I can match-up the specifications to yours.

http://www.meas-spec.com/pressure-se...r-modules.aspx
I bought this one: http://dx.com/p/gy-63-ms5611-high-re...-148866?item=1

You can also find the same module cheaper on Ebay.
Quote:


Thank you for your help

Martin

#10 MAVA Oct 12, 2012 11:28 AM

Thank you for your reply.

Martin

#11 chiloschista Oct 13, 2012 10:48 AM

Hi KK,

what about using one of those tx and rx modules ?
Btw this one is 50mW.
I saw Telecontrolli has high power modules on 433 and 868MHz (400-800mW), but I can't find a seller.
RF solutions has a crazy high abroad shipping rate (~$50.-) :O

Is it possible to feed the audio channel on a FPV video tx ?
Did I get it right that Arduino already generate an analogical audio signal ?
Which modifications are required (e.g. to match video tx audio channel impedance) ?

Thanks and best regards,

Ric

#12 kapteinkuk Oct 13, 2012 11:46 AM

Quote:

Originally Posted by chiloschista (Post 22990109)
Hi KK,

what about using one of those tx and rx modules ?
Btw this one is 50mW.

That is the Chinese modules I mentioned earlier. In my experience the quality is questionable, and certainly not even close to 50mW. Some did not work at all. But my friend found a pair that worked, so it is possible.
Quote:

I saw Telecontrolli has high power modules on 433 and 868MHz (400-800mW), but I can't find a seller.
RF solutions has a crazy high abroad shipping rate (~$50.-) :O

Is it possible to feed the audio channel on a FPV video tx ?
Did I get it right that Arduino already generate an analogical audio signal ?
Which modifications are required (e.g. to match video tx audio channel impedance) ?
Yes, the Arduino generates the audio signal, and it can be fed to a video TX audio channel through a voltage divider similar to the one in the schematics.
Quote:

Thanks and best regards,

Ric

#13 chiloschista Oct 13, 2012 01:21 PM

Quote:

Originally Posted by kapteinkuk (Post 22990499)
Yes, the Arduino generates the audio signal, and it can be fed to a video TX audio channel through a voltage divider similar to the one in the schematics.

Do you mean the one on ground side ? I can't see one on plane side.

Is it right I should divide 3.3V into 1V ?
Specs for usual FPV video tx are :
10k ohm impedance, 1Vp-p

I guess then than I should have :
Arduino D2 output Voltage 3.3V
R1 10000Ohm in serie
R2 4348Ohm to ground
Input Voltage to video TX 1V

Am I on the right way ?
Thanks,

Ric

#14 srnet Oct 13, 2012 01:45 PM

I am mystified as to why you would need more than 10mW.

A cheap UHF transceiver, $30 or so, and a FM 10mW module ought to give you an airborne LOS to receive the variometer tones of around 60kM.

Why would you want to blast out, 400 - 800mW from an aeroplane, causing unknown disruption to other comms, when you only need a few mW ?

#15 renatoa Oct 14, 2012 12:37 AM

Because they are not hams... and grown with bigger is better in mind :mad:


All times are GMT -5. The time now is 12:52 PM.