More Search Type here

Custom Search

Tuesday, December 27, 2011

LM 35 as thermometer

This circuit buiding from ATmega16 AVR, could as thermometer display on LCD.
Circuit:



source code:
int SUHU;
char temp[8];
float suhu_celcius;

#include
#include
#include
#include

// Alphanumeric LCD Module functions
#asm
.equ __lcd_port=0x15 ;PORTC
#endasm

#define ADC_VREF_TYPE 0x40

// Read the AD conversion result
unsigned int read_adc(unsigned char adc_input)
{
ADMUX=adc_input | (ADC_VREF_TYPE & 0xff);
// Delay needed for the stabilization of the ADC input voltage
delay_us(10);
// Start the AD conversion
ADCSRA|=0x40;
// Wait for the AD conversion to complete
while ((ADCSRA & 0x10)==0);
ADCSRA|=0x10;
return ADCW;
}

void main(void)
{
// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
SFIOR=0x00;

// ADC initialization
// ADC Clock frequency: 750.000 kHz
// ADC Voltage Reference: AVCC pin
// ADC Auto Trigger Source: None
ADMUX=ADC_VREF_TYPE & 0xff;
ADCSRA=0x84;

// LCD module initialization
lcd_init(16);
lcd_clear();
lcd_gotoxy(0,0);
lcd_putsf("ElectrO-cOntrOl");

lcd_gotoxy(0,1);
lcd_putsf("SENSOR SUHU LM35");
delay_ms(1000);

while (1)
{
lcd_clear( );
SUHU = read_adc(0);
suhu_celcius = (float)SUHU*500/1023;//rumus untuk mengubah kedalam derajat celcius

lcd_gotoxy(0,0);
lcd_putsf("ElectrO-cOntrOl");
ftoa(suhu_celcius,1,temp);//mengubah tipe data float ke tipe data array yg akan ditampilkan di LCD
lcd_gotoxy(0,1);
lcd_puts(temp);

lcd_gotoxy(5,1);
lcd_putchar(0xdf);//menampilkan karakter derajat
lcd_putsf("C");
delay_ms(500);
};
}

Source articles from: elektro-kontrol.blogspot.com

Thursday, December 22, 2011

RAIN ALARM by Hankumar



This is a simple circuit that can be used to detect rain. It will give a loud beep when the first drop of rail falls on the sensor. So it useful to detect rain where sun drying is carried out.

Op-Amp IC 741 is designed as a voltage comparator. Its inverting input pin2 receives half supply voltage (4.5V) through the potential divider R1 and R2. Its non-inverting input pin 3 is connected to touch pads and variable resistor VR1. Output of the comparator becomes high only when its pin3 gets a higher voltage than pin2. Normally pin 3 is low because it is not getting current from the positive supply. So output remains low. This inhibits transistor T1 and buzzer remains off. When the contacts of the touch pad gets water, current passes through the contacts to the pin 3 of the comparator. This higher voltage at pin 3 causes the output to go high. LED lights and transistor conducts. Buzzer then starts beeping to indicate rain.

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Lady Gaga, Salman Khan