This project is about the interfacing of a DS18B20 module with Arduino UNO. The data for temperature is displayed on the Serial Terminal and on the next phase we will display the data on OLED Display.
Functions under this library
Video Example:
What is Digital Temperature Sensor?
Digital Temperature Sensor(DS18B20) has two parts one measures the data another very basic chip inside that does some analog to digital conversion and spits out a digital signal with the temperature. The digital signal is fairly easy to read using any microcontroller.
Pinout:
- VCC supplies power for the module. You can directly connect it to the 5V pin on the Arduino.
- Data pin transmits the temperature and humidity data in digital form.
- GND is the Ground Pin and needs to be connected to the GND pin on the Arduino.
To connect this sensor to Arduino first we have to include two libraries specially designed for this sensor OneWire.h, DallasTemperature.h.
Then its time to tell the Arduino in which pin the sensor is connected. For this, we use this code OneWire oneWire(ONE_WIRE_BUS);
Now we have to tell the Arduino what sensor it is, for this we use DallasTemperature sensors(&oneWire);
Finally, we have to start the library by sending sensors.begin();
Then we have to ask the ic to send the temperature by sensors.requestTemperatures();
We can store the temperature in a variable by int temp = sensors.getTempCByIndex(0); 0 (Zero) stands for the first sensor, we can connect more than one sensor in one pin.
DS18B20 Sensor Library
Functions under this library
sending sensors.begin(); --------------------- Starts the library
sensors.requestTemperatures(); ------------ Requestes for the reading
sensors.requestTemperatures(); ------------ Requestes for the reading
sensors.getTempCByIndex(0); -------------- Gives the value of temperature.
Video Example:
No comments:
Post a Comment