# Enviro phat adding sensors

**URL:** https://forums.pimoroni.com/t/enviro-phat-adding-sensors/3735
**Category:** Support
**Created:** [January 8, 2017, 1:18am UTC](https://forums.pimoroni.com/t/enviro-phat-adding-sensors/3735 "2017-01-08T01:18:17Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Duju](https://avatars.discourse-cdn.com/v4/letter/d/c77e96/32.png) [@Duju](https://forums.pimoroni.com/u/Duju)
#### Post date: [January 8, 2017, 1:18am UTC](https://forums.pimoroni.com/t/enviro-phat-adding-sensors/3735/1 "2017-01-08T01:18:17Z")

</div>

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

---

<div class="post-metadata">

### Author: ![gadgetoid](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/gadgetoid/32/13_2.png) [@gadgetoid](https://forums.pimoroni.com/u/gadgetoid)
#### Post date: [January 8, 2017, 11:01am UTC](https://forums.pimoroni.com/t/enviro-phat-adding-sensors/3735/2 "2017-01-08T11:01:45Z")

</div>

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](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](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](http://pinout.xyz/pinout/enviro_phat)), so you’ll need to set it up in `/boot/config.txt` like so:

```auto
dtoverlay=w1-gpio,gpiopin=x

```

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.

---

<div class="post-metadata">

### Author: ![Richard](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/richard/32/508_2.png) [@Richard](https://forums.pimoroni.com/u/Richard)
#### Post date: [January 8, 2017, 5:43pm UTC](https://forums.pimoroni.com/t/enviro-phat-adding-sensors/3735/3 "2017-01-08T17:43:31Z")

</div>

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.

 ![](https://us1.discourse-cdn.com/flex016/uploads/pimoroni/original/2X/c/c78bcb3c52abdbaae02e4ef1b23f0c4d2aa8579a.jpg)

---

<div class="post-metadata">

### Author: ![Duju](https://avatars.discourse-cdn.com/v4/letter/d/c77e96/32.png) [@Duju](https://forums.pimoroni.com/u/Duju)
#### Post date: [January 9, 2017, 11:04am UTC](https://forums.pimoroni.com/t/enviro-phat-adding-sensors/3735/4 "2017-01-09T11:04:22Z")

</div>

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

---

<div class="post-metadata">

### Author: ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)
#### Post date: [January 9, 2017, 11:41am UTC](https://forums.pimoroni.com/t/enviro-phat-adding-sensors/3735/5 "2017-01-09T11:41:24Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Duju](https://avatars.discourse-cdn.com/v4/letter/d/c77e96/32.png) [@Duju](https://forums.pimoroni.com/u/Duju)
#### Post date: [January 10, 2017, 3:44pm UTC](https://forums.pimoroni.com/t/enviro-phat-adding-sensors/3735/6 "2017-01-10T15:44:50Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)
#### Post date: [January 10, 2017, 3:48pm UTC](https://forums.pimoroni.com/t/enviro-phat-adding-sensors/3735/7 "2017-01-10T15:48:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![RogueM](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/roguem/32/311_2.png) [@RogueM](https://forums.pimoroni.com/u/RogueM)
#### Post date: [January 10, 2017, 4:57pm UTC](https://forums.pimoroni.com/t/enviro-phat-adding-sensors/3735/8 "2017-01-10T16:57:03Z")

</div>

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](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!
