Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Room thermometer(using LM35 and microcontroller atmega 8l ) problem

Status
Not open for further replies.

Akshat Kumar Verma

Newbie level 4
Joined
Mar 8, 2012
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,332
guyzzz i need help.........i have made digital room thermometer using LM35 and at-mega 8l micro controller (ADC feature) which shows the value on seven segment.it shows the value initially approx equal to the actual room temperature but after sometime it starts incrementing reach to 60 and 56. i m unable to understand the problem as i touch "ice" to LM35 the value decreases (that means ADC is working and it comes nearer to actual value i.e actual room temperature and but with the increase it starts wandering
i m using code vision avr and serial port programmer.
plzzz help.....:roll:

Photo0103.jpgPhoto0104.jpg)
 
Last edited:

post your circuit and code, someone could able to solve it
 

following is the code made in CVavr and i m posting pcb designed by me as i do not know HOW to use tina pro and other simulators

pcb 1.jpg PROJECT2.png




Code:
#include <mega8.h>
#include <delay.h>

// Declare your global variables here
void seven_segmentL(int y)       //function for left seven segment as per pcb design
{
if(y==0)
PORTB=0b01100000;

else if(y==1)
PORTB=0b01111011;

else if(y==2)
PORTB=0b11010000;

else if(y==3)
PORTB=0b01010010;
       
else if(y==4)
PORTB=0b01001011;

else if(y==5)
PORTB=0b01000110;

else if(y==6)
PORTB=0b01000100;

else if(y==7)
PORTB=0b01110011;

else if(y==8)
PORTB=0b01000000;

else if(y==9)
PORTB=0b01000010;

}
void seven_segmentR(int x)        //function for right seven segment as per pcb design
{
if(x==0)
PORTD=0b00010001;

else if(x==1)
PORTD=0b11011101;

else if(x==2)
PORTD=0b10000011;

else if(x==3)
PORTD=0b10001001;
       
else if(x==4)
PORTD=0b01001101;

else if(x==5)
PORTD=0b00101001;

else if(x==6)
PORTD=0b00100001;

else if(x==7)
PORTD=0b10011101;

else if(x==8)
PORTD=0b00000001;

else if(x==9)
PORTD=0b00001001;

}
void main(void)
{  int r,therm,b,d;
// Declare your local variables here

// Input/Output Ports initialization
// Port B initialization
// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out 
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0 
PORTB=0x00;
DDRB=0xFF;

// Port C initialization
// Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In 
// State6=T State5=T State4=T State3=T State2=T State1=T State0=T 
PORTC=0x00;
DDRC=0x00;

// Port D initialization
// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out 
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0 
PORTD=0x00;
DDRD=0xFF;


// ADC initialization

ADCSRA|=(1<<7);// ADC enabled
ADMUX|=(1<<7); //avcc as refernce
ADMUX|=(1<<5);  //reading ADCH
ADCSRA|=(1 << 2); // Prescaler 128
ADCSRA|=(1 << 1); // Prescaler 128
ADCSRA|=(1 << 0); // Prescaler 128




while (1)
      {
    ADCSRA^=(1<<6);
    delay_ms(100); 
    ADCSRA^=(1<<6);
    r=ADCH;
    therm=(r*500)/256;
    b=therm/10;
    d=therm%10;
    seven_segmentL(b);
    seven_segmentR(d);
    delay_ms(1000);

      }
}
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top