This is an altimeter that works on the with Spektrum X-bus receivers using a 1s lipo battery. It was designed to be light weight for DLGs (discuss launch gliders).
X-Bus is Spektrum’s external interface for telemetry devices – electrically it is I2C. Functionally, the receiver polls all devices once at power up, and any device that replies is continuously polled from then on.
The altimeter is made up of a microcontroller, altimeter, voltage regulator and connectors for the X-Bus interface and ISP programming.
The microcontroller is an ATtiny45-20XU in an 8X package which is half the weight of the next lightest package. Unfortunately only the ATtiny45 comes in this package so memory is restricted to 4k.
The altimeter is a MS5607-02BA03 Barometric Pressure Sensor. This is a tad pricey at about $5 each in small quantities. The pressure sensor works as an altimeter because, as you get higher, the pressure decreases in a known fashion, hence the altitude can be calculated. This is documented in the datasheet and application notes for the IC. The MS5607 can be interfaced via I2C or SPI. The original plan was to use SPI, but I ran out of free pins on microcontroller – the SPI interface requires MISO, CLK and CS. The CS is required to delimit messages.
A voltage regulator is required because the altimeter requires 1.8 to 3.6 V – this is too low for a fully charged 1s lipo (4.2V).
The X-Bus I2C interface is connected to the microcontroller hardware I2C (USI TWI) peripheral. The microcontroller is the slave. The altimeter is interfaced using a software I2C implementation (eXtreme Electronics, India) where the microcontroller is the master. It was unsafe to try use multiple masters on the one I2C bus because of the rate at which the receiver polls the altimeter.
The pressure is calculated using the equations in the datasheet. The equations are integer maths, but care had to be taken not to overflow the calculations. With the pressure calculated, the height is interpolated using a precomputed table of pressure/height values. These are generated in the spreadsheet, and stored in “altitudemap.h”. The data in github gives altitudes from 0 to 700m, which is fine for me because I live pretty close to sea level. This was also limited by the 4k memory limit of the attiny45.
The completed board is shown below (with bonus fibre).
The weight of the board is 0.27 grams.
When combined with a naked AR6270T (no case, no servo pins, no sockets, and short antenna), the weight is 4.68 grams (including the temperature thermistor)
Source and hardware files are in github – 1sXBusAltimeter
As with the 1s Low Voltage Monitor, this hasn’t been used because I switched to FrSky for my DLGs. The G-RX6 has a built in altimeter (actually a variometer – it measures changes in height too), and a naked version of this is 0.9 grams.
There are a few issues remaining, mainly with the height fluctuating 5m when still – it may need software filtering, or maybe power supply filtering.