Home Assistant Switch for 8 Relays: PCF8574 can be used to extend the GPIO of ESP8266/32 and here we use 8 ports of PCF8574 to control 8 Relay module
GitHub: debsahu/PCF8574_8Relay
Home Assistant Switch for 8 Relays
- Code can compile on ESP8266/32
- PCF8574 can be used to extend the GPIO of ESP8266/32
- 8 ports of PCF8574 is connected to 8 Relay module
Libraries Needed
platformio.ini is included, use PlatformIO and it will take care of installing the following libraries.
Library | Link |
---|---|
MQTT | https://github.com/256dpi/arduino-mqtt |
ArduinoJson v6 | https://github.com/bblanchon/ArduinoJson |
WiFiManager Develop | https://github.com/tzapu/WiFiManager/archive/development.zip |
PCF8574 Library | https://github.com/xreef/PCF8574_library |
Arduino WebSockets | https://github.com/Links2004/arduinoWebSockets |
UpdateUploadServer (ESP8266) | https://github.com/debsahu/DDUpdateUploadServer |
Hardware
Items
- ESP8266 (aliexpress) / ESP32 (aliexpress)
- 3.3V to 5V converter (aliexpress)
- PCF8574AP (aliexpress)
- 8-port relay (aliexpress)
- Plastic Box (amazon)
- AC plug socket (aliexpress)
- 3-pin AC cable (aliexpress)
- 2 sockets (Home Depot)
Instructions
- Break the tab on the sides with brass screws
- Connect each of the brass screws to Normally Open (N/O) on relay
- Use PCF8574AP (exact version used here)
- Use 3.3V to 5V level shifters for ESP8266 I2C data
- Set A0, A1, A2 to GND so I2C address is 0x20
- Use 5V as VCC on PCF8574AP
- Use a good 110V AC to 5V DC device like a phone charger