Espritmodel.com Telemetry Radio
Reply
Thread Tools
Old Oct 25, 2012, 03:30 AM
X-Ikarus
Reflex1's Avatar
United Kingdom, North York
Joined Feb 2003
1,660 Posts
Quote:
Originally Posted by kapteinkuk View Post
Direct digital synthesizer Accumulator. It is used for the amplitude modulation of the vario sound and gives the intermittent sound when ascending.

http://en.wikipedia.org/wiki/Direct_digital_synthesizer
Great project

I have built the "front End" running an Arduino 168, and via an old PC amplified
speaker unit for testing. It works Very well

Is it possible to Mute the "Down Tone" and just
leave the "Climb" indication ?

or even better to have this Switchable via
a small PCB switch on the Arduino ?
Reflex1 is offline Find More Posts by Reflex1
Last edited by Reflex1; Oct 25, 2012 at 03:37 AM.
Reply With Quote
Sign up now
to remove ads between posts
Old Oct 26, 2012, 06:58 AM
Quad Whisperer
Joined Jul 2008
942 Posts
Only sound in positive climb*:

Code:
  if (toneFreq > 0 && ddsAcc > 0) 
  {
    tone(2, toneFreq + 510);  
  }
  else
  {
    noTone(2);
  }
Original, or only sound in positive climb, switchable*:

Code:
  if ((toneFreq < 0 && digitalRead(switchPin)) || (toneFreq > 0 && ddsAcc > 0)) 
  {
    tone(2, toneFreq + 510);  
  }
  else
  {
    noTone(2);
  }
*code is not tested in real hardware, only run through my "Brain-reality-simulator-2000-PRO Xtreme edition"




kapteinkuk is offline Find More Posts by kapteinkuk
Last edited by kapteinkuk; Oct 26, 2012 at 07:05 AM.
Reply With Quote
Old Oct 26, 2012, 07:16 AM
X-Ikarus
Reflex1's Avatar
United Kingdom, North York
Joined Feb 2003
1,660 Posts
WoW. thanks Rolf

I'll try it later today

Software is not my strong point ...

I assume "digitalRead(switchPin))"
is which ever Pin on the Arduino is assigned
to this function ?

But. no matter, Indication on Climb only
is a great help
Reflex1 is offline Find More Posts by Reflex1
Reply With Quote
Old Oct 26, 2012, 08:33 AM
X-Ikarus
Reflex1's Avatar
United Kingdom, North York
Joined Feb 2003
1,660 Posts
Sound on positive climb only,
works fine see code below (copy & Paste to use) Thanks Rolf !

Yet to test the "switched" 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);
}

-------------------------------------------------------------------------------
Reflex1 is offline Find More Posts by Reflex1
Reply With Quote
Old Oct 27, 2012, 06:02 PM
X-Ikarus
Reflex1's Avatar
United Kingdom, North York
Joined Feb 2003
1,660 Posts
Thanks KK , I have tested the "switched" Down Tone

I added a movable link to the Arduino ,enabled the "Pull Up" on pin 9
and it's easily to turn the Tone On or Off now.


digitalWrite(9, HIGH);

if ((toneFreq < 0 && digitalRead( 9 )) || (toneFreq > 0 && ddsAcc > 0))
{
tone(2, toneFreq + 510);
}
else
{
noTone(2);
}
Reflex1 is offline Find More Posts by Reflex1
Reply With Quote
Old Oct 28, 2012, 02:57 PM
Registered User
thnilsen's Avatar
Norway, Hordaland, Os
Joined Nov 2004
332 Posts
Rolf,

Very interesting project this. Would it not be possible to hook up a simple accelerometer to provide a "poor mans TEC"? by looking at the attitude of the X axis (following the length of the fuselage). If the X is more than let say 5 or 10 degrees down or up you could assume it would be because of stick input rather than lift. I know it wouldn't be exact, but would it not give a somewhat better control of lift when stick input is interfering?

- Thomas
thnilsen is online now Find More Posts by thnilsen
Reply With Quote
Old Oct 28, 2012, 03:36 PM
T.ing to put on air 100 models
chiloschista's Avatar
Switzerland
Joined Feb 2008
639 Posts
Quote:
Originally Posted by thnilsen View Post
Rolf,

Very interesting project this. Would it not be possible to hook up a simple accelerometer to provide a "poor mans TEC"? by looking at the attitude of the X axis (following the length of the fuselage). If the X is more than let say 5 or 10 degrees down or up you could assume it would be because of stick input rather than lift. I know it wouldn't be exact, but would it not give a somewhat better control of lift when stick input is interfering?

- Thomas
Thomas, sorry if I chime in, but I don't think such a simple implementation could be useful. There are too many variable which could play against. When the plane is banked while spiralling how is pitch working ? There should be a 3 axis sensor for sure etc.
But I chime in mainly because in a project where I was involved there is airspeed and 3 axis wind speed estimated by accelerometers. In this project, navigation takes account of TEC this way to manage speed and height. I guess then that with accelerometers and a bit (a great amount) of coding and testing it should be possible to have TEC estimated. But at this point I wonder which advantage would it be : not having a pitot tube around, other ?

In this video you can have an idea of "estimated" TEC working, watching at values on the right you have from top estimated vertical speed, height, Z axis estimated wind speed and potential height.
On the left you have estimated air speed and GPS speed.

Best regards,

Ric
chiloschista is offline Find More Posts by chiloschista
Reply With Quote
Old Oct 28, 2012, 05:34 PM
I bail out, anywhere, anytime
Taurus Flyer's Avatar
The Netherlands, OV, Almelo
Joined Nov 2010
2,685 Posts
For who is interested, "Old School" TE compensation with use of a venturi,.

In my video of post 28 ( http://www.rcgroups.com/forums/showp...2&postcount=28 ) time 0:46 and 0:51 you see the effect of TE compensation realised by the TE venturi, resulting in a positive signal of tone pulses at constant (flight) level on moments of acceleration of airspeed.
The accelertion is simulated by blowing in the ventury.

TF
Taurus Flyer is online now Find More Posts by Taurus Flyer
Reply With Quote
Old Oct 29, 2012, 05:15 PM
Registered User
thnilsen's Avatar
Norway, Hordaland, Os
Joined Nov 2004
332 Posts
Your input is most certainly appreciated Ric.

I'm no maths or electronic wiz so I can't really verify if it is at all possible to make a light TEC version without knowing speed. However, with a 3 axis accelerometer it should be possible to tell if the nose is pointing up or down above a preset threshold. Calculating this tentative X axis should be possible to do even if the plane is banking/spiraling etc. The body lengthwise on a glider in a thermal would stay pretty much at normal flight angle, would it not since the entire plane is lifted in a thermal? At least that's what I remember when doing full size gliding - but it has been a few years now so my memory might be a bit off.

I guess the pros of going with an accelerometer and not having to hook the unit up to a venturi would allow the unit to still be pretty small without too many external connectors. Makes it easy to move between models etc. But as you already know, such a solution would be less accurate compared to one that adds speed into the equation. The cost of a 3 axis accelerometer is also very low these days which is another pros.

But as I said I'm no maths or electronic wiz, so there might be very good reason that this might not work.

- Thomas
thnilsen is online now Find More Posts by thnilsen
Reply With Quote
Old Oct 29, 2012, 06:09 PM
T.ing to put on air 100 models
chiloschista's Avatar
Switzerland
Joined Feb 2008
639 Posts
Thomas,
I disagree on one point of your post. Estimated airspeed and 3 axis wind speed are very accurate in our project. This is an implementation of Bill Premerlani, a scientist of General Electric, also the founder and main guru of the project.
At this moment I can't find a link, but will come if I can recover some papers.

Best regards,

Ric
chiloschista is offline Find More Posts by chiloschista
Reply With Quote
Old Oct 29, 2012, 08:47 PM
I bail out, anywhere, anytime
Taurus Flyer's Avatar
The Netherlands, OV, Almelo
Joined Nov 2010
2,685 Posts
About the total energy variometer!

A total energy variometer (TE compensated vario) does need the exact input of altitude (potential energy) and speed (kinetic energy) of local circumstances of the air the plane is flying in.
Both measurement have to be real time and dynamic balanced!
There are several proven methods for that.
The speed is as important as the altitude and the calibration of both has to be done over the whole speedrange of the glider. For calibration there are special instruments.
Signalprocessing of speed / altitude variations can be done pneumatic, electronic or software. Easest method of course is the TE tube (google for that!) but I prefer one of the other methods so I can adjust the TE compension, also over- and undercomp., or switch it off.
Keep in mind there are several different vario's too, the TE compensated isn't the only one but most basic. For more complicated vario's the calibrated airspeed measurement is needed. For the normal vario the TE tube can be the best choice and can be interesting for the thread starter, Kapteinkuk.
The photograph does show the pitot and static tube (Prandtl-Rohr) of one of my gliders. The static tube (connection) is used for altitude (variations) and pitot connection for speed measurement. The vario is a (relative) netto variometer with pneumatic calculation and hardware electronic signalprocessing, so no Arduino.

Taurus Flyer.
Taurus Flyer is online now Find More Posts by Taurus Flyer
Last edited by Taurus Flyer; Oct 29, 2012 at 09:14 PM.
Reply With Quote
Old Nov 19, 2012, 05:42 PM
Registered User
Australia, QLD, Logan
Joined Aug 2011
15 Posts
I'm keen on getting one of these and hooking it up to my fpv cularis. If anyone here has a spare or would like to sell me one, please pm me. Just to add another twist to the equation: my hang glider vario makes no sound while its elevation is constant. This would be my ideal as I only need to be prompted if lift/sink conditions exist ( Normal glide ratio would be silent). Also, the sink sound is important in my opinion: Commonly, speed is increased in proportion to sink.
stilp is offline Find More Posts by stilp
Reply With Quote
Old Nov 20, 2012, 10:23 AM
Who needs a pilot??
danstrider's Avatar
Alexandria, VA
Joined Jul 2002
1,159 Posts
building my own...

Thanks kapteinkuk for posting code! I ordered stuff to make my own :-)

The MS-5611 is a pretty cool little package. Shame it doesn't have a nipple for attaching tubing. I had some thoughts of a little plastic cap that could be glued around/over the sensor to provide a tubing connection point, which would also allow using a TEK nozzle to get airspeed compensation (http://www.rcgroups.com/forums/showt...0#post17912800).

If you haven't seen the inexpensive FrSky telemetry equipment, they include an RS232 downlink at 4800 baud that looks perfect for removing the transmitter hardware from the airborne unit. Here is a picture of the receiver and side plug for RS232 at TTL: http://www.rcgroups.com/forums/showp...3&postcount=16 RENATOA was really involved in one of the FrSky threads; maybe he'd be willing to chip in?

Reading through the MS-5611 datasheet (http://www.meas-spec.com/downloads/MS5611-01BA01.pdf), I see there is a 2nd order temperature compensation for improved accuracy below 20C. Considering winter is coming and to have something to do while parts ship, I thought it useful to add this. This code has not been tested on hardware:

Code:
// original code by Rolf R Bakke, Oct 2012
// modifications by danstrider, 20 Nov 2012
long getPressure()
{
  long D1, D2, dT, P;
  float TEMP;
  int64_t OFF, SENS;

  D1 = getData(0x48, 10); // resolution 0.012mbar
  D2 = getData(0x50, 1); // resolution 0.012C

  dT = D2 - ((long)calibrationData[5] << 8);
  TEMP = (2000 + (((int64_t)dT * (int64_t)calibrationData[6]) >> 23));  // -4000 to 8500 = -40C to 85C
  OFF = ((unsigned long)calibrationData[2] << 16) + (((int64_t)calibrationData[4] * dT) >> 7);
  SENS = ((unsigned long)calibrationData[1] << 15) + (((int64_t)calibrationData[3] * dT) >> 8);

  // 2nd order temp compensation, MS-5611 datasheet Fig 3
  float T2=0.0;
  int64_t OFF2=0, SENS2=0, tmp;
  if (TEMP < 2000) // lower than 20C
  {
    T2 = (float)((dT*dT) >> 31);
    tmp = TEMP-2000;
    tmp = 5*tmp*tmp;
    OFF2 = tmp >> 1;
    SENS2 = tmp >> 2;
  }
  if (TEMP<-1500) // lower than -15C
  {
    tmp = TEMP+1500;
    tmp = tmp*tmp;
    OFF2 = OFF2 + 7*tmp;
    SENS2 = SENS2 + (11*tmp) >> 1;
  }
  TEMP = TEMP - T2;
  OFF = OFF - OFF2;
  SENS = SENS - SENS2;

  // calculate pressure and temperature
  P = (((D1 * SENS) >> 21) - OFF) >> 15; // 10 to 1200mbar with 0.01mbar resolution
  TEMP = TEMP / (float)100;  // -40 to 85C

  //Serial.println(TEMP);
  //Serial.println(P);

  return P;
}
Will post back when I have something to show for myself.
Dan
danstrider is offline Find More Posts by danstrider
Reply With Quote
Old Nov 20, 2012, 06:30 PM
Registered User
thnilsen's Avatar
Norway, Hordaland, Os
Joined Nov 2004
332 Posts
Quote:
Originally Posted by danstrider View Post
Thanks kapteinkuk for posting code! I ordered stuff to make my own :-)

The MS-5611 is a pretty cool little package. Shame it doesn't have a nipple for attaching tubing. I had some thoughts of a little plastic cap that could be glued around/over the sensor to provide a tubing connection point, which would also allow using a TEK nozzle to get airspeed compensation (http://www.rcgroups.com/forums/showt...0#post17912800).

If you haven't seen the inexpensive FrSky telemetry equipment, they include an RS232 downlink at 4800 baud that looks perfect for removing the transmitter hardware from the airborne unit. Here is a picture of the receiver and side plug for RS232 at TTL: http://www.rcgroups.com/forums/showp...3&postcount=16 RENATOA was really involved in one of the FrSky threads; maybe he'd be willing to chip in?
I have been thinking the same with using the FrSky telemetry units. However, I believe the LDC panel provided by FrSky only provides 3 tones all together, so you would be limited on indicating levels of lift/sink. Please correct me if I'm wrong as I'm having a hard time not pressing the BUY button on one of those DIY FrSky units...

- Thomas
thnilsen is online now Find More Posts by thnilsen
Reply With Quote
Old Nov 20, 2012, 06:35 PM
Quad Whisperer
Joined Jul 2008
942 Posts
Quote:
Originally Posted by danstrider View Post
Thanks kapteinkuk for posting code! I ordered stuff to make my own :-)

The MS-5611 is a pretty cool little package. Shame it doesn't have a nipple for attaching tubing. I had some thoughts of a little plastic cap that could be glued around/over the sensor to provide a tubing connection point, which would also allow using a TEK nozzle to get airspeed compensation (http://www.rcgroups.com/forums/showt...0#post17912800).

If you haven't seen the inexpensive FrSky telemetry equipment, they include an RS232 downlink at 4800 baud that looks perfect for removing the transmitter hardware from the airborne unit. Here is a picture of the receiver and side plug for RS232 at TTL: http://www.rcgroups.com/forums/showp...3&postcount=16 RENATOA was really involved in one of the FrSky threads; maybe he'd be willing to chip in?
My vario only sends sound, so I doubt it will work through that FrSky down link, unless the link is hardware at lowest level (Mark/Space).
Quote:
Reading through the MS-5611 datasheet (http://www.meas-spec.com/downloads/MS5611-01BA01.pdf), I see there is a 2nd order temperature compensation for improved accuracy below 20C. Considering winter is coming and to have something to do while parts ship, I thought it useful to add this.
The vario only uses fast relative changes in pressure as input. So an absolute accuracy is not necessary.
Quote:
This code has not been tested on hardware:

Code:
// original code by Rolf R Bakke, Oct 2012
// modifications by danstrider, 20 Nov 2012
long getPressure()
{
  long D1, D2, dT, P;
  float TEMP;
  int64_t OFF, SENS;

  D1 = getData(0x48, 10); // resolution 0.012mbar
  D2 = getData(0x50, 1); // resolution 0.012C

  dT = D2 - ((long)calibrationData[5] << 8);
  TEMP = (2000 + (((int64_t)dT * (int64_t)calibrationData[6]) >> 23));  // -4000 to 8500 = -40C to 85C
  OFF = ((unsigned long)calibrationData[2] << 16) + (((int64_t)calibrationData[4] * dT) >> 7);
  SENS = ((unsigned long)calibrationData[1] << 15) + (((int64_t)calibrationData[3] * dT) >> 8);

  // 2nd order temp compensation, MS-5611 datasheet Fig 3
  float T2=0.0;
  int64_t OFF2=0, SENS2=0, tmp;
  if (TEMP < 2000) // lower than 20C
  {
    T2 = (float)((dT*dT) >> 31);
    tmp = TEMP-2000;
    tmp = 5*tmp*tmp;
    OFF2 = tmp >> 1;
    SENS2 = tmp >> 2;
  }
  if (TEMP<-1500) // lower than -15C
  {
    tmp = TEMP+1500;
    tmp = tmp*tmp;
    OFF2 = OFF2 + 7*tmp;
    SENS2 = SENS2 + (11*tmp) >> 1;
  }
  TEMP = TEMP - T2;
  OFF = OFF - OFF2;
  SENS = SENS - SENS2;

  // calculate pressure and temperature
  P = (((D1 * SENS) >> 21) - OFF) >> 15; // 10 to 1200mbar with 0.01mbar resolution
  TEMP = TEMP / (float)100;  // -40 to 85C

  //Serial.println(TEMP);
  //Serial.println(P);

  return P;
}
Will post back when I have something to show for myself.
Dan
kapteinkuk is offline Find More Posts by kapteinkuk
Reply With Quote
Reply


Thread Tools

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