|
A Pedal Cadence Counter
by Matt Meerian
Start ý The
Hardware ý Microcontroller Software
ý Desktop Software ý Placement
ý Happy Trails ý Sources
and PDF
THE HARDWARE
The hardware is centered on the Atmel
90S2313 microcontroller, making the schematic almost a one-chip circuit
(see Figure 1). For those of
you who are not familiar with the microcontroller, it has a UART,
an 8-bit timer/counter, a 16-bit timer/counter, 128 bytes of EEPROM,
32 general-purpose registers, 2 KB of flash memory, and several more
internal features.
Plug JP1 is an in-circuit programming
header. In-circuit programming makes updating software to the flash
memory easy. JP1 mates with a programming dongle that comes with the
STK200 development board. The desktop software that accompanies the
dongle is available on Atmelýs web site.
The peripherals around the ý2313 consist
of a Hall effect sensor, a LED, a MAX233 level converter, a power
switch, a mode switch, and of course, a crystal for the microcontroller.
A magnet on the shank of the pedal triggers the Hall effect sensor
when the pedals revolve around once.
An output pin on the ý2313 can deliver
20 mA of current, which is enough to drive the LED. The LED blinks
approximately once every second to allow you to see that the microcontroller
is in Data-Gathering mode.
The MAX233 level converter chip converts
the 0- to 5-V level of the microcontroller to the 10 and ý10-V levels
for RS-232 serial communication. The DS1233, available from Dallas
Semiconductor, holds the processor in reset if the power supply drops
below 4.5 V. And, the power supply is a basic 7805 linear regulator.
A fuse or polyfuse is a good idea when using power from a battery.
The power switch turns on the microcontroller.
The mode switch allows the microcontroller to either gather data (take
a survey) or upload to a desktop computer. Note that the mode can
be changed only during powerup of the microcontroller. If the controller
resets while gathering data, the contents of the EEPROM will not be
erased.
The Hall effect sensor has an open collector
output. The pull-up resister in the microcontroller is enabled. I
wanted a little stronger pull-up than the internal resister, so I
used a 39-kilohm resister in parallel with the internal pull-up.
The crystal frequency is 1.8432 MHz.
The reason for this unusual value is that it is easily divisible to
allow timer interrupts at one minute.
You donýt need a fast clock because not
much is going on for the microcontroller.
PREVIOUS
ý NEXT
Circuit Cellar provides up-to-date information for engineers. Visit
www.circuitcellar.com for
more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe online.
ýCircuit Cellar, the Magazine for Computer Applications. Posted with
permission. |