Kode Iklan DFP Check How Hot/Cold Your Room Temperature | Microcontroller Projects
Kode Iklan 400x460
Kode iklan In feed above/responsive

Check How Hot/Cold Your Room Temperature

Kode Iklan 336x280
Kode Iklan In Artikel
HPK taruh disini

INTRODUCTION

The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.

The Uno differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to version R2) programmed as a USB-to-serial converter


Revision 2 of the Uno board has a resistor pulling the 8U2 HWB line to ground, making it easier to put into DFU mode

Revision 3 of the board has the following new features:
  • pinout: added SDA and SCL pins that are near to the AREF pin and two other new pins placed near to the RESET pin, the IOREF that allow the shields to adapt to the voltage provided from the board. In future, shields will be compatible with both the board that uses the AVR, which operates with 5V and with the Arduino Due that operates with 3.3V. The second one is a not connected pin, that is reserved for future purposes.
  • Stronger RESET circuit.
  •  Atmega 16U2 replace the 8U2.
 
Arduino UNO
As you know that in order to perform  arduino simulation, we must have the arduino first but because the price isn't cheap, we could use  Proteus.  Proteus is a software for PCB design that is also equipped with pspice simulation schematic level before the circuit upgraded to the PCB so before the PCB printed we will know whether the  PCB is correct or not . For people  who just install proteus , you guys can install arduino library here

Remember you guys need to install arduino software too because without this program we can't upload or  insert the code into Arduino UNO in proteus and you guys can download the software here 

TEMPERATURE SENSOR LM35

LM35 temperature sensor is an electronic component that has the function to change the temperature scale into electrical quantities in the form of voltage. LM35 has a high accuracy and ease of design when compared to other temperature sensors. LM35 Also has a low output impedance and high linearity that can be easily connected with the control special circuit and does not require further adjustment.


LM35 Feature :


  • Calibrated Directly in Celsius (Centigrade)
  • Linear + 10-mV/°C Scale Factor
  • 0.5°C Ensured Accuracy (at 25°C)
  • Rated for Full −55°C to 150°C Range
  • Suitable for Remote Applications

LM35 (Sensor Temperature)

SCHEMATIC


In this stage I will make the simulation design  to check the room temperature . Input system that we use is LM35 while the output is ligh/LED. Before we make the design we must know what component that we must have first.
The component for making  this simulation is
·         1 10K Ohm Potensiometer
·         9 LED
·         10 220 Ohm Resistor
·         1 LM35 
·        1 Arduino UNO

In this design   pin 13 until pin 4  will be connected  with resistor 220 ohm and LED and pin A0 will be connected with LM35, pin A1  will be connected potensiometer and connect Ground and Vcc to Potensiometer and LM35. The schematic design can be seen in  below :


Schematic Design

SOURCE CODE


//Declare the potencimeter and the temperature sensor pins
const int Temperatura= A0;
const int potenciometro= A1;

//declare each led pin
const int led1= 4;
const int led2= 5;
const int led3= 6;
const int led4= 7;
const int led5= 8;
const int led6= 9;
const int led7= 10;
const int led8= 11;
const int led9= 12;

//Declare the variables for the temp regulation
int pot_regulador= 0;;
int ajuste_de_temp= 0;

//declare leds as outputs
void setup() 
{
 pinMode(led1, OUTPUT);;
 pinMode(led2, OUTPUT);;
 pinMode(led3, OUTPUT);;
 pinMode(led4, OUTPUT);;
 pinMode(led5, OUTPUT);
 pinMode(led6, OUTPUT);
 pinMode(led7, OUTPUT);
 pinMode(led8, OUTPUT);
 pinMode(led9, OUTPUT);
}

//main program

void loop() {
  
   //read voltage from the temp sensor and transform to celsius
   int reading = analogRead(Temperatura);
   float voltage = reading * 5.0;
   voltage /= 1024.0; 
   float TemperaturaC = (voltage - 0.5) * 100 ; 
   
   pot_regulador=analogRead(potenciometro);
   ajuste_de_temp=pot_regulador/30;
   delay(50);
  

if(TemperaturaC<(20-ajuste_de_temp) && TemperaturaC>(16-ajuste_de_temp)){
      digitalWrite(led1, HIGH);
      digitalWrite(led2, LOW);
      digitalWrite(led3, LOW);
      digitalWrite(led4, LOW);
      digitalWrite(led5, LOW);
      digitalWrite(led6, LOW);
      digitalWrite(led7, LOW);
      digitalWrite(led8, LOW);
      digitalWrite(led9, LOW);
  }
  else if(TemperaturaC<(24-ajuste_de_temp) && TemperaturaC>(20-ajuste_de_temp)){
      digitalWrite(led1, HIGH);
      digitalWrite(led2, HIGH);
      digitalWrite(led3, LOW);
      digitalWrite(led4, LOW);
      digitalWrite(led5, LOW);
      digitalWrite(led6, LOW);
      digitalWrite(led7, LOW);
      digitalWrite(led8, LOW);
      digitalWrite(led9, LOW);
  }
  else if(TemperaturaC<(28-ajuste_de_temp) && TemperaturaC>(24-ajuste_de_temp)){
      digitalWrite(led1, HIGH);
      digitalWrite(led2, HIGH);
      digitalWrite(led3, HIGH);
      digitalWrite(led4, LOW);
      digitalWrite(led5, LOW);
      digitalWrite(led6, LOW);
      digitalWrite(led7, LOW);
      digitalWrite(led8, LOW);
      digitalWrite(led9, LOW);
  }
  else if(TemperaturaC<(32-ajuste_de_temp) && TemperaturaC>(28-ajuste_de_temp)){
      digitalWrite(led1, HIGH);
      digitalWrite(led2, HIGH);
      digitalWrite(led3, HIGH);
      digitalWrite(led4, HIGH);
      digitalWrite(led5, LOW);
      digitalWrite(led6, LOW);
      digitalWrite(led7, LOW);
      digitalWrite(led8, LOW);
      digitalWrite(led9, LOW);
  }
  else if(TemperaturaC<(36-ajuste_de_temp) && TemperaturaC>(32-ajuste_de_temp)){
      digitalWrite(led1, HIGH);
      digitalWrite(led2, HIGH);
      digitalWrite(led3, HIGH);
      digitalWrite(led4, HIGH);
      digitalWrite(led5, HIGH);
      digitalWrite(led6, LOW);
      digitalWrite(led7, LOW);
      digitalWrite(led8, LOW);
      digitalWrite(led9, LOW);
  }
  else if(TemperaturaC<(36-ajuste_de_temp) && TemperaturaC>(32-ajuste_de_temp)){
      digitalWrite(led1, HIGH);
      digitalWrite(led2, HIGH);
      digitalWrite(led3, HIGH);
      digitalWrite(led4, HIGH);
      digitalWrite(led5, HIGH);
      digitalWrite(led6, HIGH);
      digitalWrite(led7, LOW);
      digitalWrite(led8, LOW);
      digitalWrite(led9, LOW);
  }
    else if(TemperaturaC<(40-ajuste_de_temp) && TemperaturaC>(36-ajuste_de_temp)){
      digitalWrite(led1, HIGH);
      digitalWrite(led2, HIGH);
      digitalWrite(led3, HIGH);
      digitalWrite(led4, HIGH);
      digitalWrite(led5, HIGH);
      digitalWrite(led6, HIGH);
      digitalWrite(led7, HIGH);
      digitalWrite(led8, LOW);
      digitalWrite(led9, LOW);
  }
    else if(TemperaturaC<(44-ajuste_de_temp) && TemperaturaC>(40-ajuste_de_temp)){
      digitalWrite(led1, HIGH);
      digitalWrite(led2, HIGH);
      digitalWrite(led3, HIGH);
      digitalWrite(led4, HIGH);
      digitalWrite(led5, HIGH);
      digitalWrite(led6, HIGH);
      digitalWrite(led7, HIGH);
      digitalWrite(led8, HIGH);
      digitalWrite(led9, LOW);
  }
    else if(TemperaturaC<(48-ajuste_de_temp) && TemperaturaC>(44-ajuste_de_temp)){
      digitalWrite(led1, HIGH);
      digitalWrite(led2, HIGH);
      digitalWrite(led3, HIGH);
      digitalWrite(led4, HIGH);
      digitalWrite(led5, HIGH);
      digitalWrite(led6, HIGH);
      digitalWrite(led7, HIGH);
      digitalWrite(led8, HIGH);
      digitalWrite(led9, HIGH);
  }
  else if(TemperaturaC>(48-ajuste_de_temp)){
      digitalWrite(led1, HIGH);
      digitalWrite(led2, HIGH);
      digitalWrite(led3, HIGH);
      digitalWrite(led4, HIGH);
      digitalWrite(led5, HIGH);
      digitalWrite(led6, HIGH);
      digitalWrite(led7, HIGH);
      digitalWrite(led8, HIGH);
      digitalWrite(led9, HIGH);
  }
}

SIMULATION

Simulation for the program can be seen in this video to clarify how the LM35 works and what temperature  LED will on (multiple of 4 start from 16 until 56) and temperature can  be increased or decreased. because this is simulation not in real time so we can't get the real temperature without making the hardware . Just Watch the video if you didn;t understand what i'm saying now.








Kode Iklan 300x250
close
==[ Klik disini 2X ] [ Close ]==
Kode Iklan DFP2
Kode Iklan DFP2