Introduction
In this article, I am going to explain the Temperature Sensor In LED By Arduino. I have fixed three LEDs in the Bread board and also connected the temperature sensor with the Arduino. I will use the display in 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 postive side to be 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);
-
- 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);
-
- 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 water proof is fixed in the Water or Ice bar, it will be displayed in the serial monitor also.
Output