0

How can i use 2 temperature (ds18b20) sensors with raspberry pi? If I can, what gpio pins should I use and how? So what pin can i use instead of gpio 4...

Nicu Mih
  • 17
  • 1
  • 1
  • 5

1 Answers1

0

The Raspberry Pi supports one 1-wire bus (currently, in the future more may be supported).

Each 1-wire bus supports an arbitrary number of 1-wire sensors so you can add as many DS18B20 as you want.

By default the 1-wire bus is connected to GPIO 4 (pin 7).

You enable the 1-wire bus by adding the following line to /boot/config.txt.

dtoverlay=w1-gpio,gpiopin=4

If you want to use an alternate GPIO change 4 to the (Broadcom numbered) GPIO you want to use.

There are several examples of reading the DS18B20 if you use the site search engine.

joan
  • 71,852
  • 5
  • 76
  • 108