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...
1 Answer
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.
-
Thank you! I had a problem with it so it's why I've asked, but now everything is okey– Nicu MihMay 17, 2016 at 15:06