In this illustration we will going to wire the DS18B20 single wire temperature sensor. The digital DS18B20 Sensor provide fairly good accuracy and range of connection. The wire length can be reach up to 100m. The DS18B20 has four main data connection.

1.    64bit layered ROM
2.    Temperature Sensor
3.    Nonvolatile Temperature Alarm Trigger TH & TL
4.    A configurable Register

These device derives its power from the 1 wire communication line by storing energy on an internal capacitor during the periods of time when the signal line is HIGH and continues to operate off this power source during the LOW times of the 1 wire line until it returns HIGH to replenish the capacitor supply. As an alternative, the DS18B20 may also be powered from an external 3v~5.5v supply.


The DS18B20 communication is using 1 wire port. With the 1wire port the memory and control functions will not be available before the ROM function protocol has been established. The master must first provide on of five ROM function command.

1.    READ ROM
4.    SKIP ROM

These commands operate on the 64bit lasered ROM portion each device and the single out a specific device if many are preset on the 1-wire line as well as indicate to the BUS master how many and what types of devices are present. After a ROM function sequence has been successfully executed, the memory and control function are accessible and the master may then provide any one of the six memory and control function commands.

One control function command instructs the DS18B20 to perform a temperature measurement. The result of this measurement. Will be placed in the DS18B20 scratchpad memory, and may be read by issuing a memory function command which reads the contents of the scratchpad memory. The temperature alarm triggers TH and TL consist of 1 byte EEPROM each. If the alarm search command is not applied to the DS18B20, these registers may be used as a general purpose user memory. The scratchpad also contains a configuration byte to set the desired resolution of the temperature to digital conversion. Writing TH, TL, and the configuration byte is done using a memory function command. Read access to these register is through the scratchpad. All data is read and written least significant bit first.
Above block diagram is shows the circuitry. This circuitry steals power whenever the DQ or Vdd Pins are high. DQ will provide sufficient power as long as the specified timing and voltage requirements are met. The advantages of parasite power are.

  1. Using parasiting off this pin, no local power source is needed for remote sensing of temperature.
  2. The ROM may be read in absence of normal power in order for the DS18B20 to be able to perform accurate temperature conversions, sufficient power must be provide over the DQ line when a temperature conversion is taking place. Since the operating current of the DS18B20 is up to 1.5mA, the DQ line will not have sufficient drive due to the 5k pull-up resistor.

This problem is particularly acute if several DS18B20 are on the same DQ and attempting to convert simultaneously. There are two ways to assure that the DS18B20 has sufficient supply current during its active conversion cycle.

  1. Provide a strong pullup on the DQ line whenever temperature conversion or copies to the E2 memory are taking place. This may be accomplished by using a MOSFET to pull the DQ line directly to the power supply.
  2. The DQ line must be switched over to the strong pull-up within 10u maximum after issuing any protocol that involves copying the E2 memory or initiates temperature conversion. When using the parasite power mode, the V pin must be tied to the ground.

Wiring Requirements

  • Arduino  Board
  • DS18B20 Temperature Sensor
  • 1x 4.7k Ohms Resistor
  • LCD i2C LCD 16×2 or 5110 LCD (Optional)

Wiring  Single DS18B20 Diagram Schematics


Wiring  Single DS18B20 Wired Diagram Schematics


Wiring  Multiple DS18B20 Diagram Schematics


Arduino Sketch without LCD Display

Arduino Sketch with LCD Display

LCD 16×2 with I2C Driver

Download OneWire Code Library Here | Zip

Download DS18B20 Datasheet Diagram | Pdf

Wiring The DS18B20 1-Wire Temperature Sensor
Tagged on:         

Leave a Reply

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