Introduction: Arduino Alarm Clock Relay
I have a lot of trouble waking up early in the morning especially if I stayed up late the last night. Essentially this project allows you to open a relay at the time you set using the keypad and lcd.This relay can control many appliance from turning your tv or radio on to opening the window shutters in the morning. Lets begin !
Step 1: Parts Needed
This project ended up costing about 70$
These are the things you will need
- 4x3 Matrix Keypad https://www.amazon.com/Membrane-connector-Compatib...
- 16x4 LCD http://www.buydisplay.com/default/character-16x4-...
- DS1307 Time Module https://www.amazon.com/SainSmart-DS1307-AT24C32-M...
- 5V Relay Module https://www.amazon.com/gp/product/B00VRUAHLE/ref=o...
- External power Supply 2 pack https://www.amazon.com/Cinolink-9V1A-Certified-Ad...
- Arduino Mega https://www.amazon.com/gp/product/B01H4ZLZLQ/ref=...
- Jumper wires (Male to female and Female to Female) https://www.amazon.com/Breadboard-Solderless-Proto...
- 10k Potentiometer https://www.amazon.com/Uxcell-a15011600ux0235-Line...
- Wire https://www.amazon.com/StrivedayTM-Flexible-Electr...
- Toggle switch https://www.amazon.com/12VDC-Illuminated-Toggle-Sw...
- Soldering iron
- Glue gun
Step 2: Wiring Everything Up
Its time to wire everything up using this fritzing diagram. When you make sure everything is working correctly then you can hot glue the jumper wires to make sure nothing moves
Step 3: Code
If you use the weekdays only code the alarm doesn't ring on Fridays and Saturdays as that's my weekend.(Can be changed at the if statement to match your schedule).You need to make sure you upload the RTC time setting code that I have attached and not the one from the library as I have added an extra line of code to it.
When you upload the code to the rtc you need to modify "tm.Wday = 0;" to whatever day of the week it is :
Sunday: 1 Wednesday:4 Saturday: 7
Monday: 2 Thursday: 5
Tuesday: 3 Friday: 6
Step 4: Making the Housing
I designed this part in sketchup which holds all the front components together and another to hold the relay boards and the Rtc which can be 3d printed.
If you don't have access to a 3d printer I've included the sketchup files so that you can print it in a one to one scale and cut it out on wood or onto a plate of aluminum using a dremel.
I made the box using 1 cm thick plyboard. The dimensions are 10 cm depth 13 cm Width and 16 cm Length. You could also 3d print the box but I didn't want to waste filament.
Step 5: Relays
If your wiring the relay to open shutters in the morning just open the switch housing and connect two wires between one in each terminal. You may need to use a RC snubber if your lcd starts going blank when the switch is pressed. This is due to Voltage spikes created from the motor.
If your turning on a different appliance you can use this tutorial to make a Power Outlet which can then be connected to the appliance.
Make Sure you turn the breaker off . Mains voltage can kill !!!
Step 6: Set the Time
Setting the time is very simple. First press the star key and enter the time you want it to go off then press the hash key to confirm. You can turn the alarm on and off using the hash key.