User manual

to the node point of the collector and the resistor. If the photo
transistor is now exposed to light, it will become conductive,
and the voltage drop between collector and emitter will reduce.
We are measuring a very low voltage. When the photo transistor
is darkened, barely any current will flow, the photo transistor
will lock and the collector-emitter voltage will increase. Now
we measure almost the entire 5 V.
Between the two extremes, the photo transistor will be very
dynamic and react even to the smallest light fluctuations. Since
the display would work precisely inverted this way - very bright
would be a low value and dark a very high one - we need to adjust
the measured value. For this, we subtract the measured value from
100 %, to get the desired result. We invert our analogue measured
value.
To keep the bar chart display from »twitching“ too much at
smallest light changes, the bar charge display function had an
average formation added. It smoothens out the analogue measured
values and calculates a sliding average, called AVG for Average,
from it .
For this, the current measured value is added to an array at each
run and, depending on how high the counter reading in this function
is at the moment, divided by it. This will continually return the
current average. The number of measuring series for average
formation is specified in the variable
numReadings-
. The higher the
number of the values to be averaged, the more precise, but also
the more idle the display. You can experiment with the values here.
Values between 8 and 64 have proven to be sensible. At the end of
the AVG-function, the input value (0 to 1,023) is then calculated
for a percentage for the bar chart function.
This kind of photometer can also be reprogrammed to automatically
activate and deactivate lighting or, as the next experiment
shows, be turned into an alarm system.
ALARM SYSTEM
The photometer can also be used as an alarm system that will react
to the smallest light changes. At the beginning of the alarm
system program, the current light intensity at the analogue input
A0 that is used as the reference point for the measurement will
be determined . If the voltage value in the continuous meas-
urement increases or reduces due to a light change (e.g. a person
walking past), and if this exceeds or undercuts the specified
threshold, the alarm will trigger.
Since brightness in a room will change over the course of the
day, a new reference value (current voltage of the photometer)
will be determined automatically every 10 seconds to be used as