Radio, alarm clock and thermometer - all in one system
Original project by: Владислав Шаповалов
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 http://frank.bol.ucla.edu/2313Temper8.htm.
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.
Few photos of working device:








Firmware and flash contents are Here.
Blogsphere: TechnoratiFeedsterBloglines
Bookmark: Del.icio.usSpurlFurlSimpyBlinkDigg
RSS feed for comments on this post | TrackBack URI for this post
New on WinAVR Tutorial
Running TX433 and RX433 RF modules with AVR microcontrollers,Sometimes in embedded design you may want to go wireless. Might be you will want to log various readi …Programming AVR ADC module with WinAVR,Most of AVR microcontrollers have Analog to Digital Converter (ADC) integrated in to chip. Such solut … |
New on WinARM Tutorial
What are differences between WinARM and WinAVR,Everyone who is working with AVR microcontrollers knows this powerful tool – WinAVR (http://win …LPC2000 watchdog timer,As in all microcontrollers watchdog timers purpose isto reset microcontroller after reasonable amount … |

December 4th, 2007 at 12:49 am
[...] alarm clock and thermometer - all in one system - [Link] Tags: Alarm, Clock, DS1820, I2C, KDC-2092, Radio, TDA7407D, TEA5757H, thermometer Filed in [...]
September 17th, 2008 at 10:00 pm
Hey.
Very nice! Well done…