Friday, July 17, 2015

Temperature sensor circuit using Arduino

Introduction
Temperature sensor circuit can give us information about the temperature of any place(where we place the circuits) and we can control any thing which are function of temperature like Fan etc. The circuit gives us the information when the temperature of any place exceeds the set temperature.
Components Required
1. Arduino(i used Uno)
2. Temperature sensor(Thermistor)
3. Resistor about 2.2k
4. led or Motor
5. BC547 transistor



for the same type of circuits without using arduino, please visit
http://circuitsnepal.blogspot.com/2015/07/automatic-temperature-controlled-fan.html
Program code
int thr=A0;
int led=13;
void setup()
{
  pinMode(thr,INPUT);
  pinMode(led,OUTPUT);
  Serial.begin(9600);
}
void loop()
{
  int value=analogRead(thr);
  Serial.println(value);
  if(value<800)
  digitalWrite(led,LOW);
  else
  digitalWrite(led,HIGH);

}

Circuits Diagram



Connect the circuits components as shown in the figure. Copy and paste the program code on your Arduino IDE software and upload it to your arduino. Some times the circuits wont work. This is due to the set value. In the program check the line where there is 
if(value<800)
{                            
                       digitalwrite(led,HIGH);
}                           

to make it correct ..open your serial monitor on your arduino ide which looks like search button..
Its showing value.. note it. then make some heat on thermistor. then again read the value... take a value midway between two reading and replace 800 with it. still if you have any confusion about the circuits and program please comment. 
If you dont understand what is it please visit my previous arduino tutorial..
http://circuitsnepal.blogspot.com/2013/09/bc547-npn-transistor.html#links


basic working of sensor circuit
=> The thermistor and resistor forms a voltage divider circuits           
=> The transistor acts as a led driver                                                    
=> Arduino works as a main brain of the sensor circuits                     
=> when temperature is low then resistor value of thermistor             
is high so voltage to the A0 is also high and the value is 
high so the bc547 will get low base current and voltage
and led will be off
=> when temperature is high, resistance of thermistor will be              
low so voltage to the A0 is LOW and the value will also
be low so that output from 13 will be high and bc547 will
be on and led also will be on indicating high temperature.
=> led has two terminal anode and cathode. longer leg  is anode(+ve)
thank you.....please visit again..



No comments:

Post a Comment