|
| 1 | +--- |
| 2 | +layout: page |
| 3 | +title: "Enviro pHAT" |
| 4 | +description: "Instructions how to integrate the Enviro pHAT within Home Assistant." |
| 5 | +date: 2017-05-03 17:00 |
| 6 | +sidebar: true |
| 7 | +comments: false |
| 8 | +sharing: true |
| 9 | +footer: true |
| 10 | +logo: raspberry-pi.png |
| 11 | +ha_category: Sensor |
| 12 | +ha_iot_class: "Local Polling" |
| 13 | +ha_release: 0.44 |
| 14 | +--- |
| 15 | + |
| 16 | +The `envirophat` sensor platform allows you to display information collected by an [Enviro pHAT](https://shop.pimoroni.com/products/enviro-phat) add-on board for the Raspberry Pi. The board featues a wide range of sensors, such as: |
| 17 | + |
| 18 | +- BMP280 temperature/pressure sensor |
| 19 | +- TCS3472 light and RGB colour sensor with two LEDs for illumination |
| 20 | +- LSM303D accelerometer/magnetometer sensor |
| 21 | +- ADS1015 4-channel 3.3v, analog to digital sensor (ADC) |
| 22 | + |
| 23 | +To add this platform to your installation, add the following to your `configuration.yaml` file: |
| 24 | + |
| 25 | +```yaml |
| 26 | +# Example configuration.yaml entry, |
| 27 | +# which is equivalent to the default setup |
| 28 | +sensor: |
| 29 | + - platform: envirophat |
| 30 | + use_led: false |
| 31 | + display_options: |
| 32 | + - temperature |
| 33 | + - pressure |
| 34 | + - light |
| 35 | + - light_red |
| 36 | + - light_green |
| 37 | + - light_blue |
| 38 | + - accelerometer_x |
| 39 | + - accelerometer_y |
| 40 | + - accelerometer_z |
| 41 | + - magnetometer_x |
| 42 | + - magnetometer_y |
| 43 | + - magnetometer_z |
| 44 | + - voltage_0 |
| 45 | + - voltage_1 |
| 46 | + - voltage_2 |
| 47 | + - voltage_3 |
| 48 | +``` |
| 49 | +
|
| 50 | +Configuration variables: |
| 51 | +
|
| 52 | +- **display_options** (*Optional*) array: List of readings to monitor. Default is monitoring all of them: |
| 53 | + - **temperature**: ambient temperature in Celsius. Since the sensor is close to the Raspberry Pi, that migth affect the accuracy of the reading (ie. the Pi might heat up the sensor) |
| 54 | + - **pressure**: atmospheric pressure in hPa. |
| 55 | + - **light**: ambient light, as an integer in the 0-65535 range |
| 56 | + - **light_red**: red color reading scaled to the ambient light, as an integer in the 0-255 range |
| 57 | + - **light_green**: green color reading scaled to the ambient light, as an integer in the 0-255 range |
| 58 | + - **light_blue**: blue color reading scaled to the ambient light, as an integer in the 0-255 range |
| 59 | + - **accelerometer_x**: accelerometer reading in units of G, along the X axis |
| 60 | + - **accelerometer_y**: accelerometer reading in units of G, along the Y axis |
| 61 | + - **accelerometer_z**: accelerometer reading in units of G, along the Z axis |
| 62 | + - **magnetometer_x**: magnetometer reading, the X component of the raw vector |
| 63 | + - **magnetometer_y**: magnetometer reading, the Y component of the raw vector |
| 64 | + - **magnetometer_z**: magnetometer reading, the X component of the raw vector |
| 65 | + - **voltage_0**: voltage reading on Analog In 0 in units of V |
| 66 | + - **voltage_1**: voltage reading on Analog In 1 in units of V |
| 67 | + - **voltage_2**: voltage reading on Analog In 2 in units of V |
| 68 | + - **voltage_3**: voltage reading on Analog In 3 in units of V |
| 69 | +- **use_led** (*Optional*) True / False boolean; Default value is False, declaring that the onboard LEDs are *not* used for the color measurements thus these readings are based on the ambient light. If the value is set to True, the onboard LEDs will blink whenever a reading is taken. |
| 70 | +
|
| 71 | +### Notes |
| 72 | +
|
| 73 | +* **X, Y, Z axes** |
| 74 | + * X is parallel with the long edge of the board |
| 75 | + * Y is parallel with the short edge of the board |
| 76 | + * Z is perpendicular to the board |
| 77 | +* **Voltages** |
| 78 | + * voltage readings are done in the 0-3.3V range, please do not connect higher voltages than that! See the [Enviro pHAT's getting started guide](https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-enviro-phat) regarding how to make a voltage divider |
| 79 | +
|
| 80 | +### Give the values friendly names & icons |
| 81 | +
|
| 82 | +Add something like the following to your [customize section](/docs/configuration/customizing-devices/): |
| 83 | +
|
| 84 | +```yaml |
| 85 | +# Example configuration.yaml entry |
| 86 | + customize: |
| 87 | + sensor.accelerometer_z: |
| 88 | + icon: mdi:airplane-landing |
| 89 | + friendly_name: "Acc Z" |
| 90 | + sensor.magnetometer_x: |
| 91 | + icon: mdi:arrow-up-bold-hexagon-outline |
| 92 | + friendly_name: "Magnetic X" |
| 93 | + sensor.pressure: |
| 94 | + icon: mdi:weight |
| 95 | + friendly_name: "Pressure" |
| 96 | +``` |
| 97 | +
|
| 98 | +### Create groups |
| 99 | +
|
| 100 | +```yaml |
| 101 | +# Example configuration.yaml entry |
| 102 | +group: |
| 103 | + enviro_phat_voltages: |
| 104 | + name: Enviro pHAT Volages` |
| 105 | + entities: |
| 106 | + - sensor.voltage_0 |
| 107 | + - sensor.voltage_1 |
| 108 | + - sensor.voltage_2 |
| 109 | + - sensor.voltage_3 |
| 110 | +``` |
| 111 | +
|
| 112 | +### Enabling the required `i2c-1` device |
| 113 | + |
| 114 | +Since the Enviro pHAT communicates over I2C, you might also need to make sure that the I2C devices are enabled, by adding or uncommenting the following line in `/boot/config.txt` (see the [DT Parameters section](https://www.raspberrypi.org/documentation/configuration/device-tree.md) in the Raspberry Pi documentation): |
| 115 | + |
| 116 | +``` |
| 117 | +dtparam=i2c_arm=on |
| 118 | +``` |
0 commit comments