By default the header Pin Nr. 7 us used by the 1-wire kernel module.

I would like to change it to a one of the 4 new GPIO Pins of an Rev 2 Pi.

  • The kernel code for bitbanging 1wire on the RPi is a bit messy at the moment, multiple implementations exist. But unless I missed something completely, the only way to change this pin at this moment is to recompile the module, a name that keeps popping up in this context is 'Frank Buss', see for example this thread on the RPi forum – ikku Feb 7 '13 at 12:04
  • For the Raspberry Pi Model 3B+, and presumably everything else running the current OS, the default pin is now pin 4. – Bob Brown Aug 23 '18 at 17:16

To change the default GPIO pin used for 1-wire communication you can edit the /boot/config.txt file and add this line:


where x is the GPIO pin you want to use. Reboot to see the change.

| improve this answer | |
  • Great answer. There is so much misinformation about this question out there. Simple, worked with Raspi 2+ and Raspi 3 with current Raspian. – choise May 23 '17 at 16:23
  • 1
    Yea it took me a while to find this out myself, the incorrect answers out there is what prompted me to answer this question to begin with. – Joakim May 24 '17 at 14:38

Important remark: it must be exactly as indicated, without any space between parameters and values in the command: dtoverlay=w1-gpio,gpiopin=x

| improve this answer | |

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.