Programming Cold Flow Update - Launchbox
What is the Launchbox?
The Launchbox is a Ground Station module that gives our team manual control of all the valves onboard our rocket engine during the pre-launch phase, when we are all hundreds of feet away from the engine and need to open specific valves to begin the fueling process. The Launchbox also gives our Ground Station operators the ability to safely abort any engine test from a far distance.
Although the Ground Station GUI allows our operators to open/close valves as they choose, this does have a chance, although a very, very minor chance, of failing (telemetry connection could fail, all Ground Station laptops could simultaneously freeze, etc). For this reason, the Launchbox provides a hardware-based fallback that will only be used if all else fails.
How does it work?
There are two main aspects to the Launchbox: the electronics and the software.
The current Launchbox consists of eight toggle switches and an abort button. At the heart of the Launchbox is an Arduino Mega, which is responsible for reading the states of all the buttons. Two long wires connect the Launchbox to the test stand (specifically the Valves Arduino), and any signal that the Launchbox sends is sent through these wires.
Each toggle switch controls one valve and can be in one of three positions: open, close, neutral. In the case that the Ground Station operator wants to open or close a valve, he/she will place the toggle switch for that valve in the corresponding position. This sends a signal to the test stand to override all flight computer signals and set that valve’s position. If the toggle switch is set to neutral, the test stand listens to the flight computer’s instructions as to the position of the valve.
Two of the eight valves on our rocket engine are called vent valves. These can be cycled on/off to vent any excess pressure within our plumbing or tanks. For this reason, these two special valves each have an extra button on the Launchbox: a vent button. When pressed, the vent valves will open for a few seconds to relieve the excess pressure.
The abort button is a single push button at the bottom of the Launchbox. If this button is pressed at any point during a test, the Launchbox sends a signal to the test stand to abort the system.
Currently, all the electronics are wired to a breadboard housed inside the wooden frame. Since we ascertained that the Launchbox works during the Cold Flow test, we will be transitioning from using a breadboard (meant for prototyping) to using a PCB. This will make all our connections more secure and prevent any wires from accidentally popping loose, as often happens with a breadboard. It also gives the Launchbox a clean aesthetic :)
The Launchbox (from a software perspective) must be able to do the following tasks: read from buttons (both push buttons and 3-state SPDT switches), send data to the Flight Software, and manage abort functionality.
Reading from push buttons is a fairly trivial task; push buttons send HIGH signals when pressed and LOW signals otherwise, so the Launchbox simply has to check for one or the other signals on each push button. Reading from 3-state, SPDT switches, however, is a bit more complicated, as these switches have 3 states (the switch being flicked up, down, or in the middle), but only 2 possible return signals (HIGH or LOW), and the switches are only wired to 2 pins.
To manage this, each 3-state switch has the following configuration: if the switch is flicked up, the highest number pin outputs a LOW signal, and the other pin outputs a HIGH signal; if the switch is flicked down, the lowest number pin outputs a LOW signal, and the other pin outputs a HIGH signal; if the switch is in the middle, both pins output a HIGH signal. Our code first checks to see which of the 2 pins have a LOW signal, and if neither pin has a LOW signal, then the switch must be in the middle orientation.
Based on the orientation of these switches, valves are actuated in a certain manner. The Launchbox, however, does not actuate valves directly; it instead commands the Flight Software to do this for the Launchbox.
The Launchbox sends commands to the Flight Software over the Serial interface: a wire connects the Launchbox Arduino to the Flight Software Valve Arduino via the Serial pins, and data gets sent through that wire via the Serial protocol. The data sent has two components: the pin of the valve to be actuated, and the actuation type (OPEN, CLOSE, or PULSE).
Valves, however, cannot be actuated if the rocket is placed into Abort mode via the Abort button on the Launchbox, and the Launchbox manages this by setting a flag if that button is pressed. In the event of an abort, all valves are opened in order to release all pressure from the rocket and prevent an explosion.