How to Change 1-Wire Pin
The default 1-Wire pin on Raspberry Pi is GPIO 4. To change it to a different GPIO pin, enter the following in the Raspberry Pi terminal:
sudo nano /boot/config.txt
Find the following content in the file:
dtoverlay=w1-gpio
If you want to use GPIO 17 as the 1-Wire pin instead of GPIO 4, modify it as follows:
dtoverlay=w1-gpio,gpiopin=17
If you want to use multiple 1-Wire pins, enter multiple lines as follows:
dtoverlay=w1-gpio,gpiopin=17
dtoverlay=w1-gpio,gpiopin=27
Press Ctrl + O -> Enter -> Ctrl + X to save the changes and exit the editor.
Enter the following command to reboot the Raspberry Pi, and the changes will be applied:
sudo reboot