Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Temperature Sensor In LED By Arduino
WhatsApp
Sr Karthiga
4y
24.5k
0
1
100
Article
templed.zip
Introduction
In this article, I am going to explain the Temperature Sensor In LED By Arduino. I have fixed three LEDs in the Breadboard and also connected the temperature sensor with the Arduino. I will use the display on the LED.
Parts Of Lists
Arduino Uno
DS18B20 Temperature Sensor
LEDs
Bread Board
Hook-Up Wires
DS18B20 Temperature Sensor
The DS18B20 communicates over a 1-wire bus that, by definition, requires only one data line (and ground) for communication with a central microprocessor. Additionally, the DS18B20 can derive power directly from the data line (“parasite power”), eliminating the need for an external power supply.
Figure1: Sensor
Figure2: Water Proof
Connection
Connect the 3 LEDs in the correct pin mode. These three LEDs in the positive side to being connected in the input mode. The three negative sides are to be connected in the GND mode.
Temperature Sensor
Connect the three-pin in the VCC, GND, VIN
GND-Gnd
VCC-5v
VIN- Input mode
Programming
#include < OneWire.h >
#include < DallasTemperature.h > int greenLedPin = 2;
int
yellowLedPin = 3;
int
redLedPin = 4;
int
temp_sensor = 5;
float
temperature = 0;
int
lowerLimit = 15;
int
higherLimit = 35;
OneWire oneWirePin(temp_sensor);
DallasTemperature sensors( & oneWirePin);
void
setup(
void
) {
Serial.begin(9600);
//Setup the LEDS to act as outputs
pinMode(redLedPin, OUTPUT);
pinMode(greenLedPin, OUTPUT);
pinMode(yellowLedPin, OUTPUT);
sensors.begin();
}
void
loop() {
Serial.print(
"Requesting Temperatures from sensors: "
);
sensors.requestTemperatures();
Serial.println(
"DONE"
);
temperature = sensors.getTempCByIndex(0);
digitalWrite(redLedPin, LOW);
digitalWrite(greenLedPin, LOW);
digitalWrite(yellowLedPin, LOW);
Serial.print(
"Temperature is "
);
Serial.print(temperature);
//Setup the LEDS to act as outputs
if
(temperature <= lowerLimit) {
Serial.println(
", Yellow LED is Activated"
);
digitalWrite(yellowLedPin, HIGH);
}
else
if
(temperature > lowerLimit && temperature < higherLimit) {
Serial.println(
", Green LED is Activated"
);
digitalWrite(greenLedPin, HIGH);
}
else
if
(temperature >= higherLimit) {
Serial.println(
", Red LED is Activated"
);
digitalWrite(redLedPin, HIGH);
}
delay(500);
}
In this header file, it can be used to download from Google Chrome in the Git Hub and include in the Arduino software.
Explanation
In this article, I am explaining about the temperature as the Ice Bar and the water. LEDs will light up according to the changes. When the waterproof is fixed in the Water or Ice bar, it will be displayed in the serial monitor also.
Output
Arduino
IoT
Temperature Sensor
Up Next
Ebook Download
View all
Raspberry Pi -Sensorial Symphony of Connectivity
Read by 693 people
Download Now!
Learn
View all
Membership not found