RPi Zero W + Enviro pHAT + Zero LiPo + ds18b20 temp sensors


I’m currently using a Rpi3 with SenseHAT and with three ds18b20 temperature sensors using GPIO4 (pin7) to monitor the temperature in the baby carriage. As it is digital, it works awesome on the 1-wire.

Trying to build a smaller LiPo powered rig using a RPi Zero W + Enviro pHAT + Zero LiPo + my three ds18b20 temperature sensors. According to pinout.xyz both the Enviro pHAT (for LEDs?) and the Zero LiPo (for battery low signal) are using GPIO4 (pin7) as well as my ds18b20 sensors.

Can I hook it all up to GPIO4?
If that doesn’t work, any suggestions?


No, that would be bad. You can’t have GPIO4 serve three duties at once;

  1. 1-Wire bus for your ds18b20 sensors
  2. Input with pull-up for battery low signal
  3. Output for Enviro pHAT LEDs

The good news is that you can move 1-Wire to (I think) any pin using dtoverlay=w1-gpio,gpiopin=X in /boot/config.txt

As for Enviro pHAT and Zero LiPo- that’s a little more complicated. You could use some creative wiring to move the GPIO pin that Enviro pHAT uses and then update it in the library.

(Ugh I should have set a LEDs constant here!)

You might get away with, if you don’t need the LEDs, removing the relevant code from the Enviro pHAT library altogether:


(Lines 4 and 11)

Clone from GitHub, drop these lines and then sudo python ./setup.py install

Awesome, thx for the quick reply!

I don’t really need the LEDs, the other sensors yes, so I can remove the LEDs from the library altogether. Is there any check/requirement by the Enviro pHAT that GPIO4 needs to be connected or can I safely leave it not connected?

Moving the 1-wire bus is a great idea, which new pin would be the best choice (or better yet, gives the least issues) ?

According to our (now somewhat outdated mind) poll of pin prominence, and as long as it doesn’t conflict with anything you plan to use, BCM5 is a pretty lonely lass.

See: https://twitter.com/pimoroni/status/801779845336276992

If you remove the LEDs code from Enviro pHAT, it should work fine. Actually it can’t tell whether or not you’ve got BCM4 connected, but if you left the code in the library it would mess up the pin states and break Zero LiPo’s functionality anyway.

I suspect you can probably even leave the LEDs connected, the worst they’ll (potentially) do is light very, very dimly.