sales person will also get you connected the right way.
Another good source for displays is AZ Displays at
www.azdisplays.com AZ Displays has displays with the
described onboard contrast voltage generators.
urates the phototransistor, creating a nice switching effect.
Interfacing the sensor to the MEGA163 is made easy
by using the controller’s built-in comparator input. The
ON/OFF state of the analog sensor does not yield a
perfect TTL output, which would be needed if it were
connected to a port pin. The sensor output floats slightly
above zero when turned ON and, inversely, is not a
perfect + 5 when turned OFF. The comparator will trigger
an event when its sensor input, AIN0, goes above the
AIN1 input that is set with a 20K pot. A voltmeter should
be used to adjust AIN1 to be about one volt above AIN0
while the beam is focused on the photosensor. This is a
handy feature for analog connections.
Since the transistor is designed for the infrared
region, ambient light has little effect on it, but, to reduce
ambient light triggering even further, the sensor is housed
in a wooden block with a hole drilled in it to support beam
entry. This method has proven to work very well and
could also be used for many other detection circuits.
Laser Module and Sensor
The laser beam generator used to detect the car passing by is a simple pointing device. Laser pointers are not
the best choice for this application because they are not
designed for continuous duty. I destroyed a few pointers
during the testing, but they are cheap and easily replaced.
A better solution would be to purchase a laser module
designed for rugged use. Commercial lasers can be a little pricey, but they are worth the money if you are serious
about performance. A visible red laser is the best choice for
this project and makes alignment easy. An infrared laser
would work, but it is difficult to align the invisible beam. The
phototransistor used to detect the laser has a bandwidth
between 620-980 nm. A typical red laser has a wavelength
of about 650 nm, just within the limit of the transistor.
DigiKey has suitable laser modules for this application.
As mentioned above, the laser detector is a simple
infrared phototransistor. The transistor is designed to turn
on when light in the 620-980 nm bandwidth strikes its surface. The laser is just within the detector’s wide range, but
this is not a problem because the powerful laser easily sat-
NUTS & VOLTS
The development software (BASCOM-AVR) used to
program the STK500 is an easy-to-use BASIC language
compiler from MSC-Electronics; it has loads of features
that make programming a breeze. You can find out
more information about the many products that
MCS-Electronics has to offer at www.mcselec.com
The program for this project is somewhat lengthy,
making it impossible to print the entire listing. A full
listing and explanation is not needed for a program
written in Basic because of its readability. Most enthusiasts are able to gain a good working knowledge of how a
particular Basic program works, even if they are not a
programmers. The English speaking mnemonics lends
itself to a short learning curve that can be easily mastered
with a little effort. The BASCOM-AVR manual and help
files are well written and easy to use. A complete listing
with all associated files can be downloaded from the Nuts
& Volts website ( www.nutsvolts.com). However, there
are some noteworthy features that helped make this project a relatively painless venture and deserve recognition.
One of the coolest features of BASCOM-AVR that I
was eager to exploit was the graphic LCD support. Just a
week before MCS-Electronics released its software
version that supported graphic LCDs, I struggled with my
own code to support these displays. After many lines of
code and even more cups of coffee, I had a library ready
to use. I was now ready for a graphic project, so I
decided to download the latest version of BASCOM for the
new project. As I read the revision update file, there it was:
“GRAPHIC-LCD SUPPORT” — AHHHHH!!! All of my hard
work was quickly reduced to nothing, but I am okay now
and I am happy to be using the new features.
Listing 1 shows the small amount of BASIC code that
is actually needed to get your display “talking.” The first