HobbyKing.com New Products Flash Sale
Reply
Thread Tools
Old Oct 10, 2012, 07:14 PM
Quad Whisperer
Joined Jul 2008
943 Posts
Discussion
DIY simple and inexpensive Arduino-based sailplane variometer



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!
kapteinkuk is offline Find More Posts by kapteinkuk
Last edited by kapteinkuk; Aug 08, 2013 at 05:17 PM. Reason: cause I can.
Reply With Quote
Sign up now
to remove ads between posts
Old Oct 11, 2012, 04:52 AM
T.ing to put on air 100 models
chiloschista's Avatar
Switzerland
Joined Feb 2008
680 Posts
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 ) and avoiding the usage of another frequency.
I think Graupner Hott and Jeti Duplex work on a similar way.

Best regards,

Ric
chiloschista is online now Find More Posts by chiloschista
Reply With Quote
Old Oct 11, 2012, 06:23 AM
Registered User
schumixmd's Avatar
Moldova
Joined Jun 2010
1,236 Posts
very nice work Rolf.
easiest implementation I ever saw.
schumixmd is online now Find More Posts by schumixmd
RCG Plus Member
Old Oct 11, 2012, 07:16 AM
RIP Ric
Andy W's Avatar
Marietta, GA
Joined Jun 1999
43,312 Posts
Just dang! Electronics is becoming programming!
..a
Andy W is offline Find More Posts by Andy W
Reply With Quote
Old Oct 11, 2012, 07:25 AM
Registered User
Romania, Dolj, Craiova
Joined Sep 2007
15,208 Posts
Lol... in '84, while working for my license thesis, a Z80 based system, I realized this truth: the best hardware is the software !
renatoa is online now Find More Posts by renatoa
Reply With Quote
Old Oct 11, 2012, 11:16 AM
ROFLCOPTER
Iron Savior's Avatar
United States, KY, Louisville
Joined Mar 2011
230 Posts
Quote:
Originally Posted by Andy W View Post
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.
Iron Savior is offline Find More Posts by Iron Savior
Reply With Quote
Old Oct 11, 2012, 01:48 PM
Registered User
MAVA's Avatar
El Dorado Hills, California, U.S.A.
Joined Mar 2000
548 Posts
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
MAVA is offline Find More Posts by MAVA
Reply With Quote
Old Oct 11, 2012, 06:44 PM
Quad Whisperer
Joined Jul 2008
943 Posts
Quote:
Originally Posted by chiloschista View Post
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 ) and avoiding the usage of another frequency.
I think Graupner Hott and Jeti Duplex work on a similar way.

Best regards,

Ric
kapteinkuk is offline Find More Posts by kapteinkuk
Reply With Quote
Old Oct 11, 2012, 07:17 PM
Quad Whisperer
Joined Jul 2008
943 Posts
Quote:
Originally Posted by MAVA View Post
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
kapteinkuk is offline Find More Posts by kapteinkuk
Reply With Quote
Old Oct 12, 2012, 12:28 PM
Registered User
MAVA's Avatar
El Dorado Hills, California, U.S.A.
Joined Mar 2000
548 Posts
Thank you for your reply.

Martin
MAVA is offline Find More Posts by MAVA
Reply With Quote
Old Oct 13, 2012, 11:48 AM
T.ing to put on air 100 models
chiloschista's Avatar
Switzerland
Joined Feb 2008
680 Posts
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
chiloschista is online now Find More Posts by chiloschista
Reply With Quote
Old Oct 13, 2012, 12:46 PM
Quad Whisperer
Joined Jul 2008
943 Posts
Quote:
Originally Posted by chiloschista View Post
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
kapteinkuk is offline Find More Posts by kapteinkuk
Reply With Quote
Old Oct 13, 2012, 02:21 PM
T.ing to put on air 100 models
chiloschista's Avatar
Switzerland
Joined Feb 2008
680 Posts
Quote:
Originally Posted by kapteinkuk View Post
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
chiloschista is online now Find More Posts by chiloschista
Reply With Quote
Old Oct 13, 2012, 02:45 PM
Stuart
srnet's Avatar
UK, Cardiff
Joined Dec 2008
3,289 Posts
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 ?
srnet is online now Find More Posts by srnet
Reply With Quote
Old Oct 14, 2012, 01:37 AM
Registered User
Romania, Dolj, Craiova
Joined Sep 2007
15,208 Posts
Because they are not hams... and grown with bigger is better in mind
renatoa is online now Find More Posts by renatoa
Reply With Quote
Reply


Thread Tools

Similar Threads
Category Thread Thread Starter Forum Replies Last Post
Discussion Arduino based IR tag module for combat sh4nce Electric Combat 37 Sep 25, 2014 10:44 AM
Mini-HowTo DIY arduino twin video receiver diversity controller. Updates allways in post #1 Richard_s FPV Equipment 144 Jul 13, 2014 12:27 PM
New Product DIY OpenPilot based FlightControl (F4) lilvinz Multirotor Electronics 267 Feb 16, 2014 04:43 AM
Idea DIY Video Diversity with Arduino - Please Review! MayMayDay FPV Talk 2 Sep 23, 2012 01:36 PM
Help! Engineering student and first arduino based build? cad2blender UAV - Unmanned Aerial Vehicles 3 May 17, 2012 08:59 AM