Flowcode for Garden Lighting Schematic Circuit Diagram
Flowcode is well known from the many ‘Eblocks’ projects that have been published by Elektor over the last few years. This year’s Summer Circuits also has a project that is programmed using Flowcode. The circuit presented here uses a microcontroller programmed with Flowcode to turn garden lights on and off at user-definable times. At the hart of the circuit is a PIC16F88 microcontroller. It uses a 2 line by 16 character display to show the settings. These can be adjusted using a set of three push buttons. Potentiometer P1 is used to adjust the contrast of the display. Output RA3 of the PIC is used to drive transistor T1, which in turn drives a relay that turns the lights on and off. The supply voltage is stabilised using a standard 7805 voltage regulator IC. S1 is the reset switch, which is connected to the MCLR input of the PIC. MCLR should be ‘high’ during normal operation (and ‘low’ for a reset). Hence this input has been connected to the positive supply voltage via pull-up resistor R1. A program has been written in Flowcode that activates the relay when the following conditions apply: – when it is later than 16:00; – when the amount of light reaching the LDR is less than an adjustable threshold; – during the morning between seven and eight o’clock; – at night the relay is turned off at 23:00 (except on Friday, Saturday or Sunday, when the lights stay on one hour longer).
During the day the display shows at what time the garden lights were last turned on. The following procedure should be used to set the time: press the Reset switch; the program then shows a welcome message. Next, press the Enter switch. Use the Up and Down switches to set the correct value for the hours. Press the Enter switch to set the minutes (in the same way as for the hours). After pressing Enter again, you are asked for a value for the light threshold. This value is compared with the amount of light falling on the LDR. When the value of the LDR becomes less than the threshold the lights come on. Another press of the Enter switch takes you to the day-of-week setting. This determines the days when the light stays on for longer at night. A final press of the Enter switch then starts the clock. It is of course possible to modify the software in certain places. You could for example change the time at which the lights come on in the morning. This function could even be removed completely if you have no need for it.