varying the power delivered to the water pump (and
thus its flow), as well as the frequency of UV LED flashes.
Two output pins of the 08M are buffered by Darlington
transistors, Q1-Q2, to increase the current drive to their
loads. This is a “common emitter” configuration, where
the load is simply switched straight to ground. Resistors
R6-R7 limit the base current into the Darlingtons. And as
always, there are a few additional components:
• The optional programming interface is built from R1-R3,
D1, and J1. I took this directly from Ron Hackett’s website
at www.jrhackett.net/cable.htm. If you plan to purchase a
preprogrammed 08M to build this project, then you can
ignore these parts completely.
• U2 makes certain there is a stable 5V supply to the
08M, as well as a divisible reference for the input pots.
• D2-D3 are each of the eight UVLED emitter arrays that
rely on R8-R9 for current limiting. The LEDs I chose had a
forward voltage drop of 3.7V and a maximum current of
20 mA. With eight LEDs in parallel on each side, the value
of 33 ohms was indicated (you can play with what-if
■ FIGURE 4. The
prototype circuit with
connector at bottom.
scenarios for your own setup online
• I added C1-C2 as electron buffers
to help the wall wart deal with current pulses to the pump
motor and LED arrays. They really helped stabilize the system.
I built this circuit in about four hours on a small
square of protoboard from RadioShack (Figure 4). You can
see the voltage regulator on the power transistors at the
top, the two input pots on the left, and the PICAXE in the
middle. Connections to the LED arrays and pump motor
are via the green screw terminal.
The Software Engine
Refer to Figure 5 which contains a cleaned up listing
of the code that runs the Freeze Fountain. The complete
source code is available on the Nuts & Volts website
( www.nutsvolts.com) if you would like to modify it and
reprogram the 08M (note that you will need to build the
optional programming interface to do so). It is so short
and simple, you could probably type it in faster than
As I wrote above, I architected this project to teach
some basic design skills in both electronics, as well as
software. Let’s look at how the program is structured and
what it does.
Every conventional programming language is
processed from top to bottom, and except for certain
rules, from left to right on each line. PICAXE Basic is no
different. The structure of our program is very simple: Set
things up and then execute a loop that repeats forever —
read the inputs, do some math, and drive the outputs.
The first five lines of code set things up. Line 1 tells
the PICAXE Programming Editor what model chip it is
working with and lines 3-5 define some variable storage
space. We could just refer to the raw RAM-based bytes
(b0, b1) and word (w1) in the code, but that makes it
somewhat less readable. There is no penalty for giving
1 #picaxe 08M
3 symbol StrobeIn = b0
4 symbol MotorIn = b1
5 symbol work = w1
9 ' Read the motor speed and strobe rate pots
10 readadc 4, MotorIn ' 8 bit resolution is enough
11 readadc 1, StrobeIn ' Again, 8 but resolution is enough
13 ' Fire the UVLEDs
14 high 0 ' Turn on the TIP120
15 pause 1
16 low 0 ' Now turn it off
18 ' Adjust the power to the pump motor
19 work = MotorIn / 2 + 100
20 pwmout 2, 62, work ' A rate between 40% and 91% at 16 kHz
21 ' according to the pwmout Wizard (cool!)
22 ' Calculate the delay time between UVLED strobes
23 work = StrobeIn / 2 ' Intermediate variable is 0..127
24 work = 140 - work ' So, dark time delay is 13..140 ms
25 pause work ' or 76..7 Hz
27 goto main
■ FIGURE 5. Code listing
for the Freeze Fountain.
54 May 2008
■ FIGURE 6. Securing the coat hanger wire to
the catch basin.