Optical apogee detection   

This article describes a water rocket recovery system that will detect the highest point of the flight, separate the nose cone from the rocket body and deploy a parachute that will bring the rocket safely down again. This recovery system is a combination of an optical apogee detector and a high voltage solid state electromagnetic electromagnetic system described here.
This previous electromagnetic deployment system was based on repulsion of 2 permanent magnets holding the nose cone in place by discharging a high-voltage flash capacitor through a relay coil. The trigger was provided by a timer circuit that was started by an inertial launch detector. The time could be set between 4-7 seconds, which was about the time needed to reach apogee - with my rockets anyway.
Although this system proved to be very fool-proof and successful, there is no fixed relationship between the time between launch and apogee. This is dependent on rocket shape (drag), launch pressure, rocket weight, reaction mass, etc... Have a look at some of the excellent water rocket simulators on the internet to understand that there are a lot of parameters influencing maximum height = apogee.
Detection of the apogee height is possible by a number of known techniques:

I chose to develop something new that I had in mind for some time already: optical apogee detection.
The starting point is simple: it is safe to say that most launches take place outside. Most launches are also pointed upward and most launches take place when the weather is nice. This all leads to the following statment: an optical detector inside the rocket body pointing up will "see" more light than an optical detector pointing down. The sun is a very bright light source and in most cases the sky will be brighter than the earth. Exceptions: night launches, water, snow... etc. But let us assume that in most cases the assumption about 2 photodetectors is true.
When the rocket reaches apogee and the center of gravity is located towards the nose, most rockets will tip over and come down nose first, aka the infamous lawn-dart. This is typically the moment you start praying for your recovery system to function properly.
Also, just after apogee, the speed of the rocket is very low, so this is ideal to eject a chute with very little risk of being ripped apart or shock cord breaking,....we've seen it all. One remark here: I always use a rubber band / bungee as a shock cord and this has never broken yet.

One of the targets of this project was also to keep it as stupid and simple as possible (KISS).
I am convinced that you can build a much better optical apogee detector using a microcontroller interfacing an optical mouse sensor, as the robotics people do, but the goal here was to keep it accessible for anyone with limited soldering and electronics skills.
So, sit back, relax, grab your favorite regional beer and let's have a look at the simple electronics needed for an optical apogee detection + deployment system.

Detection electronics
Have a look at the Schematic diagram.
The 2 photodetectors are simply 2 photodiodes. I used the SFH203: Datasheet
A photodiode that is reverse biased will allow a current to flow through the diode that is in linear relationship with the light falling onto the diode chip. The photodiode housing is mostly transparent, allowing visible light to reach the embedded chip. So, the more light onto the chip, the more current flowing through the diode.
Since it is easier to compare 2 voltages than 2 currents, the current through the photodiodes is converted to voltage with 2 resistors. Here, the resistor value is 2.2 MegaOhm, resulting in a voltage between 0 and 6 Volts depending of the light intensity that is detected. Different photodiodes will result in different currents. The problem is that the photo diodes have to detect a wide dynamic range of light input (eg a dark rainy day compared to a bright sunny day). The use of 2 photodiodes that are compared relatively to each other makes the sensor insensitive to absolute light vaues. It is also possible to use a photoresistor here instead of a photodiode.
One of the photodiodes will be mounted in the rocket looking up (towards the sky at launch). The other is looking down at launch. This means normally that across the top resistor there will be a higher voltage than across the bottom resistor. The 2 resulting voltages are now ready to be compared with - surprisingly - a voltage comparator. In this case I used a very common LM393: Datasheet.
Some applications with voltage comparators + optical sensors can be found here and here
The LM393 is an 8 pin component with 2 identical voltage comparators on board. Here, only one is used. The other one is tied to fixed voltages at the inputs to prevent it from oscillating.
At the negative input (pin 2) we have the photodiode looking up at launch generating a higher voltage than the photodiode at the positive input (pin 3). Negative is higher than positive, this results logically in a low voltage at the output (pin 1).
When the output is low, the LED connected between the output pin and the power supply ( 12 V battery), will conduct and emit light. The green LED is an indication that the apogee detector is ready and working - to be checked just before launch. I used a high-brightness LED here which is clearly visible even from 10m away in broad daylight.
The voltage comparator and the photodiodes need of course an on-board power supply. Here, I used a small 12V battery - type MN21, eg by Duracell:
There are better and even smaller batteries available in the RC world. However, this battery is light weight and yet affordable. It is not rechargeable and can only deliver a very small current due to its high internal impedance.
To switch the power supply on/off, a small power switch is added - bottom right of the schematic diagram.

Deployment electronics
So far, we have built an optical detector that will signal when the rocket tips over at apogee - the LED will go out - but this won't stop it from continuing its high speed journey towards the ground.
As a recovery system, I used the same electromagnetic repulsion mechanism that I have used very successfully in my previous recovery system.
A magnet is attached to the iron core of a coil from a small 12V relay. 2 of these magnets hold the nosecone in place. When a large current flows through the coil, a magnetic field with opposite polarity is generated and the magnet is fired from the core of the coil. Depending on the force of the magnet and the current + number of windings of the coil, this can be quite spectacular. To store the energy for the current through the coil, a flash capacitor salvaged from a disposable camera is used. The flash capacitor is charged prior to launch to a respectable 300V, using a home-made high-voltage (HV) charger, as described in this page. You can use the entire disposable camera as it is: take out the big flash capacitor to use inside the rocket and use the rest as the charger: connect a red wire to the PCB of the camera where the + pin of the capacitor was and a black or green wire to the - pin on the PCB. Add 2 alligator clips to the end of these wires and you have your personal HV charger.
WARNING: You may get shocked by the charger and/or flash capacitor ! You may even die from this shock or worse: wet your pants and therefore, the usual disclaimers are in place here: I am in no way responsible for what you are doing. Just be careful while dismantling flash cameras and handling high-voltage components ! If you don't feel confident about what you are doing, sit back and have a regional beer instead.
The flash capacitor is charged via the 1N4007 diode. This diode has 2 functions:

There are 2 contact points to attach the charger to: a + terminal going via the diode to the + pin of the capacitor and a - terminal connected to ground. As we will see further on in the construction details, both terminals are also used for fixation of the PCB inside the rocket head section.
Now that we have the detection electronics and the charged capacitor, all we have to do is to provide an interface between the low voltage optical detection circuit and the high voltage charge. This is accomplished with the transistor IRF740: Datasheet
This is a 400V power MOSFET. The minimal treshold gate voltage for the device to conduct is between 2 and 4 Volt. The output of our comparator is 0 V when the rocket is pointing up and 12 V (or whatever the battery voltage is) when the rocket is pointing down. So, we can connect the output of the comparator directly to the gate of this transistor.
The 2 coils are connected in parallel here. I use 2 coils to have 2 fixation points for the nose cone - with 2 magnets. You may consider using only one coil and one magnet, depending on your mechanical setup of the nose cone separation. The 1N4007 diode across the coils is to protect the MOSFET from overvoltage spikes. There is already a protection diode inside the transistor housing, so you may consider omitting this diode. I soldered a diode between the 2 legs of each coil, just to hold them mechanically in place. The relay coils are very delicate devices and whatever you move or touch may break the coil wire.
This concludes the description of the electronics of this recovery system. Have another beer. Up to the construction details.

Construction details
These are the construction steps I followed to build a prototype. I'm not a mechanical genius, so feel free to do things differently. I didn't have a Dremel tool either. The way I interface the electronics compartment to the rocket is with a bottle cap, since all my rockets have a bottle neck on top.

Before firing up the soldering iron, we need to prepare 2 relay coils first.
Please take care while handling the relays not to damage the coil wiring !

Construction of the optical sensor:

The 2 photodetectors are mounted on a triangular piece of prototyping PCB (printed circuit board).
The photodiodes are mounted in a piece of black plastic tubing so that they are only sensitive to light falling into the front opening of this tube. I simply cut 2 pieces - about 20 mm - of a black felt pen. One tube is soldered + glued on one side looking up and the other tube on the other side of the PCB looking down (both have a 45 degree offset). I also wrapped the photodiods in a strip of insulation tape, first of all to match the diameter of the black tubes and secondly to make sure that no stray light is falling onto the back of the photodiode. As the housing is completely transparent, any incoming light from the back of the diode could lead to false results.
The result should look something like this:

Putting all this junk together now:

I bought a set of small yet very powerful magnets that are normally used to post papers on a magnetic board.

The magnets are embedded in some sort of fancy plastic housing. You can leave them like that, or do what I did: wrap a magnet inside a piece of cloth, grab your favorite hammer and smash it. Throw away the plastic bits and pieces and try to separate the magnet from your hammer head. Remember: the more powerful your magnet is, the bigger the repulsive force when you run high current through the coils. To attach the magnets to the nose cone, I embedded the round magnets into a small LEGO block that I glued to the PET nose cone:

Again: feel free to apply more sophisticated mechanical skills here.

Alternative uses for voltage comparator 2.
The LM393 contains 2 identical comparators in the same package. So far, we only used one of them to compare the 2 voltages from the optical detectors. The second comparator is tied to ground or 12V.
Some useful applications for the second comparator could be:

The chute is attached to the bolt eye + ring in the middle of the PCB with some rubber bands. At the bottom side of the PCB, the same threaded bolt eye holds the bottle cap in place. Wrap the shroud lines + shock cord + rubber bands around the chute and put it on top of the PCB, under the nose cone.
Inside the nose cone, I glued some foam rubber, eg from an old mattress. It pushes down on the folded parachute and helps in pushing off the nose cone once the magnets lose their grip.


First tests