A Real Time Clock (RTC) is a timing element dedicated for keeping time. In many applications, especially where precise timed-operations are needed to be performed, a RTC is a very useful tool. Examples of such applications apart from clocks and watches include washing machines, medicine dispensers, data loggers, etc. Basically a RTC is a timer-counter but unlike other timers of a MCU it is much more accurate. Previous to this post, we explored STM32 timers but those were useful for applications like PWM generation, time-bases and other waveform-related tasks. Those were not suitable for precise time-keeping. In most 8-bit MCUs like the regular PICs and AVRs, there are no built-in RTC modules and so we need to use dedicated RTC chips like the popular DS1302 or PCF8563 when we need an on-board precise time-keeping device. Those chips also need some additional circuitry, wiring and circuit board space. At present, however, most modern MCUs come packed with literally every possible hardware a designer may think of. It is only up to a designer to decide which resources to use from a modern-era micro to meet a specific design goal. Gone are the days when MCUs were manufactured for application specific requirements and also gone are the days of implementing and involving multiple assets in a design. Thus cost, time and space are dramatically reduced, resulting smarter, sleeker and smaller affordable devices. Fortunately STM32s are in that list of those modern era microcontrollers. STM32 MCUs come with built-in RTC modules that require no additional hardware support. This tutorial covers basic features of STM32’s internal RTC and how to use it for time-keeping applications.
Tag Archives: digital clock
This DIY digital clock plus thermometer is designed by Joe Farr and is based on PIC18F25K22 microcontroller. The complete construction details of this project including circuit diagrams, PCB layouts and PIC firmware are posted in his website. He developed his firmware using Proton PIC BASIC compiler, which is available for download for free for this particular PIC microcontroller. He uses DS1302 RTC for timekeeping and DS18B20 for temperature measurement. The temperature and time are displayed on four 2″ seven segment LED displays.
Here’s another seven segment LED based digital clock using a PIC microcontroller. The project uses a 4-digit common anode type seven segment LED display, a PIC16F727 MCU, and BCR562 transistors operating as switches to drive the LED segments and common anodes. A coconut shell enclosure gives an artistic look to the clock.
This is an Arduino powered 24-hour digital clock that uses the RTC chip DS1307 for timekeeping. DS1307 has a small battery backup so that it keeps the correct time even the rest of the circuit is not powered. The time is displayed on 5×7 LED dot matrix.
The ATMEGA168 controller and the rest of the circuit is powered by a 9 volt 650 mA power supply with a LM7805 regulator IC.
This is a digital clock project based on an ATtiny26 microcontroller, displaying time on four seven segment LEDs. The seven segment LEDs glow bright white and are multiplexed through PORTB pins, whereas the segments are driven by PORTA pins. The time is normally shown in hh.mm format but it can be switched to display mm.ss too. The time setting can be done with two push button switches.