================================================================================================================================================
Showing posts with label i2c. Show all posts
Showing posts with label i2c. Show all posts

Friday, October 3, 2008

Thermometer using DS1621 and Nokia 3310 LCD interfaced with ATmega8


Hi friends,
in my last post I had discussed Nokia 3310 LCD interfacing with AVR ATmega8. It's really fun to work with this LCD.

Now, here I'm presenting one application with the same LCD: Designing a thermometer using DS1621 temperature sensor IC. DS1621 is 8-pin sensor from Maxim, with temp range of -55 to +125 degree C, which can be interfaced with microcontroller over two-wire serial i2c bus. It has operating voltage range from 2.7 to 5.5v. I'm operating it here at 3.3v, same as the one driving the LCD and ATmega8. DS1621 doesn't require any external components to measure temperature. It has got continuous or one-shot temperature reading capability to save power.
Check out the schematic:


Here is the Proteus ISIS simulation result:



I'm using here LM317 for getting 3.3v supply, any 3.3v rgulator can be used to replace it. The LED is only for checking the health of the circuit incase nothing comes up on display. The circuit is programmed to update temperature appx. every second.

I've taken help of LFG application for generating different sizes of fonts for the LCD, thanks o the author M.Ebrahimy. The application can be downloaded from here:
LCD Font Generator

I've created library functions for DS1621 interface with AVR using ICCAVR compiler. This functions can be used with i2c base routines discussed in my earlier posts. You can download the project source code here.





Download
------------------
HEX file
Source code (including the 3310 & DS1621 Libraries)
Proteus Simulation Model


(Do you wanna use this HEX file but don't want my name on the display?? Well, just learn how to play with hex file from intel HEX-file tutorial, find ascii characters of my name in the hex file and replace them with yours!!)

Download Datasheets:
1. DS1621
2. ATmega8

Thanks!!
---------
Contact: ccd@dharmanitech.com

Friday, August 15, 2008

Interfacing RTC & serial EEPROM using i2c bus, with ATmega128 uC






















Hi friends,
here is my experiment with i2c bus for interfacing serial EEPROM (24C256) and RTC (DS1307) using AVR microcontroller ATmega128. The circuit is also provided with an RS232 port for connecting with PC to send commands for reading/writing EEPROM or setting date/time in RTC (Click on images to enlarge them).

Communication with PC is done through Hyper Terminal. A screen shot of the message sent to PC by microcontroller immediately after power ON is shown in the figure at the left, where the user is asked to enter choice from the menu options related to EEPROM and RTC. User can store data in EEPROM, or set RTC date and time by entering them using PC keyboard.
Hyper Terminal is used with 19200 Baud, No parity, No hardware flow control settings.

When the circuit is powered on, a welcome message is displayed on the Hyper Terminal window and a menu with 9 options (0-8) is displayed (refer to the figure). The options are explained here:

0: Erase EEPROM (fills eeprom with 0xff bytes)
1: Write EEPROM (starts writing eeprom starting with 0x0000 address)
2: Read EEPROM (reads eeprom starting with 0x0000 address)
3: Write eeprom page (writes one page of eeprom at specified page number)
4: Read eeprom page (Reads one page of eeprom at specified page number)
5: Display RTC Date (Displays current date from RTC)
6: Display RTC time (Displays current time from RTC)
7: Update RTC Date (Setting new date in RTC)
8: Update RTC time (Setting new time in RTC)

The option is selected from PC keyboard. While writing to eeprom or RTC the data is entered using PC keyboard as specified by the program.

The software routines include DS1307 library, 24C256 library & I2C library along with the main function.

The code is written in C using winAVR (inside AVRStudio). The complete project folder can be downloaded here in zip format (updated on 25-April-2009, earlier it was in ICCAVR format):

Here is running simulation on Proteus ISIS (click on image to enlarge it):


Downloads
------------------
Complete Source code (winAVR, AVRStudio-4 format)
Proteus Simulation Model


Datasheets:
ATmega128DS1307FM24C256,  MAX232

Thanks!

(last updated on 25-April-2009)
---------
ccd@dharmanitech.com