Skip to content

ESPHome Case Guide

This tutorial will show you how to add the Crowpanel Advance ESP32 HMI Display to ESPHome and how to remotely control a light bulb's on/off state through the ESPHome platform.

img

img

First, we need to prepare: a Raspberry Pi; a 64GB SD card; a Crowpanel Advance ESP32 HMI Display; a four-wire interface light bulb; and DuPont wires.

Download HomeAssitant


Open the official website of HomeAssitant:https://www.home-assistant.io/

img

Select a Raspberry Pi and install the Home Assistant system according to this installation guide.

img

After the installation is complete, insert the SD card with the Home Assistant system into the Raspberry Pi and connect the Ethernet cable.

Note: Make sure that the Wi-Fi network your Crowpanel Advance ESP32 HMI Display will connect to is on the same local area network (LAN) as the Raspberry Pi.

The following devices need to be on the same LAN: ① Your computer ② Crowpanel Advance ESP32 HMI Display ③ Raspberry Pi with the Home Assistant system

Note: The Raspberry Pi must be connected to a screen to view information. Once everything is ready, power on the Raspberry Pi and wait for it to load. The screen will display the following image.

img

Remember the IP address and the Home Assistant URL.

In my case, the IP address is: 192.168.2.110 So I enter 192.168.2.110:8123 in the browser.

img

Next, start configuring the Home Assistant system.

You can either manually set your location or allow it to be detected automatically.

img

By default, click 'Next'.

img

You can either add smart devices now or click Finish to add them later. Here, we will add the devices later.

img

Add ESPHome


This will bring you to the main interface of Home Assistant.

img

Click on the username and enable "Advanced Mode."

img

Click on "Settings" and then "Add-ons."

img

Click on "ADD-ON STORE" and type ESPHome to install it.

img

img

The installation is in progress, as shown in the image.

img

img

Once the installation is complete, we can start adding devices. Click on + New Device -> Continue.

img

img

Enter a name and click Next.

img

Here, do not check "Use recommended settings." Select the main chip of the Crowpanel Advance ESP32 HMI Display, ESP32-S3.

img

Next, choose any option (since we will replace it in the code later).

img

Here, click "SKIP".

img

Then, return to the main interface, find the Advance_HMI_43_LED you just created, click "EDIT", and enter the code editor.

img

This code is automatically generated based on the previous steps. Next, we will make replacements in it, which will help optimize the code for more efficient operation.

img

Next, you can replace the relevant content in esphome and ESP32 as needed.

img

img

Remember to replace your own Wi-Fi name and password.

Once the code replacement is complete, click "INSTALL" in the top right corner.

img

Select "Manual download".

img

Wait for a few minutes until the installation is complete. Then, select "Factory format".

img

Once the download is complete, you will see the .bin file.

img

Remember the path of this .bin file. Open the following website: https://web.esphome.io/?dashboard_wizard Next, we will flash this .bin file into the Crowpanel Advance ESP32 HMI Display.

Connect the Crowpanel Advance ESP32 HMI Display to your computer. Click "Connect", select the COM port, and connect it.

img

img

After connecting the Crowpanel Advance ESP32 HMI Display, click "Install".

img

Add the .bin file you just downloaded, then click "Install".

img

img

img

Wait for a few minutes.

img After the installation is complete, click "Close".

img

After successfully flashing the .bin file, return to the ESPHome page in Home Assistant. Restart the ESP32 display, and you should see the device you created earlier show as ONLINE in the top right corner.

img

Now we can start writing a program to control the smart home. Here, I'll use the example of remotely turning on a light. Click "EDIT" to start writing the code.

img

Please go ahead and add the following code at the end of the script.

img

Here, GPIO19 corresponds to the UART1-OUT of the Crowpanel Advance ESP32 HMI Display that you have connected.

img

For the 7.0-inch, 5.0-inch, and 4.3-inch products, the required pin is GPIO19. For the 3.5-inch, 2.8-inch, and 2.4-inch products, the required pin is GPIO18.

After editing the program, click "Install" and select "Wireless". This method is very convenient for us.

img

img

After a successful flash, the following interface will appear.

imgScroll the mouse wheel to view the IP address of the Crowpanel Advance ESP32 HMI Display and make sure to remember it.

img

Add the device to ESPHome

Click SettingsDevices & ServicesAdd Integration, then enter 'ESPHome' and click on it.

img

img

img

Enter the IP address (which you need to remember). The 'port' is automatically generated.

img

Then, we can see the device we just added. Click on "x entities" to view the available features on the device. x represents the number of entities, such as 2 entities shown below.

img

img

img

After opening and viewing the features, you should see the LED switch that we designed in the code.

img

Click on it, and you'll be able to successfully control the light bulb connected to the Crowpanel Advance ESP32 HMI Display.

img

img

img

img