Arduino Powered Model Rocket Launcher

Get the code here.

The basic design for the rocket launcher sketch is a state machine. For those not familiar, I suggest reading the wikipedia article here. The rocket launcher has 8 states. They correspond roughly to the correct (as determined by me, following NAR guidelines) order for hooking everything up and safely launching a model rocket. Additionally, there are 2 states outside the normal operation, which are the error state, a safe mode in which the launcher locks out all actions until a reset is performed and it checks that all connections and switches are in a safe state, and a “hidden” config mode which can be used to adjust the countdown and fuse burn times. I would like to add config capability to the app as well, but for now it is accessed on the main launcher.

The first state is the Initialization state. This is the state the launcher will be in upon first powering on, and it returns to this state when leaving any other state out of sequence, and when resetting after an error. The purpose of this state is to set all the inputs and outputs on the arduino in a safe configuration, check all sensors and switches, and either proceed to the next, Ready state, if everything checks out, or to go to the Error state if something isn’t right.

The Ready state is where the wiring should be hooked up to the launch battery (if not already connected) and the rocket igniter. This must be done before arming the launcher or enabling the keyswitch on the remote, or the launcher will reset and go into the Error state. Once everything is properly connected and all switches are in the correct position, the covered Enable switch can be used to proceed to the Launch Enabled state. Alternately, you can enter the Config state by holding the Code button down for 3 seconds or longer. After this point, resetting the Enable switch will reset the launcher, allowing a person at the launch pad the ability to abort a launch for any reason.

The Launch Enabled state has two purposes. First, it begins constant continuity checks on the igniter (using a small current so as not to ignite accidentally) and continues to check all switches for correct positions. The second purpose is to allow the user to select their launch method. By pressing the Code button, the launcher will generate a 4 digit launch code and move to the Bluetooth Armed state, awaiting code from the smartphone app. Alternately, the launcher can go to the regular Armed state by using the keyswitch on the wired remote. Either will lock out the other, so that once selecting bluetooth, the remote cannot be used to trigger a launch, and if using the remote, you cannot launch from the app. If the wrong method is selected, the launcher must be reset to change it at this point, but the launch method can be selected during each launch.

The Armed state checks that all wiring remains properly connected and all switches in the correct position. It waits for the Fire button on the remote. If the keyswitch is reset, the launcher will reset. If the Fire button is pressed, the launcher will proceed to the Fire state.

The Bluetooth Armed state waits to receive the correct launch code from the smartphone app via the bluetooth receiver on the COM port. There is at this time no way to abort the launch from the app, the launcher can only be reset from this state at the main unit. This is another area where additional functionality could be added to the app. This state also checks the wiring and switches, and once it receives the correct code, will proceed to the Fire state.

The Fire state has one function: connecting the circuit from the launch battery through the igniter, hopefully causing the igniter to burn and launch the rocket. Therefore, wiring continuity is no longer checked during this state, as it is hoped that continuity will be lost as the igniter burns. The Fire state will perform the countdown sequence, showing the seconds remaining to launch on the digital display and beeping loudly every second. When the countdown is completed, it will set the igniter hot via a relay for the configured amount of time. If at any point during the countdown or fuse burn the ARM switch is turned off, the launch will be aborted. When the Fire state is done, it always proceeds to the Initialization state to reset and check.

The Error state is reached anytime the launcher detects an unsafe condition or incorrect sequence. For example, if there is continuity on the igniter before the launcher has forced the relay off, or if the Fire button is pressed on the remote before reaching the Armed state. Like the Initialization state, the Error state forces all inputs and outputs to a safe configuration upon entry. The only way to leave the Error state is to switch Enabled off and press the Code button, which will return to the Initialization state, and if anything is still wrong, the Initialization state will return here.

Finally, there is the Configuration state. This state allows the user to adjust the countdown and igniter burn times, in 1s and 100ms increments, respectively. It is entered by holding the Code button for at least 3 seconds in the Ready state. This follows a simple sequence. First the countdown time will blink on the display. The user can press code to increase the countdown time by 1 second, or flip the Enable switch to reset it to 0. By pressing Code for at least 3 seconds, the countdown time will be saved. The burn time is then set the same way, with each press of the button incrementing it by 100 milliseconds, the Enable switch resetting the time to 0, and holding Code for 3 seconds to save. After setting the burn time, the launcher will return to the Initialization state. If either value is set to 0 at this time, it will revert to the default setting.

That is the high-level overview of the design. For more details, I recommend looking at the code, it is commented and not doing anything particularly tricky. Most of the safety features, outside the constant checking of igniter state and switches, is built in to the hardware.

Leave a Reply