Raspberry Pi Pico ProjectsRaspberry Pi Projects

DS18B20 Temperature Sensor With Raspberry Pi Pico

In this tutorial, we’ll be using a DS18B20 temperature sensor with Raspberry Pi Pico. The DS18B20 is a famous temperature sensor that uses a digital signal to output temperature data.

The DS18B20 is a digital temperature sensor that uses a 1-Wire bus to communicate with the Raspberry Pi Pico. the sensor provides 9 to 12 bits of resolution, completing it ideal for applications where temperature accuracy is important.

Required Material

For this project you will need:

  • Raspberry pi pico
  • Breadboard
  • DS18B20 temp sensor
  • 4.7K resistor
  • Jumper wire

DS18B20 temperature sensor

DS18B20 SensorA DS18B20 temperature sensor is a device that measures temperature. It is made up of a metal element that changes resistance with temperature, and an IC that amplifies the signal and converts it to a digital output. The temperature range is between -55C to 125C and it is accurate to +/- 0.5C between -10C and +85C. it can be used in a wide range of applications. including medical, automotive and industrial.

DS18B20 temperature sensor Pinout

Here is DS18B20 Sensor Pinout
Source- lastminuteengineers.com

DS18B20 Sensor specs:

  • Functional temperature range: -55 to 125°C (-67°F to +257°F)
  • 9 to 12-bit selectable resolution
  • Uses 1-Wire interface- requires only one digital pin for communication
  • Unique 64-bit ID burned into the chip
  • Multiple sensors can share one pin
  • ±0.5°C Accuracy from -10°C to +85°C
  • Query time is less than 750ms
  • Usable with 3.0V to 5.5V power/data

Wiring Diagram – DS18B20 Temperature Sensor With Raspberry Pi Pico

To print the data from DS18B20 on the serial monitor of the Thonny IDE you have to build the circuit by following the schematic diagram.

DS18B20 Temperature Sensor With Raspberry Pi Pico
Wiring diagram

The connections are straightforward, see the image above with the circuit schematic.

  • Vcc & GND pins of sensor –> Raspberry Pi Pico 3.3V & GND
  • Signal (middle pin) –> Raspberry pi pico gp26 (ADC0)
  • 4.7K Resistor between signal pin and 3.3V pin

Micropython Code – DS18B20 Temperature Sensor With Raspberry Pi

The following micropython script code will read the temperature values from the DS18B20 sensor.

main.py

Conclusion

To complete this, the DS18B20 temperature sensor is an excellent way to measure temperature with a Raspberry Pi Pico. It is easy to set up and use, and it is very accurate.

temprature sensor with pico 1

Multiple DS18B20 Temp sensors with Raspberry Pi Pico

We’ll be using the Raspberry Pi Pico and multiple DS18B20 Temp sensors to create a temperature monitoring system. We’ll be using the 1-Wire protocol to communicate with the DS18B20 sensors, which means we can use a single GPIO pin to control all of the sensors.

Circuit Diagram –  Multiple DS18B20 Temp sensors with Raspberry Pi Pico

The following diagram is a simplified view of the connection.

Multiple DS18B20 Temp sensors with Raspberry Pi Pico

Micropython Script

The following code will enable you to collect the DS18B20 temperature sensor finds and prints out the serial number of each sensor and the temperature that it is reading.

Conclusion

The result will look something like the following;

 

Related Articles

Leave a Reply

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

Ad
Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker