HOME Flying Quotes Paragliding Addictionary Whether to Fly DIY Electronics for PG Sites Logged Gallery A Diary Contact

Silicon Labs 8051F320 micro-controller based alti-vario

This altimeter/vario uses a Silicon Labs 8051F320 8-bit micro-controller and a Nokia 3310 LCD display. The micro-controller has an 8051 mcu, 16kBytes of flash memory and 1280bytes of RAM. This is enough for an application featuring multiple pressure tables for altitude correction, real-time clock, flight log recording etc.


  • Nokia 3310 LCD Display
  • Altitude in metres above sea level, -125m to 6100m, with 1m resolution
  • Altitude in metres above/below launch, with 1m resolution
  • Climb/sink rate in m/s, -25m/s to 25m/s with 0.1 m/s resolution
  • Current time in hours, minutes maintained by a real-time clock with calendar
  • Elapsed flight time in hours, minutes with auto start
  • Temperature in degrees Celsius, -9C to +60C, with 1C resolution
  • Variometer audio beep pitch and repetition rate are proportional to climb rate
  • Variometer sink continuous tone warning configurable threshold, -1m/s to -4m/s
  • Variometer climbrate audio configurable threshold, -0.75m/s to 0m/s
  • Flight Log records a maximum of 30 flights : flight date, launch time, duration, launch altitude, max altitude, LZ altitude, max climb rate, max sink rate, max temperature and min temperature
  • Uses standard Nokia Li-Polymer battery, > 100 hours run time per charge
  • Component List with retail prices

  • Intersema MS5534B pressure sensor x 2(www.intersema.ch): US$50
  • Silicon Labs C8051F320 MCU (www.silabs.com): US$12
  • Nokia 3310 LCD Display (PCD8544 compliant) (www.sparkfun.com) : US$9.90
  • DS1337C Real-time Clock (www.futurlec.com) : US$1.30
  • BSS138 NMOS FET smd transistor(www.futurlec.com) : US$0.80
  • 100uF tantalum 16V: (www.futurlec.com) : US$0.70
  • MicroSemi LX8211 low drop-out 3V linear regulator (www.digikey.com) : US$0.55
  • 24LC02 256byte I2C serial EEPROM: (salvaged)
  • 16ohm 0.2W mini-speaker : (salvaged)
  • 0.1uF ceramic SMD x 2: (salvaged)
  • 4.7uF ceramic SMD : (salvaged)
  • 1uF ceramic SMD : (salvaged)
  • 470pF ceramic SMD : (salvaged)
  • 200ohm 1/4w resistor: (salvaged)
  • 100kohm smd resistor x 2: (salvaged)
  • 10kohm smd resistor x 3: (salvaged)
  • 100uF electrolytic : (salvaged)
  • 4.7uF electrolytic : (salvaged)
  • Total Cost ~ US$75


    Testing prototype

    Random Design Notes

    I used two pressure sensors (Intersema MS5534B) in this application. I'd earlier used two VTI SCP1000 pressure sensors sampled alternately in time, with separate sample buffers, in order to reduce the response delay (time to ramp up or down to the true climb rate). This scheme works well with the SCP1000 which has good altitude resolution but poor sampling rate (max 9 pressure samples/second). The Intersema MS5534B has a better sampling rate (max 15 samples/second) but the altitude resolution is not as good. I decided to use a different method for improving vario response with this sensor. Despite factory calibration, there are small unit variations in the pressure sample values. We take advantage of this to simultaneously trigger two sensors and average the pressure samples. This gives us up to an additional bit of pressure resolution, and hence altitude resolution, with the same sampling rate. The DATA_IN and CLOCK lines for the two sensors are shared to ensure simultaneous triggering. This reduces the mcu i/o pin requirement as well.

    There's a big market for spare LCD displays for Nokia cellphones, and replacements for the Nokia 3310 LCD are very inexpensive and readily available (US$4 in India!). The LCD has an easy to program 4 pin gpio interface, and requires less than 1 mA at 3V.

    Flight log data is saved to a page of flash (512 bytes) on the 8051F320 MCU. Up to 30 flight records are saved, if there are more than 30 flights, the oldest one is erased to make room for the new record. I needed a few bytes of non-flash memory to store a few more software parameters. Ideally I should have used the DS1338C-3.0 Real-Time Clock. This chip has 56 bytes of available RAM. But unfortunately, I didn't have the part and had to make do with a DS1337C. So I used a salvaged 24LC02 256byte serial EEPROM for the additional non-volatile memory.

    Update: Since I've received a lot of questions about making the change, here's what you need to do :
    1. Replace the 24LC02 i2c device id (0xA0) with the DS1338C device id (0xD0)
    2. The 56 bytes of available RAM on the DS1338C start at byte address 0x08, not 0x00
    The zip file contains the changes. I haven't tested this myself, but I've received feedback that its OK.

    I used the Silicon labs ToolStick USB Programming base adapter to flash the MCU. This costs about USD17.50. I'd already purchased one for my earlier vario project using a Silabs F330 Toolstick. I soldered the C2 programming interface connections to a 0.1" 6-pin header and glued the header to the side of the USB adapter.

    Update: Lots of questions about this, so here are the details.

    An even cheaper programming option is the Silicon Labs 'Toolstick Evaluation Kit' for USD10.99. Cut the board between the USB programmer chip and the target chip, connect your own cable for the C2 programming interface and you have a really cheap USB flash programming adapter for the full range of Silicon Labs MCUs.

    For audio output, I used a sensitive 16ohm mini-speaker. I tried some salvaged 32ohm headphone and cellphone units, but they were not loud enough. If you have a sensitive broad-band piezo transducer (freq range ~ 1kHz to 4kHz) you can get rid of the speaker, 200ohm resistor, 100uF cap and BSS138 FET transistor. Connect the piezo beeper directly to the mcu pin. This should more than double the battery life.

    Update: the Kingsgate KPEG006 piezo works very well, frequency range 200Hz to 5kHz. One source is RS Electronics.

    After profiling the code, I managed to reduce the mcu clock to 1.5MHz. This resulted in an idle current consumption of less than 2mA, increasing to about 16mA when the audio tone is being generated. There is no on-off switch - you "power-down" by navigating to the flight log display page and pressing the Select button. The mcu then powers down the LCD display, switches to the 32kHz clock generated by the DS1337 RTC, and shuts down the internal clock oscillator. In this low-power sleep mode, the total circuit current consumption is just 0.4mA !!

    To power up from sleep mode, press the Select button for about 5 seconds.

    The circuit operates at 3V. To avoid switching noise from a charge-pump voltage regulator, I used a Lithium Polymer battery and an LX8211 low-dropout (150mV) 3V linear regulator. LiPoly batteries have a voltage of 4.2V when fully charged, with a nominal voltage of 3.7V.

    I used a standard Nokia cellphone BL-5C LiPoly battery. Battery life was well over 100 hours the one time I left it to run in flight display mode with the audio tone being generated approximately 25% of the time.

    Update: Someone pointed out correctly, that this circuit does not provide over-discharge protection even though it it is drawing power continuously even in sleep mode. So it would be a good idea to use LiPoly batteries that have inbuilt protection (thats over-charge and over-discharge protection) circuits. The TrustFire range of Li-Ion batteries with 900mAH capacity have built-in protection, come in AA form factor, stick them in a AA battery holder and you're done. You can build your own customized USB or mains adapter battery charger with a bare minimum of components using specialized LiPoly charger ICs - e.g. the MAX1555 or MAX8600.

    Source code, schematics and data sheets

    The circuit schematic and component datasheets are in the document archive.

    The code archive contains the source code and Silicon Labs configuration wizard and IDE project files. Last update : 2008 November 16

    User Interface

    Press and hold the Select button until the unit powers up - this should take about 5 seconds.

    On power up, the flight log is displayed. Each flight record consists of the flight number, flight date, flight launch time, flight duration, launch altitude, maximum altitude, lz altitude, maximum climb rate,maximum sink rate, maximum temperature and minimum temperature. Use the L and R buttons to cycle through the 30 flight records. Flight 01 is the most recent flight, flight 30 is the oldest flight. Press the Select button to power down. Press the Page button to move to the Settings page. Press both the Select and Page button simultaneously to clear the flight log.

    In the Settings page, press the Select button to cycle through the different options, and the L and R buttons to change the parameter values.

    You can correct the altitude to some extent by selecting one of three pressure-altitude tables. They differ in the value of the mean sea level pressure used as a reference in computing altitude above mean sea level. Select the middle table for Airspace (aka Pressure or Flight) altitude. This uses a nominal mean sea level pressure of 1013.25mBar.

    The sink rate threshold for the audio sink warning can be adjusted from -1.0m/s to -4.0m/s in steps of 0.5m/s.

    Modern paragliders have a minimum sink rate of about -1.0m/s, so if you are sinking slower than this, you are in lifting air. The climb rate threshold for audio lift indication can be adjusted from -0.75m/s to 0.0m/s in steps of 0.25m/s.

    The other settings are for the real-time clock calendar date and time.

    Press the Page button to select the flight display mode. In this mode, the screen displays the altitude in metres above sea level (MSL), temperature in degrees Celsius, altitude above launch in metres, climb rate in m/s, current time, and elapsed flight time in hours and minutes.

    When you enter this mode, the climbrate audio threshold is set to 0.0m/s so you can check the variometer function is working correctly.

    When you are ready to launch, press the Select button to record the launch altitude. An "OK" status is then displayed on the screen. The climbrate computation is now disabled to avoid the distraction of a noisy vario while you are waiting to launch.

    After you launch, when the altimeter sees an elevation change of 5m from the recorded launch altitude, the flight duration timer display automatically starts. And of course, the climbrate calculation will then be enabled, and the climbrate threshold for the audio beep is set to the value you specified in the Settings page.

    After landing, press the Page button. The unit will now record the landing altitude, and then display the completed flight statistics. To power down, press the Select button. Else press the Page button to move to the Settings page.

    Field test

    I flight tested this vario in October 2008 at Bir/Billing in India. I did have to tweak the audio response to allow for more discrimination in the low climb rate scale, from 0 to 2m/s. I also fixed a bug related to the audio being out of sync with the displayed (correct) climb/sink rate. I've published the latest code (v 1.00).