RASPBERRY PI MODEL ROCKET LAUNCH CONTROLLER The Raspberry Pi combined with some inexpensive circuitry makes a great launch controller. It allows one to use their mobile device as an interface, and can be easily expanded to control several launch pads. Within a week after I roughed out the design, I was informed that Apple had shown the same thing in their Powerful ad for the iPhone 5s. That means someone had this same idea months ago. This sort of thing happens to me a lot! I researched the hardware they were using, and it appears the controller is from a crowdfunded project that has stalled because of software issues. So, this project may still be useful. The basic idea is to configure the Pi as a wireless access point running a simple web server. This allows control of a GPIO pin from a custom web page that in turn switches on a power MOSFET to energize the ignitor. Power is provided by a 12 volt lead acid battery. The circuit is shown below. There is a master switch to prevent accidental launches while setting up the rocket, and a continuity indicator to make sure the clips are connected properly to the ignitor. Care has been taken to keep things as simple and low cost as possible. I built a dual pad controller on a 22 inch long piece of 1x4 oak which holds the Pi, circuitry, and 2 launch rods. Since you will use different materials than I did I won't give detailed build instructions. Here are pictures of portions of my build while in progress: Almost any transistor type opto-isolator will work. The MOSFET should be an n-channel device rated 10A or greater, with no more than a .8 ohm on resistance at a 10 volt gate potential. The piezo buzzer should be rated to work at 12V, and draw less than 50mA. Resistors should be 1/10 Watt or greater. Most parts can be salvaged from broken equipment. Opto isolators are used in switching power supplies such as the ones in monitors and computers. MOSFETS are used in larger switching power supplies and newer CRT monitors. Look up the specifications online to make sure they can handle 10A continuous. The MOSFET gate is very sensitive to static electricity, so keep the gate terminal connected to the source terminal with a temporary jumper wire until it is wired into the circuit. If you are salvaging MOSFETs I recommend soldering on the jumper before removal. Ignitor leads can be salvaged from an existing launch controller. I put the resistors on a small piece of proto board. Likewise with the opto isolators. The wires from the opto-isolator to the Pi should be kept as short as possible to prevent signal pickup, under 2 inches. The wires from the isolators to the MOSFETs can be much longer. The wires that connect to the opto isolator, buzzer, and resistors can be small gauge. The rest, since they will carry full ignitor current, should be at least 20 gauge. The ignitor circuit draws approximately 10A briefly and can induce harmful voltages in any nearby wiring, so follow standard procedures for minimizing crosstalk. In brief, keep the wires going to the Pi as far away from other wires as possible. Avoid running them in parallel to the high current wires, and if crossing stay as close to perpendicular as possible. The connections to the Source and Drain terminals can be made by tinning the wire and the MOSFET pin, holding the tinned wire to the MOSFET pin, heating both up with a soldering iron until the solder flows, and holding them still while they cool. Try to get the wire close to the pin along it's whole length, solder is a poor conductor of electricity. You may want to clean off the flux and insulate between the legs with epoxy if they look like they might short together easily. The MOSFET doesn't need a heatsink, but should be securely mounted. Everything should be boxed up (or at least attached to a plate or board) and the wires securely clamped to prevent shorts and damage. Remember, according to our friend Murphy, any short will probably launch the rocket at the worst time! The fuse must be of a value that will blow if the MOSFET stays on while the clips are shorted together, but not blow with normal use. It's value will vary based on the MOSFET on resistance. Normal use is a .1 second pulse into a .3 ohm ignitor. I tested mine by altering the controller code to apply progressively longer pulses to the fuse until it blew, using a test resistor instead of an ignitor. You can use a 12 foot length of 24 gauge wire instead of a .3 ohm resistor. For me, a 3A fuse blew at .3 to .4 seconds, just about right. If the code fails with the MOSFET on, the clips are shorted together, and the fuse fails to blow, the MOSFET will get very hot and possibly cause a fire. (I am considering a design change using a thermal fuse in contact with the MOSFETs instead of a regular fuse.) The controller can be expanded to control more launch pads by duplicating the section enclosed in dotted lines and connecting them to the battery and switch the same way as the shown section. The Pi can be powered with a 12V usb car charger connected to the battery (not shown). If it reboots when a rocket is launched, you will need a larger capacity 12V battery, or you can power the Pi from it's own battery pack. That's about it for the hardware. The rest of the instructions will be about configuring software on the Pi. Setting up the Pi as an access point depends on the wirelessn adapter used. Adafruit.com has excellent instructions on setting up access point mode, or you can search the web for others. If you are using the rtl8192 type of inexpensive mini-wifi adapter you will need to download the Occidentalis v0.2 distribution from Adafruit and use it instead of stock raspbian. Or you can download the kernel+modules tarball and use that like I did. Believe me, I have tried many options, including trying to back-port the wifi driver, and this is the best solution. Locations of everything are in the links page. I also have a disk image in this project's files page that can be copied to a 2G or larger SD card, the same way you do with Raspbian. It is set up for the rtl8192cu adapter. You will need a web server running that can call shell scripts using cgi. I recommend the Lighty web server. Do apt-get install lighttpd to install it, and then run the command /usr/sbin/lighty-enable-mod cgi to enable the cgi interface. The /etc/init.d/lighttpd file will also need to be replaced with the one from this projects files page. You must also run the command usermod -a -G gpio www-data to allow the shellscripts to access the GPIOs. Finally, from this projects files page, the three shell scripts and pin.html must be copied to /var/www/cgi, and the remaining two html files must be copied to /var/www. If you need them, the configuration files I used for wifi, dhcpd, and Lighty are on the files page. The software is designed to minimize accidental launches in a multiple pad/club environment. It is also kept simple for ease of modification. The software works as follows: index.html is loaded first and presents buttons for choosing a pad. The chosen pad number is passed to pad.sh which emits pin.html, modified slightly to include the pad number. This presents a keypad to enter a PIN. Once 4 digits are entered, they are passed to pin.sh (along with the pad number) which verifies the proper PIN was entered. It then makes an entry in /var/usermap associating the calling IP address with the pad number, then redirects to launch.html. This presents a launch button that when pressed calls launch.sh. This looks up the pad number based on the calling IP address and toggles the proper GPIO pin for a fraction of a second, then redirects to index.html after 2 seconds. There is also a function to shut down the Pi when a special PIN of 0000 is entered no matter which pad is selected. To operate, keep the master switch off until the rocket is connected and ready to launch. To test the ignitor connection, press the test button. If the connections are OK the buzzer will beep. If the buzzer beeps even when the test switch is NOT pressed, the MOSFET is burned out and must be replaced. (This has a good chance of happening since MOSFETs are not terribly rugged and external gate protection circuitry has been left out to keep costs low.) Turn the key on and connect your mobile device to the Pi wifi access point. If you use my config files the SSID is PiPad and the password is raspberry. Point your web browser to the address of the Pi. My config files set this to 10.0.0.1. Select your pad, enter a PIN of 1234 (an instructor may wish to do this part for all users so they can make sure everyone is clear of the pad), and press the launch button. The button is kept small to limit accidental launches. When done with all launches, select any pad and enter 0000 as the PIN to shut down the Pi. NOTE: If you try to launch more than one rocket at the same time, the fuse may blow. It would be a good idea to have some spares on hand. PINs, GPIOs, shutdown code and ignitor on time values can be changed by editing pin.sh or launch.sh as appropriate. If you get incomplete firings you will want to increase the on time. The software is set up to control 2 pads, if you want to control a different number you will have to make changes to pin.sh, pad.sh, and the table section of index.html. These instructions have not been exhaustively tested. If you find any errors, please email me at my gmail address thepirow. |


