Measure temperatures with a 1-wire DS18B20 sensor and Raspberry Pi

In our article DS18B20 Temperature Sensor with Raspberry Pi we detailed how the Raspberry Pi can be used to take temperature readings from a ds18b20 temperature sensor via the i2c protocol. Here we will expand that article to explain how multiple temperature sensors can be copnnected to the Raspberry Pi – particularly useful for example in solar water heating pump controllers and other differential temperature applications where two or more temperature sensors are required.

Measure temperatures with a 1-wire DS18B20 sensor and Raspberry PiThe above schematic shows how three ds18b20 temperature sensors are connected to the GPIO pins of the Raspberry Pi. Note that although there are now multiple temperature sensors to be read, we still only have three connections to the Raspberry Pi: +3.3V and 0V connections to power the sensors, and the single data wire which returns the temperature readings from all the sensors.

Reading temperature readings from multiple sensors down one wire is possible because each ds18b20 sensor has a unique serial number coded into it at manufacture which the Raspberry Pi can be used to identify them by.

When using multiple sensors the first thing to do is get the serial number for each sensor and physically label them so that you know which is which when you come to install them in different locations around a system.
Measure temperatures with a 1-wire DS18B20 sensor and Raspberry Pi SchematicFollow the steps in the article on connecting a single sensor to get everything set up on your Raspberry Pi and use the ls -l sys/bus/w1/devices command to find the serial number for this first sensor. Then add the second sensor and identify it when you relist the connected devices noting its serial number. Repeat this process until you have connected and identified all of the sensors.

 

For more detail: Measure temperatures with a 1-wire DS18B20 sensor and Raspberry Pi


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

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

Scroll to Top