Electronics: Autopilot Computer (AP)
In my last post I described the overall electronics architecture. In this post I'll give some details about one of the two Arduino-based computers: The Autopilot Computer, a.k.a. the AP.
To review from the last post, I'm using two computers primarily to achieve redundancy for certain safety-related functions, namely the abilities to cut down the HAPP from the balloon and to deploy the parachutes. A side benefit is that I can dedicate one of the computers to the time-sensitive task of stabilizing the HAPP with gas jets. That's the job of the AP computer.
In a future post I'll describe the full job of the Flight Controller (FC) computer. For now simply note that the AP & FC constantly talk back and forth, checking up on mutual status. If either computer fails to answer, the other assumes a problem and terminates the flight, bringing the HAPP down safely.
The full list of hardware integrated into the AP looks like this:
- Inertial measurement unit or IMU. Detects linear accelerations and angular rates of rotation so the computer knows how the HAPP is oriented in space. Based on this information, the AP fires appropriate jets to stabilize the HAPP. I'm using a Bosch BNO055running on the AP's I2C bus.
- Altimeter / Barometer. This is a backup for the GPS embedded into the FC computer. This altimeter is not as accurate as GPS-derived altitude, but at least we'll have approximate data stored on the AP for post-flight analysis if anything goes wrong with the FC. I'm using an MPL3115A2 running on the AP's I2C bus.
- Digital thermometer. A Maxim DS18B20. While not used for any decision-making logic on flight day, why not take the opportunity to grab some environmental data? This sensor runs on a "One Wire" bus.
- Micro SD card reader/writer. An Adafruit breakout board for logging data that can be used for post-flight analysis. Runs on the SDI bus.
- I2C hot-swappable buffer. An Analog Devices ADuM1250 running on the I2C bus. This little beauty is necessary for communicating with the FC. The two computers run off of separate power buses and do not share a common ground. In addition, the AP has several other devices on its I2C bus, and the FC would bring down the AP’s bus if it was wired in common and then lost power (try it if you don't believe me).
- Audible buzzer. A bit old school, but pretty useful for confirming certain things when the HAPP is fully assembled and we can't see the AP. It's one I had laying around from the old beginner's kit for Arduino that I bought about 18 months ago at the outset of the HAPP project.
- Bluetooth chipset. An Adafruit Bluefruit LE SPI Friend running on the SPI bus. Very useful for communicating with my iPhone during ground testing and pre-flight checks. I can send commands and receive data. Not useful once the HAPP is airborne and out of range!
- General purpose Input/Outputs for various HAPP hardware: The 12 jet control valves, the manifold pressure transducer, 4 status indicator LEDs, and pyros for the balloon cutdown (see this) and parachute deployment (see this).
- Adruino. The basis of the AP architecture. I'm using an Arduino Mega.
That's three I2C bus devices, two SPI bus devices, a One Wire bus device, 19 GPIO devices, and of course serial bus communications when the AP is plugged into my PC for programming. That Arduino is pretty busy!
I tied it all together with a collection of prototype shield boards, header pins, and connectors for some of the GPIOs.
Finally, to enable Bluetooth communications with my iPhone, I utilized once again the handy Arduino Manager from Fabrizio Boco. This little app makes it super easy to set up custom interface screens on a mobile device like this:
I'm not planning to publicly blog about the AP code development (can't give away all my beauty secrets :-) but I'm happy to answer questions via the comment section or by email. For now I'll simply refer you to some posts detailing development of the autopilot controls, located here and here. Those give an overview of the control strategy I've implemented on the AP computer.
Finally, I should note that as of a few months ago I'd never soldered a circuit board in my life. This project has given me an opportunity to gain yet another skill: Electronics prototyping. If an old mechanical engineer with large hands can learn to solder surface-mount components, then anyone can. Go grab some circuit components and have fun!