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, 2013 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, 2018 at 17:16
  • @Bob Brown I think the default was always GPIO 4 (which is header pin 7). Oct 9, 2021 at 19:46

2 Answers 2


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.

  • 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, 2017 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, 2017 at 14:38

Important remark

it must be exactly as indicated, without any space between parameters and values in the command

As written above in /boot/config.txt


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.