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...

  • Couple of things from a quick search here: (1) -- (2). I don't think they are direct answers to or duplicates of your question, but they do hopefully have some clues and implications.
    – goldilocks
    Commented May 15, 2016 at 17:11

1 Answer 1


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.


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 Mih
    Commented May 17, 2016 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.