Kontakt     |     Mein Konto     |     Ausloggen

This reactive light measures the brightness by using a photoconductive cell. During daylight the device is in idle mode to reduce the power consumption. It returns to working mode at dusk. Every eight seconds the LED blinks one time.

Circuit Boards and Kits

Circuit board: 0.50 EUR

Kit with controller for self programming and a circuit board: 3.50 EUR

Kit with a completely programmed microcontroller and a circuit board: 4.50 EUR

Download

Functional Description

This device is a nocturnal blinker. It is easy to build and usable without parametrization.
The measurement of the brightness is done by a photoconductive cell (LDR). If the value drops below a defined threshold, each eight seconds the LED will blink once.
Because of the extremely low power consumption one set of batteries will last for years.

Circuit Diagram

EME_Schaltplan

Schaltplan.

In the center is the microcontroller, left of it the power supply. The device needs 3 V. This can be realized by two standard batteries in series. The positive pole has to be connected to the pin +, the negative one to -. Right of the IC is one the one hand the measurement of the brightness consisting of R1 and the photoconductive cell LDR, on the other hand the LED for showing the blinking sequence with its resistor R2.

EME_Platine_Bottom

Circuit board soldering side.

EME_Platine_Top

Circuit board component side.

The right figure shows the component side, the left one the soldering side of the circuit board. When assembling the components one has to care for the polarity of the LED (the flat side respectively the short pin has to point to the IC) and the IC (the denting has to point to the capacitor).

Programming

  1 	$regfile = "ATtiny13.DAT"
2 $crystal = 16000
3 $hwstack = 2
4
5 Config Adc = Single, Prescaler = Auto
6 Config Portb = &B00001000
7 Portb = 0
8 Stop Ac
9
10 Wdtcr = &B11010011
11 Enable Interrupts
12
13 Const Tagschwelle = 800
14 Dim Ldr As Integer
15
16 Do
17 Gosub Pause
18 Start Adc
19 Ldr = Getadc(2)
20 Stop Adc
21 If Ldr <= Tagschwelle Then
22 Gosub Blinken
23 End If
24 Loop
25
26 Blinken:
27 Portb.3 = 1
28 Reset Watchdog
29 Powerdown
30 Portb.3 = 0
31 Return
32
33 Pause:
34 Wdtcr = &B11110001
35 Reset Watchdog
36 Powerdown
37 Wdtcr = &B11010011
38 Return
39
40 End

In line 1 to 3 general settings are done. First the type of the processor is told to the compiler. Afterwards the frequency of the intern oscillator is set. At last the stack is set to 2 so that there is enough space for the variables of the program. The consequence is that the nesting depth of function calls can be maximum two, which is enough for this program.
Then the microcontroller is configured by the registers. First the analog digital converter that is used to measure the brightness is configured. Afterwards pin 3 is configured as output and set to low. They are used for controlling the LED. The other ports are inputs. In line 8 the analog comparator is switched off to reduce the power consumption. It is not used in this program. Line 9 and 10 configure the watchdog timer that is used for realizing the delays to 0.125 s and interrupt mode.
Now the contants and variables of the program are defined. If the brightness is belowTagschwelle, the LED will blink. The current brightness is stored in Ldr.
The lines 16 to 24 contain the main program. At the begin the controller is set to sleeping mode for eight seconds. Afterwards the analog digital converter is started the brightness measured and the converter switched off again (lines 18 to 20). If the brightness is below the threshold Tagschwelle, the routine Blinken ist called.
The routine Blinken is in lines 26 to 31. The port 3 that is connected to the LED is switched on. The program waits for 0.125 s using the watchdog timer. Then the output is switched off again.
The lines 33 to 38 contain the routine Pause. It pauses the program for eight seconds. At the beginning the watchdog timer is configured to the maximum value. Afterwards the controller is set to sleeping mode. After the time elapsed the watchdog timer is configured to its initial value.

Leave your comment