|
|
|||
|
Joined Jul 2008
918 Posts
|
DIY simple and inexpensive Arduino-based sailplane variometer
![]()
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! |
||
|
|||
|
|
|
|
|
|
Romania, Dolj, Craiova
Joined Sep 2007
12,370 Posts
|
Lol... in '84, while working for my license thesis, a Z80 based system, I realized this truth: the best hardware is the software !
|
|
Latest blog entry: JRSky - birth of a dream radio
|
|
|
|
|
|
|
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 |
|
|
|
|
||||
|
Joined Jul 2008
918 Posts
|
Quote:
If you can, check out RS components, where I bought mine. My friend uses inexpensive modules from China, and is happy with that. Quote:
You can also find the same module cheaper on Ebay. Quote:
|
|||
|
||||
|
|
|
|
|
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 |
|
|
|
|
||||
|
Joined Jul 2008
918 Posts
|
Quote:
Quote:
Quote:
|
|||
|
||||
|
|
||
|
|
Quote:
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 |
|
|
||
|
|
|
|
UK, Cardiff
Joined Dec 2008
2,166 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 ? |
|
|
|
|
|
|
Romania, Dolj, Craiova
Joined Sep 2007
12,370 Posts
|
Because they are not hams... and grown with bigger is better in mind
|
|
Latest blog entry: JRSky - birth of a dream radio
|
|
|
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| New Product DIY OpenPilot based FlightControl (F4) | lilvinz | Multirotor Electronics | 266 | May 17, 2013 07:27 AM |
| Mini-HowTo DIY arduino twin video receiver diversity controller. Updates allways in post #1 | Richard_s | Video Piloting (FPV/RPV) | 131 | Apr 26, 2013 03:26 PM |
| Idea DIY Video Diversity with Arduino - Please Review! | MayMayDay | Video Piloting (FPV/RPV) | 2 | Sep 23, 2012 12:36 PM |
| Discussion Arduino based IR tag module for combat | sh4nce | Electric Combat | 34 | Sep 10, 2012 01:21 AM |
| Help! Engineering student and first arduino based build? | cad2blender | UAV - Unmanned Aerial Vehicles | 3 | May 17, 2012 07:59 AM |