Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Rate of Climb Indicator for Gliders
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Rate of Climb Indicator for Gliders

by gliderpilot on Thu Oct 01, 2015 10:42 am

An essential instrument in the cockpit of a glider is a rate-of-climb indicator. The usual mechanical indicator has slow response meaning that it may not detect small areas of rising air... the fuel that keeps gliders aloft.

Using an Arduino UNO R3 and an Adafruit MPL3115A2 (Product 1893), I made a fast responding rate-of-climb indicator with an audio output. The full story (including a couple of unsuccessful analog attempts) can be found at: http://theradioboard.com/rb/viewtopic.php?f=8&t=6061

gliderpilot
 
Posts: 18
Joined: Wed Jun 17, 2015 10:38 am

Re: Rate of Climb Indicator for Gliders

by adafruit_support_bill on Thu Oct 01, 2015 10:47 am

Nice project! Thanks for posting.

adafruit_support_bill
 
Posts: 82456
Joined: Sat Feb 07, 2009 10:11 am

Re: Rate of Climb Indicator for Gliders

by davisjodi on Sun Nov 15, 2015 4:01 pm

Could I interest you in posting your sketch so I can look at your code?

davisjodi
 
Posts: 5
Joined: Sun Nov 15, 2015 12:03 pm

Re: Rate of Climb Indicator for Gliders

by gliderpilot on Tue Dec 15, 2015 1:21 pm

davisjodi wrote:Could I interest you in posting your sketch so I can look at your code?

Sorry about the delay... I was not aware of your reply.
I tried attaching an ino and a pdf of the sketch with no success (I'm 99% analog and 1% software) :-) Suggestions?

gliderpilot
 
Posts: 18
Joined: Wed Jun 17, 2015 10:38 am

Re: Rate of Climb Indicator for Gliders

by adafruit_support_bill on Tue Dec 15, 2015 1:26 pm

Click on the "</>" button above the edit box and paste your code between the [code] tags.

adafruit_support_bill
 
Posts: 82456
Joined: Sat Feb 07, 2009 10:11 am

Re: Rate of Climb Indicator for Gliders

by gliderpilot on Tue Dec 15, 2015 2:07 pm

[code][/code]
Have tried copying the sketch using my mouse. It copies a few lines of code then quits copying. Is there any other way to get the code into a posting?

gliderpilot
 
Posts: 18
Joined: Wed Jun 17, 2015 10:38 am

Re: Rate of Climb Indicator for Gliders

by adafruit_support_bill on Tue Dec 15, 2015 2:14 pm

Are you copying from the Arduino IDE? If so, click: Edit->Select All, then click Edit->Copy, then just paste between the [code] tags.

adafruit_support_bill
 
Posts: 82456
Joined: Sat Feb 07, 2009 10:11 am

Re: Rate of Climb Indicator for Gliders

by gliderpilot on Tue Dec 15, 2015 2:42 pm

Ta da!! Success! Thank you for the tip!

Code: Select all | TOGGLE FULL SIZE
/*
 MPL3115A2 Barometric Pressure Sensor Library Example Code
 (Modified for Audio Variometer Application by Roger Fell)
 By: Nathan Seidle
 SparkFun Electronics
 Date: September 24th, 2013
 License: This code is public domain but you buy me a beer if you use this and we meet someday (Beerware license).
 
 Uses the MPL3115A2 library to display the current altitude and temperature
 
 Hardware Connections (Breakoutboard to Arduino):
 -VCC = 3.3V
 -SDA = A4 (use inline 10k resistor if your board is 5V)
 -SCL = A5 (use inline 10k resistor if your board is 5V)
 -INT pins can be left unconnected for this demo
 
 During testing, GPS with 9 satellites reported 5393ft, sensor reported 5360ft (delta of 33ft). Very close!
 During testing, GPS with 8 satellites reported 1031ft, sensor reported 1021ft (delta of 10ft).
 
 Available functions:
 .begin() Gets sensor on the I2C bus.
 .readAltitude() Returns float with meters above sealevel. Ex: 1638.94
 .readAltitudeFt() Returns float with feet above sealevel. Ex: 5376.68
 .readPressure() Returns float with barometric pressure in Pa. Ex: 83351.25
 .readTemp() Returns float with current temperature in Celsius. Ex: 23.37
 .readTempF() Returns float with current temperature in Fahrenheit. Ex: 73.96
 .setModeBarometer() Puts the sensor into Pascal measurement mode.
 .setModeAltimeter() Puts the sensor into altimetery mode.
 .setModeStandy() Puts the sensor into Standby mode. Required when changing CTRL1 register.
 .setModeActive() Start taking measurements!
 .setOversampleRate(byte) Sets the # of samples from 1 to 128. See datasheet.
 .enableEventFlags() Sets the fundamental event flags. Required during setup.
 
 */

#include <Wire.h>
#include "SparkFunMPL3115A2.h"

//Create an instance of the object
MPL3115A2 myPressure;

void setup()
{
  Wire.begin();        // Join i2c bus
  Serial.begin(9600);  // Start serial for output

  pinMode(8,OUTPUT);
 
  int altA=10;         //  initialize variables
   
  int altB=10;
 
  int difF=10;
 

  myPressure.begin(); // Get sensor online

  //Configure the sensor
  myPressure.setModeAltimeter(); // Measure altitude above sea level in meters
  //myPressure.setModeBarometer(); // Measure pressure in Pascals from 20 to 110 kPa

  myPressure.setOversampleRate(7); // Set Oversample to the recommended 128
  myPressure.enableEventFlags(); // Enable all three pressure and temp event flags
}

void loop()
{
  //float altitude = myPressure.readAltitude();
  //Serial.print("Altitude(m):");
  //Serial.print(altitude, 2);

  int altitude = myPressure.readAltitudeFt();
  Serial.print(" Altitude(ft):");
  Serial.print(altitude);
 
 
  //float pressure = myPressure.readPressure();
  //Serial.print("Pressure(Pa):");
  //Serial.print(pressure, 2);

  //float temperature = myPressure.readTemp();
  //Serial.print(" Temp(c):");
  //Serial.print(temperature, 2);

  float temperature = myPressure.readTempF();
 
    Serial.println();
     
  int altA = altitude;
 
   delay(500);
 
  int altB = myPressure.readAltitudeFt();  // take another altimeter reading
 
  int difF = (altB - altA) *256;           // calculate altitude change, x128
 
  Serial.print(difF);
 
  digitalWrite (8,HIGH);  // reset the 4024 divider
  delay(1);
  digitalWrite (8,LOW);
 
   if (difF>0)
  {
  tone (9, difF);
  }
   else
 {
   noTone(9);
 } 
 
   
 
}

gliderpilot
 
Posts: 18
Joined: Wed Jun 17, 2015 10:38 am

Please be positive and constructive with your questions and comments.