Enviro phat adding sensors

How do you add a Dallas ds18b20 temp sensor to a enviro phat and how would you go about adding a humidity sensor as I’m trying to build a weather station

You could use something like this, and connect it up to an analog pin: https://shop.pimoroni.com/products/sparkfun-humidity-sensor-breakout-hih-4030

There are alternatives like this, which could be connected to the i2c pins and share the i2c bus with Enviro pHAT: https://shop.pimoroni.com/products/sparkfun-htu21d-humidity-sensor-breakout

For the ds18b20 you would need to follow a guide for 1-wire temperature sensors. The default 1-wire pin is BCM4, however, and Enviro pHAT already uses this for the LEDs (http://pinout.xyz/pinout/enviro_phat), so you’ll need to set it up in /boot/config.txt like so:


Where x is a pin of your choice- 17 looks like a good bet.

Then you just need a way to hook the sensor to your Pi’s GPIO. You could solder straight to the top of the Enviro pHAT, or use a Black HAT Hacker, or to the bottom of the Pi. It depends what you feel comfortable with, and how compact you want your setup.

1 Like

I soldered extra bits to the pins. Be cool if the next revision had a small prototype area with extra pin outs for SPI and I2C.

Thanks looks like I’m going to have to practice my soldiering skills is there a new enviro version in the pipeline ?

not at the minute, no… mk2 is a fair way away I expect.

If you can afford the minimal extra footprint I would go with a mini-black hacker, it will give you room to grow - or at least, room to experiment until you got everything working as you wish.

1 Like

Do you think it would be possible to connect a dht22 to the analogy pins and the 5v pin and how do you get temp and humidity from one wire?

definitely not going to work from an analog pin… you need an (unused) GPIO direct off the Pi.

for 1-wire you need both to configure the Pi to implement the interface on a specific pin, as well as have a library to do the reading… I’ve used Adafruit’s one in the past but there are likely alternatives.

… will check if I can write up a summary later.

actually, the Adafruit library does not require a dt overlay, seems to do some magic by itself… so you can just grab https://github.com/adafruit/Adafruit_Python_DHT and follow the instruction on how to install.

Once done, using their provided example, run something like:

AdafruitDHT 11 17

the first number is the sensor type (DHT11), the second the pin it is attached to (can be anything practical for you that does not conflict with something else in your setup).

… hope that helps!