Raspberry Pi Temperature Sensor: Build a DS18B20 Circuit

Опубликовано: 23 Февраль 2026
на канале: Pi My Life Up
40,123
255

In this video, I setup a Raspberry Pi temperature sensor circuit and some code. This is a pretty easy tutorial and is a great way to introduce yourself to sensors.
Full Tutorial: https://pimylifeup.com/raspberry-pi-t...

In this tutorial I will be using the waterproof version of the ds18B20 sensor. This cool sensor can provide super accurate temperatures and can withstand heat up to about 120°C (250°F). The sensor also is digital so we’re able to easily hook it up to the Raspberry Pi and get the required data. If you get a plain version of the ds18B20 it will look just like a transistor unlike the version that I am using.

If you have trouble getting the circuit together then you can find a circuit diagram that shows you exactly where to put all the parts over at pimylifeup.com

The code for this tutorial is probably the most complex part. This is because we need to process the data that comes from the sensor and in its raw form isn’t very user friendly. I can understand the code maybe being a little too hard to understand for anyone new to coding so I briefly explain the basics there is to know.

As you can imagine this Raspberry Pi temperature sensor tutorial can be extended quite a bit. For example, instead of discarding the data after every time we check we can instead store it in a text file or even a database. We can then use this data to plot nice looking graphs so you can see temperature changes over the course of a day, week, month or even a year.

If you’re wondering what equipment you will need for this tutorial, then you can find the full list over at the website linked above.
I hope you are able to get this Raspberry Pi temperature sensor circuit and code working correctly. If you do come across any problems, please be sure to leave a comment below or over at pimylifeup.com