Arduino altimeter & airspeed indicator

Discussion in 'Instruments / Avionics / Electrical System' started by cluttonfred, Apr 8, 2015.

Help Support HomeBuiltAirplanes Forum by donating:

  1. Jun 5, 2019 #81

    Hot Wings

    Hot Wings

    Hot Wings

    Well-Known Member HBA Supporter

    Joined:
    Nov 14, 2009
    Messages:
    5,998
    Likes Received:
    2,000
    Location:
    Rocky Mountains
    A quick Google finds both the data sheet and some arduino code. Funny looking little chip......but probably worth the extra $'s and time.

    Good tip! No more BMPs for me.
     
  2. Jun 6, 2019 #82

    Scheny

    Scheny

    Scheny

    Well-Known Member

    Joined:
    Feb 26, 2019
    Messages:
    53
    Likes Received:
    14
    Location:
    Vienna, Austria
    I even have a better idea: Google for 10DOF IMU boards. They build them for small drones and you will get a controller and sensors in one 2x2 inch package. There are ones featuring Arduino, but I would suggest to go for something like a "Naze32".

    This is built upon a STM32 processor which is more in the Raspberry league and you can get it with either a built in BMP180 or HS5611 for around 30$.

    There are multiple open source software versions available (like "Betaflight" etc.) including the drivers. So even if you don't buy one, download it and you have the drivers.

    As there is 3D gyro and compass and accelerometers available, I would strongly suggest to use the vertical accelerometer in compound, as this is most reliable for short term variometer changes (i.e. with some 2 dimensional Kalman filtering algorithm). You could also make some backup compass functionality available by button selection if you want.
     
  3. Jun 11, 2019 #83

    Bill Welter

    Bill Welter

    Bill Welter

    Member

    Joined:
    Jun 11, 2019
    Messages:
    8
    Likes Received:
    8
    The Arduino code on the websites I found have errors and are incomplete. I got the Arduino, wrote the code for airspeed, and to display the speed up to 110 kts or 125 mph (limit for the 2 kpa sensor) on three 7-segment LEDs. It's actually pretty accurate! I can forward the code and pinouts if needed.
     
    Hephaestus likes this.
  4. Jun 11, 2019 #84

    GeorgeG

    GeorgeG

    GeorgeG

    Member

    Joined:
    Jan 8, 2019
    Messages:
    8
    Likes Received:
    0
    Location:
    Tracy, CA, USA
    Need!!!
     
  5. Jun 11, 2019 #85

    cluttonfred

    cluttonfred

    cluttonfred

    Well-Known Member

    Joined:
    Feb 13, 2010
    Messages:
    6,351
    Likes Received:
    2,208
    Location:
    World traveler
    Random question...what color segmented LED display is best for sunlight readability?
     
  6. Jun 11, 2019 #86

    Hephaestus

    Hephaestus

    Hephaestus

    Well-Known Member

    Joined:
    Jun 25, 2014
    Messages:
    772
    Likes Received:
    158
    Location:
    YMM
    Green is the most sunlight readable. Put a proper filter over it and go red would be my preference
     
  7. Jun 12, 2019 #87

    cluttonfred

    cluttonfred

    cluttonfred

    Well-Known Member

    Joined:
    Feb 13, 2010
    Messages:
    6,351
    Likes Received:
    2,208
    Location:
    World traveler
    Thanks, Hephaestus, but please explain. If green is most readable in sunlight, why go with red, and what exactly is a "proper filter"?
     
  8. Jun 12, 2019 #88

    Hephaestus

    Hephaestus

    Hephaestus

    Well-Known Member

    Joined:
    Jun 25, 2014
    Messages:
    772
    Likes Received:
    158
    Location:
    YMM
    Because when you're out flying in theory there's probably a fair bit of green around. The red stands out and you're trained to seek that red light already. Prrsonal preference for me - I really dislike the green light dashlights on cars, I like the red.

    Filter is a diffuser, most have them already but that simple plate to keep the glare down and make them more visible.
     
  9. Jun 12, 2019 #89

    BJC

    BJC

    BJC

    Well-Known Member

    Joined:
    Oct 7, 2013
    Messages:
    8,899
    Likes Received:
    5,749
    Location:
    97FL, Florida, USA
    Apart from readability, the color red on any aircraft display carries the connotation that the measured value is outside of the desired range.


    BJC
     
  10. Jun 12, 2019 #90

    cluttonfred

    cluttonfred

    cluttonfred

    Well-Known Member

    Joined:
    Feb 13, 2010
    Messages:
    6,351
    Likes Received:
    2,208
    Location:
    World traveler
    Personally, I think that an LED display in a neutral color with separate single RGB LED (or individual LEDs of different colors) makes the most sense.

    At one point I sketched out a generic display with a simple square black 1/8" aluminum backing plate, round smoke acrylic or polycarbonate window to fit a standard instrument hole, 3D-printed rear enclosure, white 4-character alphanumeric LED display, rotary encoder (turn left or right or push knob), and an RGB status LED. The idea was that all of those components and the basic Arduino controller would be standardized and only the programming and the sensor would change to make an altimeter/variometer, airspeed indicator, compass, etc. A color-coded decal (icon or ring around the face) or maybe an icon laser-etched in the window would show the function of each instrument at a glance.

    I didn't pursue it because my Arduino programming skills are very basic and the various components for one added up to almost as much as a cheap analog instrument. Also compact multifunction instruments like those from MGL do more for less than a whole panel of homemade ones.
     
  11. Jun 12, 2019 #91

    Hephaestus

    Hephaestus

    Hephaestus

    Well-Known Member

    Joined:
    Jun 25, 2014
    Messages:
    772
    Likes Received:
    158
    Location:
    YMM
    I think there's probably some strong logic in doing the previously mentioned Arduino(ish) MFD.

    SainSmart 3.2" TFT LCD Display + Touch Panel + PCB Adapter SD Slot for Arduino 2560 UNO R3 Mega Nano Robot https://www.amazon.ca/dp/B008FWSG3S/ref=cm_sw_r_cp_apa_i_GrsaDbBXQCCX9

    Aukru MPU 6050 Module 3 Axis Gyroscope+ 3 Axis Accelerometer Module for Arduino,arduino Accelerometer, https://www.amazon.ca/dp/B019SX74TE/ref=cm_sw_r_cp_apa_i_rssaDbEW2D0HG

    MyRobotUniverse GPS Module GY-NEO6MV2 NEO-6M with Flight Control EEPROM RS232 TTL Large Antenna for Arduino Raspberry Pi GPS APM2 APM2.5 NEO6MV2 3-5V https://www.amazon.ca/dp/B07KSJLXXT/ref=cm_sw_r_cp_apa_i_-AsaDbTDXVVAA

    Throw in a couple air pressure sensors...

    A simple light inexpensive open source MFD for ultralights and experimentals. Air/ground/true airspeed a attitude indicator gps tracks etc. It would be pretty awesome.
     
  12. Jun 12, 2019 #92

    cluttonfred

    cluttonfred

    cluttonfred

    Well-Known Member

    Joined:
    Feb 13, 2010
    Messages:
    6,351
    Likes Received:
    2,208
    Location:
    World traveler
    ePaper/eInk displays (like a Kindle, Nook, etc.) are getting cheaper and faster. Some have three colors (white/black/red for example) but they can take a long time (>10 seconds) to refresh the image. Some of the plain black/white ones have a refresh rate of just 1-2 seconds. The displays use very little power (no backlight required) and are sunlight readable so I can definitely see them working well for instruments as the technology evolves.
     
    MadRocketScientist likes this.
  13. Jun 12, 2019 #93

    Charles_says

    Charles_says

    Charles_says

    Active Member

    Joined:
    May 27, 2019
    Messages:
    42
    Likes Received:
    17
    Please do forward the code and pinouts to me
    TIA!
     
  14. Jun 14, 2019 #94

    Bill Welter

    Bill Welter

    Bill Welter

    Member

    Joined:
    Jun 11, 2019
    Messages:
    8
    Likes Received:
    8
    I'm using 3461BS LED chip, which comes in different colors, only using the right three digits. The pressure transducer is the common MPXV7002DP . I'm using a small switch to select knots or mph. I prefer knots, but when its set to mph, the decimal points on the chip light up to tell the pilot he's looking at MPH. I'll write down the pinouts later, here's the code:

    #include <Esplora.h>
    #include <Wire.h>
    #include <SPI.h>

    int Corr = 0; // 0 pressure is ~offset 555 on the sensor
    int Sensor1 = 0;
    int OffsetC = 0;
    float AirSpeed1 = 0.0;
    int AirSpeed1R = 0;
    float MagicNum = 1.06; // to make the system match a real gauge
    int Switch = 0; // 0=Knots, 1=MPH
    int TimeOn = 1; // LED lit time, in MSec
    int InterDigitTime = 7; //MSec delay before next digit is lit
    int Thousands = 0;
    int Hundreds = 0;
    int Tens = 0;
    int Ones = 0;

    int SegA = 2;
    int SegB = 3;
    int SegC = 4;
    int SegD = 5;
    int SegE = 6;
    int SegF = 7;
    int SegG = 8;
    int DP = 9;
    int Digit1 = 13;
    int Digit2 = 12;
    int Digit3 = 11;
    int Digit4 = 10;


    // Functions

    void DisplayDigit (int Dig, int Num) /////////////// Displays the digit
    {
    ClearAll ();
    if (Dig==1) {digitalWrite(Digit1, HIGH);}
    else if (Dig==2){digitalWrite(Digit2, HIGH);}
    else if (Dig==3){digitalWrite(Digit3, HIGH);}
    else if (Dig==4){digitalWrite(Digit4, HIGH);}

    if (Switch <20) {digitalWrite (DP,LOW);} // Turn on decimal point if switch set to MPH

    if (Num==0)
    {digitalWrite(SegA, LOW);
    digitalWrite(SegB, LOW);
    digitalWrite(SegC, LOW);
    digitalWrite(SegD, LOW);
    digitalWrite(SegE, LOW);
    digitalWrite(SegF, LOW);
    }

    if (Num==1)
    {digitalWrite(SegB, LOW);
    digitalWrite(SegC, LOW);}

    if (Num==2)
    {digitalWrite(SegA, LOW);
    digitalWrite(SegB, LOW);
    digitalWrite(SegG, LOW);
    digitalWrite(SegE, LOW);
    digitalWrite(SegD, LOW); }

    if (Num==3)
    {digitalWrite(SegA, LOW);
    digitalWrite(SegB, LOW);
    digitalWrite(SegC, LOW);
    digitalWrite(SegD, LOW);
    digitalWrite(SegG, LOW);}

    if (Num==4)
    {digitalWrite(SegF, LOW);
    digitalWrite(SegG, LOW);
    digitalWrite(SegB, LOW);
    digitalWrite(SegC, LOW);}

    if (Num==5)
    {digitalWrite(SegA, LOW);
    digitalWrite(SegF, LOW);
    digitalWrite(SegG, LOW);
    digitalWrite(SegC, LOW);
    digitalWrite(SegD, LOW);}

    if (Num==6)
    {digitalWrite(SegA, LOW);
    digitalWrite(SegC, LOW);
    digitalWrite(SegD, LOW);
    digitalWrite(SegE, LOW);
    digitalWrite(SegF, LOW);
    digitalWrite(SegG, LOW);}

    if (Num==7)
    {digitalWrite(SegA, LOW);
    digitalWrite(SegB, LOW);
    digitalWrite(SegC, LOW);}

    if (Num==8)
    {digitalWrite(SegA, LOW);
    digitalWrite(SegB, LOW);
    digitalWrite(SegC, LOW);
    digitalWrite(SegD, LOW);
    digitalWrite(SegE, LOW);
    digitalWrite(SegF, LOW);
    digitalWrite(SegG, LOW);}

    if (Num==9)
    {digitalWrite(SegA, LOW);
    digitalWrite(SegB, LOW);
    digitalWrite(SegC, LOW);
    digitalWrite(SegF, LOW);
    digitalWrite(SegG, LOW);}
    }


    void ClearAll ()
    { digitalWrite(Digit1, LOW);
    digitalWrite(Digit2, LOW);
    digitalWrite(Digit3, LOW);
    digitalWrite(Digit4, LOW);
    digitalWrite(SegA, HIGH);
    digitalWrite(SegB, HIGH);
    digitalWrite(SegC, HIGH);
    digitalWrite(SegD, HIGH);
    digitalWrite(SegE, HIGH);
    digitalWrite(SegF, HIGH);
    digitalWrite(SegG, HIGH);
    digitalWrite(DP,HIGH);}



    // MAIN ///////////////////////////////////
    void setup()
    { pinMode(SegA, OUTPUT);
    pinMode(SegB, OUTPUT);
    pinMode(SegC, OUTPUT);
    pinMode(SegD, OUTPUT);
    pinMode(SegE, OUTPUT);
    pinMode(SegF, OUTPUT);
    pinMode(SegG, OUTPUT);
    pinMode(Digit1, OUTPUT);
    pinMode(Digit2, OUTPUT);
    pinMode(Digit3, OUTPUT);
    pinMode(Digit4, OUTPUT);
    Serial.begin(9600); // initialize serial communication at 9600 baud
    Corr = analogRead(7);} // get 0 pressure on startup

    // this loop routine runs over and over again forever:
    void loop()
    {Sensor1 = analogRead(7);// get the offset, max vacuum -2kpa = 0, ambient air pressure is about 554
    // and max pressure 2kpa = 1016 ;
    Serial.println(Sensor1); // debug
    Switch = analogRead (15);
    OffsetC = Sensor1 - Corr; // so from now on 0 pressure = 0 offset

    AirSpeed1 = (sqrt(OffsetC*36.749*MagicNum))*0.868976;
    AirSpeed1R = AirSpeed1; // 1R is INT and this rounds down
    if ((AirSpeed1-AirSpeed1R) > 0.499)
    {(AirSpeed1R = AirSpeed1R+1);} // round to nearest Int, up or down
    if (Switch < 20) { (AirSpeed1R = AirSpeed1R*1.1504);} // Display Switch set to "MPH"

    // Serial.println(AirSpeed1R); // debug statement, prints the speed that should be displayed to the serial port

    Thousands = AirSpeed1R/1000; // break the integer down into 4 separate numerals to be displayed
    Hundreds = (AirSpeed1R-(Thousands*1000))/100;
    Tens = ((AirSpeed1R-((Thousands*1000)+(Hundreds*100)))/10);
    Ones = (AirSpeed1R-((Thousands*1000)+(Hundreds*100)+(Tens*10)));

    if (AirSpeed1 < 112) // Max for the 2kpa sensor is ~115 kts
    {
    if (AirSpeed1R > 999)
    { DisplayDigit(1,Thousands);
    delay(TimeOn);
    ClearAll ();
    delay(InterDigitTime);}

    if (AirSpeed1R > 99)
    {DisplayDigit(2,Hundreds);
    delay(TimeOn);
    ClearAll();
    delay(InterDigitTime);}

    if (AirSpeed1R > 9)
    {DisplayDigit(3,Tens);
    delay(TimeOn);
    ClearAll();
    delay(InterDigitTime);}

    DisplayDigit(4,Ones);
    delay(TimeOn);
    ClearAll ();
    delay(InterDigitTime);
    }

    } // end of main loop
     
  15. Jun 14, 2019 #95

    Charles_says

    Charles_says

    Charles_says

    Active Member

    Joined:
    May 27, 2019
    Messages:
    42
    Likes Received:
    17
    #include <Esplora.h>
    #include <Wire.h>
    #include <SPI.h>

    // Snipped for brevity
    // End snip

    } // end of main loop[/QUOTE]

    Sincere thanks for your time and EFFORT!!

    Charles.
     
  16. Jun 14, 2019 #96

    Bill Welter

    Bill Welter

    Bill Welter

    Member

    Joined:
    Jun 11, 2019
    Messages:
    8
    Likes Received:
    8
    Good write-up by Adam Drees on the 3461BS 4-digit, 7 segment LED chip. I chose that chip because the digits were the right size for my needs: https://www.adamdrees.com/tag/3461bs/

    The chip uses 12 pins to light up the LEDs. Here are the chip pins (left column) and the pins I connected them to on the Arduino Mega (A/M). I didn’t know anything about Arduino a few months ago, and just ordered the Mega.

    Top Row 3461BS...Arduino Mega Pin
    D1.....................13
    a....................….2
    f.....................….7
    D2....................…12
    D3....................…11
    b.....................….3

    Bottom Row 3461BS...Arduino Mega Pin
    e......................….6
    d......................….5
    dp.....................…9
    c......................….4
    g......................….8
    D4......................…10

    Mph/Kts switch - one side GND, other side A/M pin A15
    Pressure transducer input from MPXV7002DP - A/M pin A7
     
    Last edited: Jun 14, 2019
    Charles_says likes this.
  17. Jun 14, 2019 #97

    N500BC

    N500BC

    N500BC

    New Member

    Joined:
    Nov 30, 2015
    Messages:
    3
    Likes Received:
    0
    Location:
    Bogotá Colombia , South America
    Hi all! This got me thinking. I just bought a Stratux that works wonderfully on ipad. I use aerovie as the nav and backup attitude app. Connected to the Stratux I get a great and very accurate EFIS. However, all airspeed is really GPS Groundspeed. As a back up that is not a problem. It is almost more precise than the gps groundspeed on my Garmin aera 500. Attitude AHRS sensors are muuuuch better. I would say even better than my mechanical gyro of the C172 I rent.
    Could it not be a better idea to get those Baro pressure/differential pressure sensors integrated to something like the Stratux and get the whole picture? Stratux receives ADS-B so it would definitely become a turn key solution. Furthermore, new iPhones and iPad are equipped with a baro sensor. Can´t they be all rolled into one to display both sensor dynamic/static pressure airspeed and alt as well as GPS groundspeed? I have NO CLUE of electronics or electrics but would think that half or more has already been done and integrated to Stratux. There is also this new wingbug thing https://www.wingbug.com which mounts out on the wing. But for $950 dollars I'd much better wnat to integrate the above to Stratux and have a whole system for around 300 bucks! For 950 I'd buy the AvMap ultra EFIS
     
  18. Jun 14, 2019 #98

    Bill Welter

    Bill Welter

    Bill Welter

    Member

    Joined:
    Jun 11, 2019
    Messages:
    8
    Likes Received:
    8
    Here's the Arduino Airspeed Indicator. On the gauge, kts is in the middle scale, mph on outside range.
     

    Attached Files:

    Hephaestus likes this.
  19. Jun 14, 2019 #99

    Hephaestus

    Hephaestus

    Hephaestus

    Well-Known Member

    Joined:
    Jun 25, 2014
    Messages:
    772
    Likes Received:
    158
    Location:
    YMM
    What might work better is actually just doing like bill did, but outputting via Bluetooth serial, then it's just getting the app builder to add a way to take and display that data.
     
  20. Jun 15, 2019 #100

    Charles_says

    Charles_says

    Charles_says

    Active Member

    Joined:
    May 27, 2019
    Messages:
    42
    Likes Received:
    17
    I started playing with the Arduino about a year and a half or so ago
    Starting to get curious about Can Bus, Where separate sensors "talk" to the Arduino and ....can be remotely mounted, similar to what the automobile industry uses.

    Thanks again Bill!![/QUOTE]
     

Share This Page

arrow_white