By continuing to use this site, you agree to our use of cookies. Find out more
Forum sponsored by:
Forum sponsored by CML

Simple arduino altimeter

All Topics | Latest Posts

Search for:  in Thread Title in  
dave windymiller24/05/2019 20:24:18
99 forum posts
134 photos

With the revision of restrictions around airports changed recently, our club, previously inside the FRZ now thankfully finds its self outside ! In theory we can now fly models greater than 7kg but we need to change the club rule. The limit of 400 ft is the sticking point for the club committee.

I decided to look for a simple altitude recording device and found this simple arduino project  Standalone-Arduino-Altimeter. Only three components & around 10 quid to build.

I decided to build one but decided the software need tweaking to suit. I wanted an altitude above launch. As it stood, it indicated pressure temperature and altitude with altitude min and altitude max. The altitude was dependent on both baro pressure and locality height. It could be possible to calibrate it but this would vary with weather. Also 2 decimal places was too much.

My software simply sets a zero altitude on power up/reset and a maximum in relation to this datum . Ive also set it to feet rather than meters!  The bmp280 chip is apparently good for around +/- 3ft 


My device mounted in a small plastic box 50mm X 35mm and weighs less than 20g. The plastic screw is mounted above the arduino reset button to act as a button to reset the altimeter to zero before flight.

If anyones interested i could post my revised software!


Edited By dave windymiller on 24/05/2019 20:32:01

Anthony Scott 224/05/2019 20:30:51
93 forum posts
12 photos

Yes please.

dave windymiller24/05/2019 20:38:54
99 forum posts
134 photos

Here it is, not the best written code im sure but it works!


 #include "U8glib.h"
#include "BMP280.h"
#include "Wire.h"
#define P0 1013.25 
BMP280 bmp;

// OLED Type
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);

char sT[20];
char sP[9];
char sA[9];
char sA_MIN[9];
char sA_MAX[9];
char sA_DIFF[9];
char sA_NOW[9];

double A_MIN = 0;
double A_MAX = -1000;
double A_DIFF = 0;
double A_NOW = 0;
double cal = 5.0;
double count = 0;

void draw2( double A_DIFF, double A_NOW) {

  dtostrf(A_DIFF, 4, 0, sA_DIFF);
  dtostrf(A_NOW, 4, 0, sA_NOW);

  u8g.drawStr( 5, 10, "Alt NOW: " ) ;
  u8g.drawStr( 70, 10, sA_NOW);
  u8g.drawStr( 5, 40, "Max" ) ;
  u8g.drawStr( 5, 60, "Alt Ft:" ) ;
  u8g.drawStr( 70, 60, sA_DIFF) ;

void setup() {
  if (!bmp.begin()) {
    Serial.println("BMP init failed!" ) ;
    while (1);
  else Serial.println("BMP init success!" ) ;



void loop(void) {
  double T, P;
  char result = bmp.startMeasurment() ;

  if (result != 0) {
    result = bmp.getTemperatureAndPressure(T, P);

    P = P + cal;
    if (result != 0) {
      double A = bmp.altitude(P, P0);
      A = A * 3.28084;

      if ( A > A_MAX) {
        A_MAX = A;

      if ( count == 0 ) {
        A_MIN = A;
        count = count + 1 ;
    A_DIFF = A_MAX - A_MIN;
    A_NOW = A - A_MIN;

      do {
        draw2( A_DIFF, A_NOW);
      } while ( u8g.nextPage() ) ;
    else {
      Serial.println("Error. " ) ;
  else {
    Serial.println("Error. " ) ;



Edited By dave windymiller on 24/05/2019 21:01:20

Edited By dave windymiller on 24/05/2019 21:02:12

Anthony Scott 224/05/2019 21:16:48
93 forum posts
12 photos


All Topics | Latest Posts

Please login to post a reply.

Latest Forum Posts
Support Our Partners
electricwingman 2017
Sussex Model Centre
Advertise With Us
Latest "For Sale" Ads
Has home isolation prompted you to start trad' building?
Q: The effects of Coronavirus

 Yes - for the first time
 Yes - but Ive bashed balsa before
 No - Ive existing projects on the bench
 No - Im strictly an ARTF person

Latest Reviews
Digital Back Issues

RCM&E Digital Back Issues

Contact us

Contact us

Magazine Locator

Want the latest issue of RCM&E? Use our magazine locator link to find your nearest stockist!

Find RCM&E!