Temperature Sensor
Temperature Sensor
2.c.Temperature Sensor
Aim
To interface an Arduino board with a temperature sensor and perform the following:
Components Required
Arduino UNO, Temperature sensor, resistor 4.7K ohm, jumper wires.
Procedure
• Connect the Vcc terminal of the soil sensor to 5V. Connect the GND terminal of the
soil sensor to GND. Connect the A0 terminal of the soil sensor to A0.
• Connect the 4.7K ohm resistor between signal PIN and Vcc PIN.
• Library Manager page will appear in that go to search and enter onewire. Select the
OneWire (Access 1-wire temperature sensors, memory and other chips) and install
• Again go to search and enter Dallas. Select Dallas Temperature(Arduino Library for
Dallas Temperature Ics supports DS18B20……) and install.
• Click on the Serial Monitor of the Arduino IDE. The Temperature is displayed on the
screen.
Circuit Diagram
#include <OneWire.h>
#include <DallasTemperature.h>
void setup(void)
{
// Start serial communication for debugging purposes
Serial.begin(9600);
// Start up the library
sensors.begin();
}
void loop(void){
// Call sensors.requestTemperatures() to issue a global temperature and Requests to all
devices on the bus
sensors.requestTemperatures();