Radio, alarm clock and thermometer – all in one system

Such multi-purpose device is a nice example of of using microcontroller for combined tasks. The idea of radio-clock-thermometer came up when authors car audio head-end was stolen. He decided to use what’s left left from car radio and build something nice. So the project has started.


The intent was to use radio module (KDC-2092) from Kewood, but somehow it didn’t respond. So radio chip was taken from computer radio tuner (TEA5757H) which can be easily controlled via 3 wires(DATA, Clock, Write Enable). Additionally mono/stereo selection input is available. To give more control power there was an advanced car audio signal processor TDA7407D used. Audio processor also can be controlled digitally via I2C interface. Temperature reading was implemented with DALLAS DS1820 sensor. As datasheet says, there can be up to 8 temperature sensors connected to one wire, but only tow were used in this project. Program piece of reading temperature sensors was adapted from

Information is displayed on graphical LCD Powertip PE12864URT-003-IY1 128×64 with built in ST7565 controller. Data on LCD is organized as follows: 128 columns and 8 rows of 8 bits as dots. So for one screen there are 8×128=1024 bytes = 1kB needed. All images and fonts were developed with Adobe PhotoShop 7.0 and made available to flash them in to AMD29F010B flash memory (or smaller AT29C512). Flash memory can be programmed with WillemProg or other programmer. Flash memory is organized as follows: in address range [0000-00FF] all necessary LCD control commands are stored, further addresses store images and fonts.

The program for AVR Atmega8515 microcontroller is written in Assembly language for AVR Studio. Visual program structure is here. Main variable is button <Select> counter (Butt0 connected to INT0 pin). Depending on button press count related function is called. <+> and <-> buttons are used to increase and decrease parameter or select sub-function. Meaning of press counter values:

1 – Clock;

2 – Volume control also low, mid and high freq control;

3 – Tuner settings, searching for radio stations, station is assigned to number and saved on exit from menu;

4 – Clock setting, alarm setting, LCD contrast, switching On/Off back-light;

5 – LCD OFF while other functions are working in background;

6 – Temperature display of two sensors controlled with <+> and <-> buttons.

When alarm clock is set – thin bar under time digits is displayed. When alarm starts its sound level grows up slowly. If <Select> button is pressed, alarm is reset +7 minutes ahead. Alarm is turned of completely by pressing buttons <Select> <+> and <-> in series. This should wake you up 🙂

All constant parameters are stored in microcontrollers EEPROM memory, so when power is turned off, all parameters are preserved. When clock is tarted – it loads initial parameters from EEPROM including alarm settings, radio stations. Clock also has a protection circuit from power loss. It uses a supervisor IC(MC34064P-5) which monitors a voltage level. It gives a ”0” to pin PB7 when voltage drops below threshold after this happens – LCD is switched OFF, all periphery is turned off only clock is working from internal battery (not tested).

CD4049 IC is used to remove button de-bouncing. Using External components allow to save processing time for faster response. As controller goes to sleep every second, there is CD4042 IC used which remembers last stage of control pins. When MCU goes to sleep, ports enter high Z-impedance stage, so trigger has to keep control voltages for transistor key VT2.

Circuit diagram

Few photos of working device:









Firmware and flash contents are Here.


  1. Pingback: Blog » Blog Archive » Radio, alarm clock and thermometer - all in one system

  2. Hey.
    Very nice! Well done…

  3. Hey man, I just attempted to e-mail you in relation to an issue I had regarding this post, however I can not fully find out a way to reach you. If however you can view my email address, can you send me a msg? Thanks man.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.