Workshop 9: U-Make Light Probe
-
LCHS Physical Science
LCHS Main SiteSD271 Main siteUof I New Century Classroom  
Objectives: The learner will...
...select and apply technology tools for research, information analysis, problem-solving, and decision-making in content learning. (NETS 4, 5)
...build a light probe and write a program that interfaces with the probe
 


In this workshop you will write a program that interfaces with a homemade light probe constructed out of some phone wire and a RadioShack CdS photocell (costing less than a dollar!).


The Light Probe

Using a 10-15 cm small plastic tube for the barrel, fill one end with about 2 cm of hot glue and set vertical on a piece of tape (sticky side up) until dry. Peel off tape leaving a flat closed end. The light sensor is extremely sensitive so this plug reduces the light so that it doesn't oversaturate as much in really bright light. Strip back the red and green phone wires and twist one to each wire lead of the CdS photocell. Solder each of these connections (if you have a soldering iron) and then wrap each wire separately with tape to insulate. Slip the cell to the end of the tube and add a little glue on the opposite end to seal. The other end of the wire should have a phone plug.
In near absolute darkness photoresistors can go non-linear and give false results as well. But for most uses this Game Port Light Probe will more than suffice.

The Program
Type the following program into the QBasic Editor. Omit anything after an apostrophe ( ' ) as they are just comments.
----------------------------------------------------------------------------------------------
SCREEN 9 : CLS

STYLEA: 'DIGITAL DISPLAY STYLE
Y=STICK(0)
'SPECIAL COMMAND THAT CHECKS THE GAME PORT
LOCATE 12,10 : PRINT Y;" "
GOSUB KEYCHECK
IF A$="Q" THEN
CLS : GOTO STYLEB
END IF
GOTO STYLEA

STYLEB: 'GRAPHICAL BAR STYLE
X=STICK(0)
LINE (0,100) - (X,110) , 7 , BF
'DRAWS BAR
LINE (X+1,100) - (260,110) , 0 , BF
'CLEARS ANYTHING PAST THE BAR
GOSUB KEYCHECK : IF A$="Q" THEN GOTO STYLEC
GOTO STYLEB

STYLEC: 'GRAPHICAL X-Y PLOT
CLS : X=1 : LINE(0,175) - (639,175)
HERE:
Y=STICK(0)+50 : PSET(X,Y) : X=X+1
IF X=640 THEN GOTO STYLEC
GOSUB KEYCHECK
IF A$="Q" THEN END
GOTO HERE

KEYCHECK: 'WHEN YOU PRESS Q IT GOES TO THE NEXT STYLE
A$=INKEY$ : A$=UCASE$(A$)
RETURN

REM YOUR FULL NAME HERE

END
-----------------------------------------------------------------------------------------

Now, plug a light probe into the provided game port adaptor and RUN (Shift-F5) your program. Point the light probe at light and dark areas and see the result. Advance to the next display mode by pressing 'Q'. Show the instructor that each display mode works to receive your grade!