Home Assistant as growbox controller, using several different devices and sensors, connected via D1 Mini/ESP8266-12-e
- Install Home Assistant as container (for Core installation check the "core" branch out)
docker compose up -d
- Connect esp8266 to your PC using USB cable (buy one with serial converter integrated) and install ESPHome Device builder:
- https://esphome.io/guides/getting_started_command_line#bonus-esphome-device-builder
- https://esphome.io/guides/getting_started_hassio.html#installing-esphome-device-builder
- Install the ESPHome integration
homeassistant-configuration directory contains configuration for controlling USB relay board, using RESTful Binary Sensor.
To get it working, an API service must be started within raspbian OS and it allows you to install Home Assistant into a different host.
Link to the repo: usbAPI
If you don't want to use a USB relay board, you could use a WIFI relay board like this and thus you can skip all the steps related to USB-API relay board management.
Here's the example scripts.yaml file containing the scripts used for controlling relay board via API
Here's the example YAML for dashboard setup (cards and tiles)
D1 Mini - pinout
USB to serial converter
Denkovi USB 8 Channel - wiring
DEVICE | RPI4 |
---|---|
USB-B | USB |
Universal AC MAINS Dimmer - MPDMv4.1
used for controlling 5 fans (4 oscillating + 1 inline)
PWM board | ESP8266 |
---|---|
VCC | 3V3 |
GND | GND |
VCNT | GPIO15/D8 |
D1-MINI/ESP8266 sensors wiring
BME280 Temperature + Humidity + Pressure (i2c bus)
SENSOR | ESP8266 |
---|---|
VIN | 3V3 |
GND | GND |
SCK | SCL/GPIO5/D1 |
SDO | SDA/GPIO4/D2 |
SHT20 Temperature + Humidity (i2c bus)
SENSOR | ESP8266 |
---|---|
RED | 3V3 |
BLACK | GND |
GREEN | SDA/GPIO4/D2 |
YELLOW | SCL/GPIO5/D1 |
MH-Z19C NDIR (UART bus - 7pin terminal connection version)
SENSOR | ESP8266 |
---|---|
PIN4 VIN | 5V |
PIN3 GND | GND |
PIN5 RX | TX/GPIO1/D10 |
PIN6 TX | RX/GPIO3/D9 |
DEVICE | REQUIRED POWER SOURCES |
---|---|
Denkovi USB 8CH relay board | 12V 1A + 220V |
Esp8266 | 5V/3.3V 1A |
Raspberry Pi 4 | 5V 2A |
Raspberry Pi 4 Fan | 9V 1A |
Power sockets | 220V 16A (1,5mm2 cables) |
Take a look at 3D directory
References:
- Raspberry Pi 4 case (40mm fan) by John_Sinclair on Thingiverse
- 12V USB 8 Channel relay board by polysquare on Thingverse
- BME280 case by leptitnicolas on Thingverse
- Arduino nano + 2 channel arduino relay + voltage stepdown box by flying_ginger on Thingverse. Used for housing ESP8266 (by making a drawer/slot manually since screw holes aren't available on the board), MH-Z19, cables and as attach surface for placing BME280 externally.