Digital clock with Arduino

Assignment 1:

Make the controls for a desk or bedside clock.  At minimum this should include controls to set the hour and minute. Automated time setting is not permitted for this assignment. Your controls should be clear enough that the user can figure out how to set the time without a manual. Here are a few methods for setting the time on a clock.

You should add at least one extra feature to your clock. Consider the following:

Whatever features your clock has, you should provide tangible controls to set and control those features.

Your clock’s display should be as simple as possible. The simplest version might be a serial output to a computer. You could also control a p5.js clock animation. You could also write to an LCD display or LED display. Since this is a one-week assignment, avoid mechanical clocks and focus on the input controls.

I decided to make a simple clock using an LCD display as I hadn’t used it before. The clock has a simple interface with just two buttons for changing the hours and minutes.

Testing the LCD contrast with a 10K POT
Power out
Front view

Since I only had two buttons as my interface, I chose to put the buttons on the back of the enclosure. Additionally I used big buttons for better ergonomics so that they are easy to locate in a dark room or without having to look. The enclosure is small enough to fit in the palm of your hand and the form factor feels more like a game controller when using the buttons. The position of the buttons corresponds to the clock display, i.e. with the display facing you, the button on the left sets the hours and the button on the right sets the minutes.

Back view
Internal wiring
Image result for lcd wiring arduino
I used this diagram for wiring the LCD screen.
I replaced the POT with a ~10K resistor to set the brightness of the LCD.

I used Tom’s push button time set code as my starting point. In Tom’s code the time was set each time one pressed the button. I modified that code to change time as the button was held pressed. This proved useful when cycling through the minutes instead of pressing the button 60 times to change through the minutes.

I added this simple condition to the button press event so that button needs to be pressed in order to set the time.


Advertisements