revolutions per second can be much higher. Also, if
you select a coarser resolution the revolutions can be
proportionally faster. Another option is to use the BS2SX
module, which is considerably faster than the standard BS2
(instructions per second, as well as serial communication
rate) and runs the exact same programs.
Testing The HM Alone (without a controller)
Here is where the convenience of using the BS2
outweighs its shortcomings. To test the final design, you do
not need to use a µC to control the device and view the
count. Just replace the line: SEROUT SendPin,84,
[HdAngle,LdAngle] with the line: DEBUG Dec
dAngle,CR. This will display the
states transition count on the
debug window of the BS2
development IDE whenever the
Send pin goes low, instead of
sending it on the SerOut pin
(remember that negative numbers are in 2's complement format). To manually control the
device and to view the status of
the Error pin, wire the P0, P1,
and P4 pins of the BS2 as shown
in Figure 6.
To create a quadrature
wheel, you can print the graphic
in the simulation program and
glue it on a piece of cardboard
and cut out the white areas
and around the wheel rim; IR
transmitter/receiver pairs can
be purchased from many
PHOTO 1
electronics stores.
twice to get acceleration, but why not have the HM
do this? If the circuitry is fast, there would be no time
constraints in doing the necessary calculations and sending
the information to the user µC. We used infrared sensors,
but Hall-Effect transducers could be used instead, in exactly
the same manner. Also, we illustrated the principles of
quadrature encoding using a wheel (rotational movement),
but the principle applies equally for linear movement.
The important thing is that helper modules — whether
you buy them or build your own — provide distributed
processing capacity that enables reduced programming
complexities, faster completion times, and projects that
might otherwise be impossible with just one controller
or processor. SV
A Shop Trick
By Jim Miller
The other day, I was digging through a box of “good stuff to keep but don’t
know why.” I ran across a USB fan on a flexible goose neck. It had been given to
me as a Christmas present years ago. I used it for a while but its utility and novelty
wore thin and it eventually exited my computer bag as clutter. Anyway, I pulled it
out of the box to toss it and set it on my electronics bench. I have a powered USB
hub there so I plugged it in just one more time. The fan actually worked great, so I
left it there spinning away. It has soft blades so if you stick your hand in it there is
no injury. Later that same day, it cleared the solder smoke out of my face. Last
night, I had a voltage regulator out of its case and it was getting a bit warm so I
just swung the fan around and it fixed the problem. I’m sure it will come in handy
for other things too, but I was excited that I saved it from the land fill and think it’s
found a new life on the workbench.
It’s kind of challenging to pick it out in the photos from all of the test leads,
but in Photo 1 you can see it plugged into the hub. Photo 2 is just a bit closer to
the action in the cooling mode.
Final Thoughts
The quadrature encoder
helper module we have designed
is easy to use and is a nice
addition to the family of helper
modules available on the market
today. Our HM performs only one
quadrature encoding (one pair of
sensor inputs) and the count is
only two bytes long ( 16 bits). A
commercial module may have
multiple encoders and keep a 32
bit (or 64 bit) count for each.
Another possible addition that
can be of great utility is to calculate the speed and acceleration
along with the count. A µC using
our HM can differentiate (digitally)
the count once to get speed and
PHOTO 2
SERVO 02.2009
63