This Arduino creation allows you to set alarms for yourselves and also keeps accurate time.
- Arduino(I used an Uno)
- Solderless Breadboard(Half or Full-sized)
- Three colorful pushbuttons
- 16x2 LCD screen
- Active Buzzer
- Hot glue
- Cardboard Box
- Paper to cover the box
- Arduino IDE.
- Soldering Iron for LCD Screen header pins
- Power Adapter for the Arduino(STRONGLY recommended, you will see why later)
- Batteries(NOT recommended)
- 220 ohm resistor
- 2k ohm resistor
I got most of these from eBay and it cost me around $10(I got a clone arduino uno). Depending on the box, you might decide to choose a half or a full sized breadboard. I used a full-sized, but in this tutorial I will demonstrate with a half sized.
Step 1: Wiring LCD Screen
You are welcome to change the wiring and then adjust the code if you want to. Solder the header pins on your LCD screen if you haven't already. Place it on the breadboard. Connect the arduino's ground and 5v to the + and - rails on the breadboard. Connect the left-most pin(VSS) of the lcd to ground. Connect the next one(VDD) to power. The next pin(V0) is used for contrast. You can connect it to a potentiometer, but I just connected it to ground with 2 1k ohm resistors for good contrast. You might have to experiment with different values to see what looks good after you have uploaded the code. The next pin to the right of V0, RS, connects to pin 12 on the arduino. RW connects to the ground. E connects to pin 11. All these pins were in order left to right. They might have different names on your LCD. Skip the next 4 pins(D0-D3) and connect D4 to pin 5. D5 to pin 4. D6 to pin3. D7 to pin 2. Connect the next pin on the LCD(A) to pin 7 with your 220 ohm resistor. Connect the last pin of the LCD(K) to ground. Check with my image to make sure everything is correct.
Step 2: Buttons and Buzzer
Take three buttons and connect one side of them to ground. Then connect the other side of one button to arduino pin 6. Another one to pin 9. And the last one to pin 10. You might be wondering why I do not use a pulldown resistor. We are going to use Arduino's built in pullup resistors for this project. I recommend gluing the buttons to the breadboard, because the tend to be shaky because of their short legs. Now place your buzzer on the breadboard. Be aware of polarity. Connect the positive side to pin 8 of the arduino and connect the - side to ground. Since I am using a small breadboard, I put the buzzer below the jumper cables for the LCD.
You are done with the wiring!
Step 3: Upload the Code
Upload the code to your arduino and see if it works.
Scroll down to the function countTime(). It has a big number there occuring twice. All Arduinos cannot count time perfectly. Each one is different and will be off. Set a timer on your phone for an hour and start the arduino clock. At the end, check by how many seconds(or minutes) the clock was off. Take the amount of seconds off and divide by the total number of seconds in an hour(3600). Multiply the result to the big number in the code. If the arduino was faster than it should be, add the final number to the number in the arduino in both places. If the arduino clock was slower, subtract.
Arduino is 25 seconds behind after an hours. 60006514 - (25/3600 * 60006514) = the number you have to put into the code.
Here is how to use your arduino clock.
One button will scroll through the modes if the press is short. There are 3 modes: set time, set alarm, and just the time. If this button is long-pressed, then the backlight led will turn on for a minute and then turn off to save power.
The second button will set and unset the alarm. Short press for set, and long press for unset.
The last button sets the time and alarm(the actual digits). Short press to increment current digit by one. Long press to move on to the next digit.
Step 4: Make the Box
Get out your cardboard and make the box you want. Cut out holes for the buttons, LCD, and maybe the buzzer. Power the arduino through an adapter. The reason is because the time resets if it is disconnected from power. That is why batteries are not good for this. You can try using an RTC like DS1307 that keeps time even if the arduino is off. I did it without one.
Good luck with your projects! Check out my YouTube Channel - Tech Tribe - for more tutorials!