DS18B20 & LCD 128×64

Before I start, let’s of a quick review about the differences between DHT22 Temperature and Humidity sensor and DS18B20 Temperature sensor 1-Wire. (DHT22 vs. DS18B20)

سنسور دما دیجیتال DS18B20,  سنسور رطوبت و دما DHT22, دماسنج NTC

 

DHT22 vs. DS18B20 & NTC
DHT22 vs. DS18B20 & NTC

DHT22 is a digital temperature and humidity sensor.
DHT22 has a capacitive humidity  and a thermistor sensor and measures the surrounding air in one device.
The device only has a digital signal output (NOT any analog output).
The data can be read from the output every 2 seconds .
It comes in different technologies and forms.

DS18B20 Temperature Sensor

DS18B20 is 1-Wire interface Temperature sensor. This sensor has 3 pins and looks like a transistor.
The sensors only requires one port pin for communication and needs NO other external components to work.

Each individual device has its unique ID.
This ID consists of a 64-bit number (8 bytes). The microcontroller calls a unique ID and receive the carry data information in two bytes from the device.

All the other devices connected to the bus remain silent during their ID is not called.
The sending the data bytes for a DS18B20 takes about 750 msec.

The thermometer resolution of DS18B20 is programmable from 9 to 12 bits and it converts 12-bit temperature to digital in less than 750 ms.

For my project I decided to use a DS18B20 Sensor.

Components

– Arduino board
– DS18B20 Temperature Sensor module
– LCD 128×64 (ST7920) with serial mode – SPI

 

The following provide the instructions for making temperature measurement with a Dallas DS18B20, DS1307 and a LCD 128×64 ST7920.

A Dallas DS18B20 has three wires: 5V, GND and DATA. The DATA wire is connect to pin 4 of Arduino.
LCD ST 7920 runs in
 SPI mode. Only 3 digital pins of the Arduino are required to get output on the display.
The pins are RS, R/W and E. The RS(chip select) pin is wired to the Arduino pin 12, R/W to pin 11 and E to pin 13.

Libraries necessary are:
U8glib.h  –  graphic display control library,
OneWire.h   –  single bus protocol for data transfer of the DS18B20 sensor
DallasTemperature.h  –  extra library with DS18B20 instructions.

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*