4.2.1 Improvements
Two problems appeared:
1. continuously low signal on sensor caused by external sunlight
2. spurious interrupts
The first problem could be easily solved by lowering the roller blinds in the
room. An alternative solution is to add a small roof on the optical sensor so
that only light from the diode will reach the sensor, but not light from any other
external source.
The source of the second problem was not entirely clear. Several causes could
cause the problem:
1. just enough external sunlight could trigger a low signal, but there is not
enough sunlight to keep it continuously low
2. the power to the sensor is not stable enough, so when having a dip in the
power we get a low trigger in the sensor
3. according to the specifications the sensor needs a 5 Volt power source.
But Because the same voltage is given as high output signal I tested it if
it worked also right with 3.3 Volt because a GPIO input signal may be
maximal 3.3 Volt. After testing I conclude it worked fine. However maybe
it is not fine, causing the spurious interrupts.
Reason 1 seems to be also solved by lowering the rolling blinds, or adding a roof
on the optical sensor.
Reason 2 seems unlikely because the Raspberry Pi has a power regulator chip,
however if you don’t have an adequate power supply it can happen. The Rasp-
berry Pi will both let the red power LED blink and show a lightning bolt in the
top right corner of the screen if the power drops below 4.65V. But we bought
the official Raspberry Pi power supplies and these should be fine. But to be
sure a solution could be to put a capacitor at the power line to the sensor to
prevent any major power drops to the sensor.
Reason 3 seems to most likely cause, because we went outside the specifications.
So instead of using the 3.3V Vcc from the Raspberry Pi, we can use the 5V Vcc
from the Raspberry Pi to power the sensor. But we then need to reduce the
output Voltage of the photologic sensor with an extra resistor. If we look at
figure
we see the photologic sensor’s output pin is connect with a 10k Ohm resistor to
the Vcc (pull up). Thus if we put an 15k Ohm resistor between the photologic
sensor’s output pin and the GND we effectively create a Voltage divider on the
output when the output signal is high(Vcc):
Vcc = 5.0V
18