2

I have a setup with a pi 3 and a breadboard. I am using a DS18B20 temperature sensor.

This is my setup (notice wrong resistor in this sketch):

enter image description here

As far as I can see it the sensor's second pin is the data pin.

enter image description here

So I am wondering could I pick any other GPIO X instead of the GPIO 4 (blue wire) in my case, e.g. GPIO 17 or GPIO 27?

4

The DS18B20 is a (Dallas) 1-wire bus device. You can connect multiple 1-wire devices to the same bus. They are differentiated by their unique internal Id.

So you can connect additional devices to GPIO4.

The Pi (currently) only supports one 1-wire bus.

By default that bus is associated with GPIO4.

An entry in /boot/config.txt allows you to change the default GPIO.

dtoverlay=w1-gpio,gpiopin=24

With the above example you would then need to connect your 1-wire devices to GPIO24.

  • Hence I would need to modify the /boot/config.txt ? – チーズパン Mar 19 '17 at 14:32
  • 1
    Yes, if you wanted to move the bus to a different GPIO. The change would not take effect until a reboot. – joan Mar 19 '17 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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