================================================================================================================================================

Saturday, August 30, 2008

Make-Yourself ATmega32 Starter's Kit with LCD, I2C, SPI, RTC, ADC interfaces













Hi friends,
here is my home-made kit of ATmega32 microcontroller interfacing. The ATmega32 controller is rich with features like onboard 32kB in-System programmable flash, 1 KB EEPROM, 2KB SRAM, 10bit ADC (8 channel), SPI bus inteface, TWI (compatible with I2C bus) interface, an USART, analog comparator, etc. That's why I've selected it to load my kit with all those features.

This M32 card is having an LCD inteface with contrast adjustment, an RS232 port for connecting with PC, a connector for 8 analog voltage inputs to measure by ADC, a Real Time Clock IC DS1307 from maxim with battery back-up, four general purpose keys, two keys for generating interrupts and an LED.
The circuit can be powered by an easily available 12v DC adapter. The voltage regulator IC 7805 used to convert the input into regulated 5v supply.

See below the kit in powered on condition and the schematic (click to enlarge the images)













The PCB is completely home-made, using the etching technique with the Ferric Chloride chemical. If you want to know how to make a PCB yourself from your layout, visit following webpage, it's really helpful:

http://electrons.psychogenic.com/modules/arms/art/10/pcb_howto.php

The schematic and layout of the M32_card shown here are prepared using EAGLE. It's a single layer board for making the home-preparation easy. Check out the bottom layer and the layouts in the pics below:












The software for the ATmega32 controller is written using imageCraft AVR compiler. The software contains code for LCD interface, use of RTC and communication with PC with RS232 port. Using the Hyper terminal in windows, the functionality of the kit can be checked, as I've mentioned in my previous post of RTC_EEPROM interface with ATmega128.
Sown below are the pics of RTC circuit in test and related screen shot of the hyper terminal while interacting with the M32_Card

















Here is Proteus ISIS Simulation:



The complete source code files including new addition of ADC (check out Here) can be downloaded below.


Download
----------------
Source code
PCB files (in PDF & EAGLE formats)LinkProteus Simulation Model


Datasheets:


--------
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

Wednesday, August 6, 2008

opamp Precision Rectifier

Hi friends,
this is a simple opamp precision rectifier. Very useful in rectifying or making bipolar signals unipolar, specially in small signals where we cannot afford to have that 0.7v drop across the normal diode bridge rectifier.
The circuit shown here gives rectified output going only in the negative direction, as my application required it that way. But if you want rectified positive output, just reverse the direction of both the diodes and you'll get it!