beautypg.com

Project b19 data logger – Elenco XP&trade User Manual

Page 51

background image

Project B19

Data Logger

A data logger stores data, usually for later download to a computer.
Build the circuit as shown. Turn on the slide switch (S1). Load
program Data Logger into the micro-controller (U21) using the
programming instructions in project B1.

The microcontroller measures the amount of light on the
photoresistor (RP), making a measurement every 6 seconds.
Every 15 minutes an average is taken and stored so it can be
accessed later. Data can be taken for 6 hours.

To access the data, reconnect the programming cable, press the
F8 key or select Terminal under the PICAXE menu to open a
terminal window for communication with the microcontroller, set
the baud rate to 2400 , and select Refresh to clear terminal screen.

Press the press switch (S2) and release it within 0.5 seconds to
“dump” the data to the terminal window. When memory is full,
approximately 6 hours of data, both lights will flash. The
microcontroller will retain the data even if the slide switch is turned
off; to reset the program and remove the data you must reload the
program into the microcontroller.

After reprogramming, you can set the circuit under a lamp,
measure the light over 6 hours, then reconnect the programming
cable to access it (open a terminal and press S2). The circuit may
be turned off and reconnected to the computer for data dumps
before the memory is full. You can find out how the room brightness
varies throughout the 6 hour period. Data is stored in 15 minute
intervals and is recorded as minutes.

Optional:

-50-

The data is stored in the same
memory area as the main program
with the write command, and retrieved
by using a subroutine and the read
command. When the press switch is
pressed an interrupt stops the main
program to execute the subroutine to
retrieve the data stored thus far and
send it to the terminal window. More
details on how these commands work
can be found under the Help menu at
Snap Circuits

®

XP

TM

.

This line sets the delay between stored
recordings to 15 minutes. Try changing
this number to 5. This will change the
delay between recordings to every 5
minutes and allow only 2 hours of data
to be gathered, every 5 minutes.