This is part of the Arduino-based Digital Clock series. This post is the fourth post in the series. For the previous post in this series, go to Part 3.
I have finally done the planned feature from Part 2: buttons for setting up time directly in device. Now I can adjust time without recompiling and reuploading the Arduino program. Other than that, I have added several unplanned features. Here are the things I added so far:
- Buttons: Mainly to navigate the menu system, also to turn off the alarm once it has been triggered. For the hardware I just use cheap big tactile buttons that have a cap. For the software side I use the AnalogButtons library version 1.1.1 by Roberto Lo Giacco.
- Menu system. It can be used to change the date/time, to enable/disable the alarm, set alarm trigger time, and to set the alarm duration. I use the LcdMenu library version 2.1.0 by Forntoh Thomas.
- Alarm functionality. Now the clock can be used as a waker. For the buzzer I use something like this one from Adafruit. For the software side I use the toneAC library version 1.5.0 by Tim Eckel. I use this instead of Arduino’s built-in tone function because toneAC can give louder sound and have volume setting. It’s not that loud, though, but good enough that it can wake me up in the morning.
- The alarm can be enabled or disabled. If tomorrow is a holiday and I do not want to be waken up in the morning, I can disable the alarm.
- The alarm trigger time can be set.
- The alarm duration can be set.
- If the alarm has been triggered, it can be turned off. Obviously, otherwise one is liable to throw the clock against the wall.
- All alarm settings are stored in the RTC RAM. If the power to Arduino is cut the settings are safe, and will be restored to the Arduino once power is reestablished.
- Temperature and humidity display. Using a DHT11 sensor, I can now show the temperature and relative humidity. The one I got is already soldered to a breakout board with proper pull-up resistor. For the software side I use the DHT sensor library version 1.4.3 by Adafruit. This library has a dependency on Adafruit Unified Sensor library also by Adafruit, I use version 1.1.4.
- Adjustable LCD brightness. Back in Part 3, I used a simple wire to make the LCD backlight always on with full brightness. Now I use a 10kΩ trim potentiometer (like this one from Adafruit) to make the brightness adjustable. The potentiometer is linear, but the brightness response is not.
I was going to put this in a more permanent setup: giving it a 18650 battery, soldering it to a perfboard, and putting it into an enclosure. But there’s no point doing those yet, when this clock has an annoying problem: high current draw.
- At LCD backlight min setting, 26mA.
- At LCD backlight min setting and alarm triggered, 54mA.
- At LCD backlight max setting, 46mA.
- At LCD backlight max setting and alarm triggered, 74mA.
Suppose I use a single 18650 cell with 3000mAh and use a 90% efficiency boost converter to step up the voltage to 5V, that leaves 2700mAh. Even if I turn the LCD backlight down to minimum and the alarm never triggered, that is only good for 130.8 hours (around 4.3 days). That means the 18650 needs to be recharged at least every 4 days. That’s annoying 😩.
So right now I am seeking ways to reduce the current draw.
That’s it for now!
- 2021-12-04 Update: Previously the schematic has errors where there are 2 resistors designated as R9 and other resistors not incremented correctly. This has now been fixed.