In Practice
■ FIGURE 3. The transceiver board. The transceiver circuitry
is in the middle, mounted above the Arduino. Wiring —
rather than pins and headers — was used to maintain
greatest flexibility possible. On the left is the laser, mounted
in a showerhead and secured to the transceiver board
with wire. On the right is the photodetector, mounted with
electrical tape. See text for other mounting options.
practical and theoretical information from this very friendly,
extended family. Finally, from a practical level, the Arduino
uses a USB virtual serial port with an FT-232RL chip to
provide the serial translation. A full featured USB port on
a computer guarantees five volts, 500 mA to an attached
device for the device’s own use. This project uses much,
much less power than that so no other power source
is required.
Some may be concerned that the original Arduino
boards only have one hardware serial port. This project
requires two serial ports and an older soft serial library
didn’t work well. While this is true, a newer software
based serial port (NewSoftSerial) is very robust. Code is
provided online at www.nutsvolts.com for the original
Arduino (one hardware, one software port) and the
Arduino Mega (two hardware ports).
If you are not familiar with the Arduino, check out
Smiley’s Workshop that runs in NV each month. It will
introduce you to this system. To use the communicator
without further modification, build the board, install the
Arduino software, let Windows install the virtual serial port,
and choose the target board. Hook up the target board.
Copy or enter the code, press compile, and then press
download to board. Software setup is less than 30 minutes.
The system requires two adjustments in order to
function. The first — and by far the most difficult — is
aiming the laser to hit the phototransistor square on. I do
not have a foolproof method for doing this. I mounted
my communication units on some scrap lumber (Figure
3), then I mounted the laser unit within a ball joint type
plastic shower head for even more control (Figure 4).
Consideration could be given to mounting the unit on a
camera tripod for even greater aiming control.
The other adjustment is setting an offset for the
comparator. Depending upon ambient light, the baseline
current of the phototransistor may vary considerably, and
depending upon the distance from the laser to the detector,
excitation may vary considerably. The negative input of
the comparator is attached to a potentiometer which
permits setting the comparison voltage, which enables
extraction of the data. This is a simple adjustment.
Building It
■ FIGURE 4. Close-up of laser mounted in showerhead.
The showerhead articulates in a ball and socket fashion.
This particular model of showerhead had a gasket which
permitted a press fit of the laser unit without further
modification. Other heads may require glue or creation
of a sleeve around the laser to allow a press fit. Wires
follow the water path.
The electronics are easy. I recommend point-to-point
wiring on a piece of perf board. The component count is
so small that the work involved does not justify a printed
circuit. If you wish to be particularly careful (which I heartily
recommend), attach a five volt source to Vcc and Vgnd
and sniff for smoke before hooking up the Arduino. Apply
a five volt signal to the base of Q1 and make sure the
laser is working. If you have a multimeter, set the negative
input of the comparator at approximately 1-1.5 volts. Even
with the laser on, total current draw should be well under
■ FIGURE 5. Close-up of photodetector consisting of hacked
CNY65 optocoupler. With chip text correctly oriented for
reading, as you face the chip the left side of center houses
the emitter and the right side contains the detector. Using a
tiny burr or milling tip, carefully start on the
left of center of the chip and remove the black
plastic until a white matrix is identified. On the
left side of the matrix, continue to remove
material until a small translucent cube is
identified. This is the emitter. The detector
looks almost exactly the same. Now that you
know what to look for, carefully remove as
much white matrix from around the detector
as possible without destroying the detector
plastic. This is actually quite easy, and the
end result should be similar to the photo
here. Only the two right side pins need to be
connected. The upper right pin is high. Other
optocoupler chips likely have a similar
mechanical construction, but I cannot confirm
that (follow schematic for appropriate hookup).
36
November 2009