Home Assistant and ESP32 PLC: A comprehensive guide

How to configure ESPHome in an Industrial Shields PLC to interact with Home Assistant
July 5, 2024 by
Home Assistant and ESP32 PLC: A comprehensive guide
Boot & Work Corp. S.L., Frances Nosàs Moliner

In the fast-paced world of industrial automation, leveraging advanced technologies is crucial for staying ahead. The combination of ESP32 PLC and Home Assistant brings a powerful and flexible solution that enhances efficiency and control in industrial settings.


Home Assistant is an open-source home automation platform that centralizes control of various smart home devices like lights, thermostats, and cameras. It supports extensive customization, enabling users to set up complex automations. It provides a user-friendly interface accessible via web browsers, which can be accessed from the local network.

The platform is supported by a robust community, which contributes plugins and add-ons for expanded functionalities. One of those recent integrations has been Ethernet support for ESPHome. In this blog, we'll configure an ESP32 PLC, connect it to the network and make it accessible by the Home Assistant server via Ethernet.


Configuring ESPHome and Home Assistant

Setting up Home Assistant with ESP32 involves several key steps to ensure a smooth integration, especially when configuring the Ethernet connection for enhanced reliability and security.


1. Set up Home Assistant ESP32

It'd be fair to assume readers of this article might already have a Home Assistant server set up. If that's not the case, you might want to check the official documentation in the following link:

Installation - Home Assistant

After a regular installation, we should now be able to access the Home Assistant dashboard from a computer connected to the same network. We can check it on google chrome (recommended) in the following url: http://homeassistant.local:8123/.

It is generally recommended to connect devices to a Home Assistant server using Ethernet rather than WiFi for better reliability and security.  This setup is crucial for effective ESP32 Home Assistant integration.


2. Install ESP32 Home Automation

We must download the ESPHome addon from the Add-on Store, available on the Settings menu of the dashboard. This step is essential for managing ESP32 programming and ensuring a smooth ESP32 PLC tutorial experience.


After it's installed, we'll turn it on.

ESPHome Add-On dashboard

3. Add new device

If we access the ESPHome dashboard, we will see it's empty. 

We are going to add new devices. This will ask for a device name and the model of Espressif board. We will select ESP32 and skip the next step.


ESPHome dashboard new deviceCreate configuration 12 IOs device


After this short process the offline device will be shown on the dashboard with the default configuration.


ESPHome new device


4. ESP32 configuration file

The default configuration given by ESPHome is not complete. It mostly just attempts to connect the board to WiFi instead of Ethernet.

We will edit the yaml file to give an Ethernet address to the PLC. Note that Ethernet can't be used at the same time as the WiFi module of the ESP32. For this we will need to delete both "wifi" and "captive_portal" sections and replace it with the following code.

This configuration is tailored for the 14IOs PLC. For other IS PLC models, the following configuration must be applied:

  • ESP32 PLC family:   cs_pin: GPIO15
  • 10IOs PLC:                cs_pin: GPIO33
ethernet:
  type: W5500
  clk_pin: GPIO18
  mosi_pin: GPIO23
  miso_pin: GPIO19
  cs_pin: GPIO14

# Optional manual IP
manual_ip:
  static_ip: 10.10.10.20
  gateway: 10.10.10.1
  subnet: 255.255.255.0

Ensure the "manual_ip" field matches your network specifications. This configuration is vital for effective ESP32 industrial automation and creating a reliable ESP32 web server.


5. Install configuration file

To install the configuration file, click at the three dots on the device block. Select "Install".

There will be several options for the installation, depending on where the device is plugged. If the device is directly connected to the Home Assistant server, the option "Plug into the computer running ESPHome Dashboard" will be the most efficient and quick. 


ESPHome device installation

Otherwise, if the device is connected to the same computer the web browser is running on, you'll want the option "Plug into this computer". This will download the device configuration on a compressed .bin file and will ask of you to use the Official ESPHome dashboard installer for the rest of the process.
ESPHome Web requires a browser that supports WebSerial. Open this website on Google Chrome or Microsoft Edge, or you won't be able to continue.
Once there, click "connect", select the port where the device is connected and upload the downloaded configuration file.


ESPHome website


Boost Your Automation Efficiency with Home Assistant and ESP32 PLC

Integrating Home Assistant with Industrial Shields' ESP32 PLC provides a comprehensive solution for both industrial and home automation needs. Setting up an ESP32 web server enables efficient remote control, which is crucial for ESP32 Home Automation and various industrial applications. Leveraging Arduino ESP32 PLC allows for easy and customizable programming, supported by detailed ESP32 PLC tutorials. This setup enhances operational efficiency through centralized management in Home Assistant (ESP32 Home Assistant integration), offering flexible ESP32 Wi-Fi setup options with both Ethernet and Wi-Fi, vital for ESP32 industrial automation and advanced ESP32 programming​.

​Search in our Blog

Home Assistant and ESP32 PLC: A comprehensive guide
Boot & Work Corp. S.L., Frances Nosàs Moliner July 5, 2024
Share this post

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.


Industrial PLC comparison >>>