A common scenario turning OFF devices on time is always a big issue in this busy life. People forgot to turn the device OFF after a certain period of time. Like plugging your mobile, laptop, and other device chargers overnight and forgetting to turn them OFF. And again if we want any device to turn it ON at a particular time and remain for some time and after that, it should be turned OFF. Apart from this to protect from overheating machines you can use it in the industry for machines to schedule the ON-OFF time. These are some of the common issues which make this project so special. As this tutorial includes a youtube video link you can watch the video for reference.
So, taking these conditions into consideration in this project we will implement the switching of the device ON-OFF connected to our circuit according to the scheduled time set by the user. The whole project is built using Arduino UNO which is interfaced with the DS1307 RTC module to give real-time and a relay circuit is connected to turn ON-OFF the device. A 16x2 alphanumeric LCD is connected to view the current date and time and to set the time of ON-OFF by the user and 4 push to ON switch to it. So, the user can interact with this system and set the desired ON-OFF time for the device.
Working :
- Initially, the device is in the OFF state and the current time is shown on the LCD display.
- Now the user needs to set the ON time and OFF time, And as the time is set by the user, the device will turn ON and wait until it reaches the OFF time set by the user. As soon as it reaches the OFF time the device will turn OFF.
Hardware Requirement:
- Arduino UNO
- Arduino RTC module-DS1307
- 16x2 alphanumeric LCD
- Breadboard
- Push to on switches- 4nos
- 12v Relay
- Center tap 12-0-12 transformer
- 1N4007 diode- 4nos
- 1000uF, 30v or above
- Voltage regulator-7812
- BC547 transistor
- 1K ohm resisters - 7nos 1K ohm resisters -7
- Push to ON switch - 4 nos
- LED - 5mm RED - 2nos
- Wire that carry 2A, 230v AC
- Two-pin plug for AC input
Software Requirements:
- Arduino IDE (You can download it from HERE).
- Arduino RTC Library (Download it from HERE).
- LCD Library(inbuilt within the IDE)
Block diagram:
As you can see the block diagram is easy to understand. The switches at the bottom will get the inputs from the user and send them to the Arduino, Arduino checks the key values and accordingly starts setting the values while displaying the time on the LCD.
Circuit diagram:
The full setup is done on a breadboard since it is easy. The circuit diagram is divided into a number of parts. Please follow the below parts.
Power Supply: The electrical device is running on AC voltage while the Arduino circuit requires operating voltage 5v DC and the relay circuit requires 12v of supply. We will use a 7812 voltage regulator to convert the external power supply to 12v DC for the relay circuit and Arduino will be powered with the USB cable from the laptop or PC.
DS1307 RTC Module: Follow the given connection table to complete the circuit. You can follow our previous tutorial on interfacing with the DS1307 RTC module HERE.
DS1307 RTC | Arduino UNO |
SDA | A4 (SDA) |
SCL | A5 (SCL) |
LCD Connection: Please follow the below table for the connection of LCD and Arduino UNO.
16x2 LCD | Arduino UNO |
RS | 13 |
RW | GRND |
E | 12 |
D7,D6,D5,D4 | 8,9,10,11 respectively |
Switches Connection: Here we are using four 1K resistors to provide a default state to the PINs A0, A1, A2, and A3 and that is HIGH. This means we have connected the PINS to VCC through a 1K resistor. By doing this we set the PINS state to HIGH as a default value. And when the switch is pressed a LOW value will be detected at the PIN and hence we get to know the switch is being pressed. Follow the below table and connect the switches accordingly.
SWITCH | Arduino UNO |
SW1 | D6 |
SW2 | D5 |
SW3 | D4 |
SW4 | D3 |
Relay Circuit: the electrical appliance is connected to the 12v relay. This relay circuit is built with a BC547 NPN transistor. A 1K resistor is connected at the base of the BC547 transistor, the emitter of the transistor is grounded and the collector is connected to one of the terminals of the relay. So, when a proper voltage is fed at the base of the transistor through the 1K resistor, the transistor triggers and provides ground to the terminal of the relay where it is connected. So when the circuit completes the relay is powered with the proper voltage, and the relay terminal COM which is initially connected at NC shifted to NO which shifted the NEUTRAL of the AC line and completes the circuit for AC appliances.
Download the complete source code: click here
Video Tutorial:
0 Comments
Please do not enter any spam link in the comment box.