Software apps and online services
Captain Tammie Jo Shults landed a Southwest Airlines plane after one of the engines exploded saving 149 souls on board. Such skills come from a lot of practice which is effective only with proper feedback. That's where the Highly Efficient Altitude Recording & Transmitting (HEART) comes in.
SmartEdge Agile will be used to capture Atmospheric Pressure and Temperature. In order to calculate altitude we will get Sea-level Pressure from one of National Oceanic and Atmospheric Administration websites.
You can't spell co-pilot without Pi. A Raspberry Pi will be used as Gateway and to save data locally while online.
It will also use Matplotlib to plot the Flight Profile.
HEART started with a SmartEdge Agile and a Raspberry Pi Zero W.
Needed more power to run Chrome so upgraded to Raspberry Pi 3 Model B+.
In the final phase HEART became whole.
Added a momentary switch between pin 7 and pin 9. When the switch is held down it will initiate shutdown sequence.
Removed SmartEdge Agile switch and replaced the internal battery with two wires. We will no longer need to manage power and operation of SmartEdge Agile separately.
Added two diodes in series to step down the 5 Volt we get from pin 4 (5 - 2 * 0.6 = 3.8 Volt).
Bringing it all together.
Three Python files needed for this solution to run, and they are all on GitHub. We've included plenty of comments in the code, but here is a quick overview:
The first file we created, FlightProfile.py, used REST API to ensure the Gateway and Device are accessible before running the main code.
The second file is CoreFP.py. The purpose of this file is to use Selenium to get Sea-level Pressure from NOAA and then log into the Portal. Once in the Portal, we can then open the project and start tracking then start recording. When we hold down the Red button for two seconds, Selenium will stop recording, stop tracking, then shutdown Raspberry Pi.
MQTTFP.py is the last required file for this solution. In this file we subscribed to all topics in MQTT API then saved message payloads in a local SQLite3 database, not as raw data, but after calculating altitude.
There is another file named FlightProfilePlotter.py which used the aforementioned database to plot the flight profile and show altitude in real time. Same file can also be used to study flight profile data downloaded from the Portal.
There are two more files in GitHub:
- cacert.crt will be used by Python for MQTT API
- FlightProfile.desktop is the file that needs to be placed in /home/pi/.config/autostart to automatically start FlightProfile.py
This is a screen recording of the portal in the background and Gateway (Raspberry Pi 3 Model B+) in the foreground. The second part of the video shows how Selenium controls Chrome.