Introduction
Parts Of Lists
- Arduino Uno
- DS18B20 Temperature Sensor
- LEDs
- Bread Board
- Hook-Up Wires
DS18B20 Temperature Sensor

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
In this header file, it can be used to download from Google Chrome in the Git Hub and include in the Arduino software.
- #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);
- }
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





fblink accountPosted Apr 10, 2019, 12:44 AM EDT
Please add pictures of the wire connections. ty
RajaPosted Oct 31, 2016, 4:02 AM EDT
Great..
Prasanna MuraliPosted Sep 5, 2016, 7:05 AM EDT
Nice post......
Vignesh ManiTOP 100Posted Sep 4, 2016, 1:14 PM EDT
Good one
Anu VPosted Sep 1, 2016, 10:49 PM EDT
Nice...