Digital clock with temperature sensor

Faith Ikede

Overview

For this project, I chose to develop a clock that displays time (hh/mm), temperature in degrees Celsius, date in the format dd/mm/yyyy and day of the week. The clock can be powered by either a single AAA battery or from a USB port.

General view

Hardware

For the hardware, I used the Silicon Labs EFM32ZG108F32 microcontroller because it is very energy friendly. The display works in the 3-rows mode, each of the rows can consist up to 10 characters. The backlight is lit when the unit is powered from USB. The temperature is read from with the Silicon Labs SI7051 sensor which is a highly accurate digital temperature sensor. The device has no any external RTC, which is typical for such projects. Instead, is it equipped with a high-accuracy 32768 Hz TXCO SIT1552 and time and dates are calculated in software. The clock can be powered from either a micro-USB connector or an AAA battery. In the latter case a boost DC/DC converter is used to produce 3.3V to power the circuit.

Schematic Assembly

Software

This project was developed using Keil μVision5 in C. This program first configures the hardware and runs through all the set-up routines. When the main loop runs, it first re-calculates the time every second and requests the temperaturei one in 5 minutes. Then it checks if any button is pressed and performs the function based on the current clock state. The diagram below shows the clock states, the functions it performs at each state, and the state transitions. The time and date is calculated in software, updated internally every second, while the time on screen is updated once in a minute. The program also includes code for accurate button debouncing.

Here:

B1
Button 1 (left button/change state button). This button is used to change the clock states.
B2
Button 2 (right button/increase button). This button is used to increase hours, minutes, day of the week, date, month and year.

Final Thoughts

This is my first big microcontroller big project and I had a lot of fun designing it. I am pleased with my project functionality and design.

Downloads


Last modified:Mon, Jan 23, 2023.

00242