[comp.sys.atari.8bit] Build a light sensor

fseipel@hpuxa.ircc.ohio-state.edu (Frank E. Seipel) (12/12/90)

How to make a Light Sensor
for the 8-bits

Kevin Jones

Atari Exchange of Louisville (AEL)

 This is the first of a series of articles that will teach the average user a
little more about his computer and the lesser known talents of the Atari
computers. If this article meets with any interest then there will be more
"How to" articles following this one. Each file will describe how to make a
new hardware project for the Atari computers. If you like this article,
have any questions, or just want to complain, you can reach me at The
Atari Scene! (502-456-4292).

 In this file I will describe how to make a Light Sensor. Before I get down
to the details, I will tell you how it works. The joystick port for the Atari
computer consists of 4 joystick input pins, 2 paddle input pins,1 negative
ground pin, and 1 +5 volt pin. Right now we are only concerned with the
paddle input and the +5 volt pin.  The paddle works by a potentiometer that
changes its resistance when the knob is turned. The ATARI measures this
resistance and converts it to a number between 0 and 255. The light
sensor will consist of a plug for the computer port, a potentiometer and a
photocell. The Current will flow through the potentiometer,which is used
to tune the potentiometer to a desired number,and into the photocell
which will further change the resistance. From the eye, the current will
go back into the paddle input pin on the computer. The photocell eye will
change its resistance when light shines on its surface. It works somewhat
like the pot but does not have a knob to turn.


 Now that you have a minimal understanding of what you are making, we
can begin to construct the sensor.

     Here is a description of the port configuration on the computer.

 *1 2 3 4 5*

  *6 7 8 9*


1 to 4	Joystick input pins
5	Paddle B input
6	Fire button
7	+5 volts
8	Ground -
9	Paddle A input

Parts:	(1) 9 pin Female connector 276-1538 2.49
	(1) CdS photocell 276-116 1.79
	(1) 100k potentiometer 271-1721 1.09
	Wire-about Six feet

Step One: Cut the wire into two (2) strands of two feet each. Solder one
end of the first wire to pin 9 and the end of the other wire to pin 7.

Step Two: Take the free end of the wire attached to pin 9 and solder it to
one lead of the photocell.  Next, solder a wire (new wire) to the other lead
of the photocell and solder the end of that wire to an outside pin of the
potentiometer (there will be three pins on the potentiometer).

Step Three: Take the wire from pin 7 and solder it to the inside pin of the
potentiometer.

Step Four: Basically the sensor is finished. You can either mount it in a box
or pc board, or you can tape the connections with electrical tape and let if
flop around. I would tape it and mount it in a box to be neat and safe.

Making it work

     All you have to do is plug the female plug into port one and run the
below program.  This program will print out the value (0-255) of the port.
All that has to be done to measure the light is to obstruct the photocell
and watch the readings. That is it!!

10 Rem Light Sensor Program
20 x=paddle(0)
30 print x
40 goto 20

That's about as simple as it gets.

Editor's Note: There are several potential uses for such a light sensor. Two
ideas for BBS sysops come to mind immediately; one is immediate carrier
loss detection (stick the photocell behind the CD light inside your modem).
A second idea is to poll the photocell when a user types chat; if there is
light in the room, the sysop is awake, so the BBS should ring the bell.
Otherwise the BBS should display a message that the sysop is out/asleep.