Light sensor with LED display
I used this module to control the LED lights in my first apartment.
Measures light intensity and shows the value on a LED display, if value passes over/under the set point the output is enabled. Uses the AVR ATmega8 microcontroller.
Details
This module measures light intensity and shows it on a scale from 0 to 782 on the LED display. By multiplying that value with 5, and then divide by 127 you get the light intensity in µW/cm2. If the light intensity rises over or falls below (configurable) the set point; the output activates, with a hysteresis of +-25. The module has two outputs; a constant and a pulse. The constant output can be used to drive e.g. a relay, while the pulse can communicate with other equipment. Powered by: 9-24V.
Set points
The set point is adjusted using the (on)-off-(on) switches, when adjusting; the display shows this instead of the real value. It is stored in ?EEPROM? making it non-volatile, meaning that it is not lost if the module is without power.
Video
LED-Display
In reality only one digit is shown at any given time, but by cycling through them in high speed the human eye sees three stable digits.
When DP x is lit:
- The set value is shown, not the real value.
- Output is active.
- Set point has not yet been saved to EEPROM.
I/O
Inputs
- PC.0 Light sensor, analog value
- PC.1 Set point up
- PC.2 Set point down
- PC.3 Active when over or under set point
Calculations
- Light intensity
Outputs
- PB.0 LED-display digit 1
- PB.1 LED-display digit 2
- PB.2 LED-display digit 3
- PB.3 Output constant
- PB.4 Output pulse
LED-Display
- PortD.0 LED-display A
- PortD.1 LED-display B
- PortD.2 LED-display C
- PortD.3 LED-display D
- PortD.4 LED-display E
- PortD.5 LED-display F
- PortD.6 LED-display G
- PortD.7 LED-display DP
D-Sub 9-pin
Pin | Function | Color |
---|---|---|
1 | 9-15V + | Yellow |
2 | GND | White |
3 | Output constant | Green |
4 | Output pulse | Brown |