Friday, September 4, 2009

Timer circuit - the story so far

A few years ago I messed around a little with high-speed photography using a simple timer circuit to fire a flash a set time after a beam-detector spotted a drop of milk falling past it. It was quite fun, and I got some results that I quite liked, but there were a number of limitations with the approach, which led me to start a second project using a microcontroller for more accurate (and more repeatable) timings. I got as far as getting a prototype working, then the project stalled for a while due to an international move... When I tried to come back to it I couldn't remember how any of the wires fitted together - some had fallen out, and I had lost the source code.

A few days ago I started the project up again, this time taking a bit of care to build circuits that would stand (slightly) rougher handling and (hopefully) still be useable even after sitting in a drawer for a few months. I recreated the source, better this time.

The basic idea of the timer circuit is to have a number of inputs (well, one at the moment, but I will add more at some point), and a nummber of outputs (3 at the moment - 2 for the half and full press of a shutter and one to trigger a flash), and a simple editable program to control how they interact.

The "program" consists of up to 10 statements - each of which can be any of the following:
Beep
Goto
Millisecond delay
Output
Quit
Restart
Second delay
uSec delay
Wait (for input)

Most commands can have a parameter in the range 0-9999. Output takes a 4-bit bitmask indicating which outputs are to be turned on or off.

So for example a program to take pictures of milk drops might look like this:

1W
2O1100
3M0297
4O1110
5M0050
6O0000
7R

This will press the shutter as soon as a drop is detected using a photogate on the input, and fire the flash 297 milliseconds later just as it hits the surface of the saucer of milk below it. 50 milliseconds later all outputs are reset to 0 closing the shutter and resetting the flash, and the program restarts ready for the next drop.

No comments: