Introduction to Flowcode in Eblocks Projects
Flowcode has gained recognition through numerous ‘Eblocks’ projects featured in Elektor publications over recent years. Even in this year’s Summer Circuits, there’s a project programmed using Flowcode. The circuit detailed here employs a microcontroller programmed with Flowcode to regulate garden lights, allowing users to set specific on and off times. The central component of the circuit is a PIC16F88 microcontroller, which interfaces with a 2×16 character display presenting the settings. Users can adjust these settings conveniently using a trio of push buttons.
Circuit Components and Operation
Potentiometer P1 serves to fine-tune the display’s contrast. Output RA3 from the PIC controls transistor T1, which, in turn, drives a relay managing the lights’ on-off cycles. To maintain stable voltage, the circuit incorporates a standard 7805 voltage regulator IC. The reset switch, S1, linked to the MCLR input of the PIC, ensures smooth operation. During regular operation, MCLR is ‘high’ (and ‘low’ during a reset), and it’s maintained high through pull-up resistor R1.
Flowcode Program Logic
The Flowcode program activates the relay under specific conditions: when it’s past 16:00, when the light intensity detected by the LDR falls below a user-defined threshold, during the morning between seven and eight o’clock, and at night, the relay is turned off at 23:00 (except on Friday, Saturday, or Sunday, when the lights remain on for an additional hour). The program logic ensures precise control over the garden lights based on these conditions.
Configuring Garden Lights Operation
During the day, the display showcases the last time the garden lights were activated. To adjust the settings, follow this procedure: initiate by pressing the Reset switch; the program will display a welcome message. Subsequently, press the Enter switch. Utilize the Up and Down switches to set the accurate hour value. Confirm the hours by pressing Enter and set the minutes similarly. Upon pressing Enter again, input the light threshold value, which is compared against the LDR’s light intensity.
Light Activation Logic
When the LDR’s value drops below the set threshold, the lights switch on. Pressing the Enter switch once more directs you to the day-of-week configuration, determining the days when the lights stay on longer during the night. A final press of the Enter switch commences the clock. Notably, the software can be modified in specific areas. For instance, you can adjust the morning activation time of the lights. Alternatively, this function can be entirely eliminated if it’s not required.