Temperature Sensor Using ATmega8



advertisement

This is design for temperature sensor that is based ATMega 8. LM35 is using for sensing the temperature. This IC is cheaper than the price of this component is also easy to be in the market. This is the figure of the circuit.


LM35 have 10mV voltage change per 1 degree centigrade. LM35, in principle, given the voltage + Vs and GND, the voltage Vout will issue of
Vout = surrounding temperature (centigrade) x 10mV.
on the # include “lcd.h” you can download click here.

This is source code from this project in AVR-GCC format.

#include
#include
#include
#include
#include “lcd.h” //header lcd
volatile unsigned char suhu; //variabel store adc
//deklarasi lcd to stdio
static int lcd_putchar(char c, FILE *stream); //prototype
static FILE mystdout = FDEV_SETUP_STREAM(lcd_putchar, NULL,_FDEV_SETUP_WRITE); static int lcd_putchar(char c, FILE *stream)
{
if (c == ‘\n’) lcd_putchar(’\r’, stream);
LCD_send_char(c);
return(0);
}
//fungsi delay mili sekon
void delay_ms(int ms)
{for(int i=0;i<=ms;i++){_delay_ms(1);};
}
void adc_init(void) //inisialisasi lcd
{ ADMUX =(1<<
|(1<
|(0<<<<
ADCSRA =(1<<<
|(1<<<
sei ();
}
ISR(ADC_vect)
{ suhu=ADCH;
LCD_send_command(0xc0); //cursor line2
printf(”sekarang:%3d c”,suhu);
return;
}
int main (void)
{ adc_init();
delay_ms(200);
LCD_init();
stdout = &mystdout;
LCD_send_command(LCD_CLR);
LCD_send_command(LCD_HOME);
LCD_send_command(0×80); //cursor line1
printf(”suhu ruangan ini”);
LCD_send_command(0xc0); //cursor line2
printf(”sekarang:%3d c “,suhu);
while(1){
ADCSRA|=(1<
delay_ms(500);
}
return(0);
}

rangkaian LM35, rangkaian sensor suhu, project:temperature controlled fan by mosfet with atmega8 and lm35 lcd, skema rangkaian sensor, jam digital atmega 8, pic-avr thermostat LM35, FUNGSI Water temperatur sensor, timer elektronik suhu, ADC ATMega, rangkaian temperatur sensor
Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Yahoo! Buzz
  • Diigo
  • MisterWong
  • MySpace
  • Reddit
  • RSS
  • StumbleUpon
  • Technorati
  • Twitter

Related posts:

  1. Car water boiler temperature sensor and display circuit
  2. Temperature Indicator Circuit
  3. DC Fan Temperature Controlled Circuit
  4. Air Flow Sensor Circuit Using PIC16C781
  5. BC550 High Temperature ALARM

13 November, 2009 (07:27) | Microcontroller, Video | By: