Mirko Pavleski
Published © GPL3+

How to Make a Simplest Variometer for Paragliding

Variometer is instrument that indicates the changes in the altitude variations.

BeginnerFull instructions provided9,850
How to Make a Simplest Variometer for Paragliding

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Buzzer
Buzzer
×1
LED (generic)
LED (generic)
×1
Resistor 330 ohm
Resistor 330 ohm
×1
Toggle Switch, Toggle
Toggle Switch, Toggle
×1
9V battery (generic)
9V battery (generic)
×1
BMP180 pressure sensor board
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

Schematic diagram

Code

Arduino code

C/C++
#include <toneAC.h>
#include <Wire.h>
#include <Adafruit_BMP085.h>
Adafruit_BMP085 mySensor;  // create sensor object called mySensor

/*
Hardware connections:

- (GND) to GND
+ (VDD) to 3.3V
SCL to A5
SDA to A4

D9 and D10 to the Piezo Buzzer ( see toneAC.h )

*/

#define NUM_PRESSURES 64
#define NUM_TOTALS 16
uint32_t pressure[NUM_PRESSURES];
uint32_t old_total[NUM_TOTALS];
int pressure_index = 0;
int total_index = 0;
uint32_t total;
int current_tone = 0;
int beep_time = 0;

void setup() {
// play start sound
  toneAC(388, 4);
  delay(70);
  toneAC(0);
  delay(30);
  toneAC(590, 4);
  delay(70);
  mySensor.begin();
  uint32_t p = mySensor.readPressure();
  total = p*NUM_PRESSURES;
  for(int i = 0; i<NUM_PRESSURES; i++)
  {
    pressure[i] = p;
  }
  for(int i = 0; i<NUM_TOTALS; i++)
  {
    old_total[i] = total;
  }
  toneAC(0);
}

void loop(){
    total -= pressure[pressure_index];
    pressure[pressure_index] = mySensor.readPressure();
    total += pressure[pressure_index];
    int32_t rate = total - old_total[total_index];
    float frate = (float)rate;
    frate = 0.0;
    old_total[total_index] = total;
    pressure_index++;
    total_index++;
    if(pressure_index >= NUM_PRESSURES)pressure_index = 0;
    if(total_index >= NUM_TOTALS)total_index = 0;
    if(rate < -200){
      if(beep_time <5)
        toneAC(500 - rate);
      else
        toneAC(0);
    }
    else if(rate > 200)
    {
      float f = 100.0 + 40000.0 * 1.0/((float)rate);
      toneAC((int)f);
    }
    else
    {
      toneAC(0);
    }
    beep_time++;
    if(beep_time >= 10)beep_time = 0;
}

ToneAC lib

Credits

Mirko Pavleski

Mirko Pavleski

150 projects • 1283 followers

Comments