0

members

Easy Raspberry basics: Project 29f Raspberry PI 3 model B board, ESP32 Development board - Using ESPhome

of Acoptex.com in Raspberry Pi 3

Raspberry basics: Project 29f

Project name: Raspberry PI 3 model B board, ESP32 Development board - Using ESPhome addon in Home Assistant

Tags: Raspberry, Raspberry PI 3 model B board, vers 1.1, v 1.1, Home assistant, ESPhome addon, how to use ESPhome in Home Assistant, SP32 Dev Module, ESP32 development board, ESP32 Development board with WiFi and Bluetooth, ESP32-DevKitC V4 development board, ESP-WROOM-32 module with ESP32‑D0WDQ6 chip, Espressif Systems, ESP32-based development board, ESP32 modules, ESP32-WROOM-32, ESP32-WROOM-32U, ESP32-WROOM-32D, ESP32-SOLO-1, USB-UART bridge, IOT, ESP-WROOM-32 Dev Module, ESP32 DEVKITV1

Attachments: new_node.yaml

In this project, you needed these parts (Dear visitors. You can support our project buy clicking on the links of parts and buying them or donate us to keep this website alive. Thank you):

1.Raspberry PI 3 model B 1 pc

2. Micro SD card and SD card adapter 1 pc

3. Micro USB power supply (2.1 A, max 2.5 A) 1 pc

4. USB keyboard 1 pc

5. USB mouse 1 pc

6. TV or PC monitor 1 pc

7. HDMI cable 1 pc

8. ESP32 development board with WiFi and Bluetooth and USB A / micro USB B cable 1 pc

9. Jumper cables F-M

10. Resistor 2 pc (220 Ohm)

11. LED 2 pcs (green and red)

12. Breadboard 1 pc

General

We will learn how to add ESPhome addon, flash ESPhome firmware to ESP32 development board and use it in Home Assistant with Rasprberry Pi. 

ESPHome is the perfect solution for creating custom firmwares for your ESP8266/ESP32 boards. In this project we'll go through how to setup a basic node by use of the Hass.io add-on.

Understanding the ESPhome

ESPHome is a system to control your ESP8266/ESP32 by simple yet powerful configuration files and control them remotely through Home Automation systems.

ESPHome is a tool which reads in YAML configuration files (just like Home Assistant) and creates custom firmwares. The tool also has many helpers that simplify flashing devices and aims to make managing your ESP boards as simple as possible. Once you have added devices or sensors in ESPHome's configuration, they will even automatically show up in Home Assistant's UI.

Technically, all ESP8266/ESP32 devices are supported by ESPHome:

Sensor Components

Sensor Core, ADC, ADS1115, AM2320, APDS9960, BH1750, Binary Sensor Map, BLE RSSI, BME280, BME680, BMP085, BMP280, CCS811, CSE7766, CT Clamp, Dallas, DHT, DHT12, Duty Cycle, ESP32 Hall Sensor, HDC1080, HLW8012, HMC5883L, Home Assistant, HX711, INA219, INA3221, Integration, HTU21D, MAX31855, MAX6675, MH-Z19, MPU6050, MQTT Subscribe, MS5611, NTC Thermistor, PMSX003, Pulse Counter, Pulse Width, Resistance, Rotary Encoder, SDS011 Sensor, SHT3X-D, TCS34725, Template Sensor, Total Daily Energy, TSL2561, Ultrasonic Sensor, Uptime Sensor, WiFi Signal Strength, Xiaomi MiFlora, Xiaomi MiJia, Custom Sensor.

Binary Sensor Components

Binary Sensor Core, GPIO, Home Assistant, Status, ESP32 BLE Presence, ESP32 Touch Pad, MPR121 Capacitive Touch Sensor, Nextion Touch, Template Binary Sensor, PN532, RDM6300, TTP229, Custom Binary Sensor.

Output Components

Output Core, ESP8266 Software PWM, GPIO Output, ESP32 LEDC, PCA9685, MY9231/MY9291, Custom Output.

Light Components

Light Core, Binary Light, Monochromatic Light, Cold+Warm White Light, RGB Light, RGBW Light, RGBWW Light, FastLED Light, NeoPixelBus Light, Light Partition, Custom Light.

Switch Components

Switch Core, GPIO Switch, Restart Switch, Shutdown Switch, Generic Output Switch, Template Switch, UART Switch, Custom Switch.

Fan Components

Fan Core, Binary Fan, Speed Fan.

Display Components

Display Core, LCD Display, MAX7219, Nextion, SSD1306, Waveshare E-Paper.

Cover Components

Cover Core, Template Cover, Endstop Cover, Time-Based Cover, Custom Cover.

Text Sensor Components

Text Sensor Core, Home Assistant, MQTT Subscribe Text, Version, WiFi Info, Template Text Sensor, Custom Text Sensor.

Climate Components

Climate Core, Bang Bang Controller, Custom Climate, Coolix IR Remote, Tcl112 IR Remote.

Misc Components

Remote Receiver, Remote Transmitter, Status LED, Time, Sun, GPS, ESP32 BLE Tracker, ESP32 BLE Beacon, ESP32 Ethernet, ESP32 Camera, Stepper, Servo, PCF8574 I/O Expander, MCP23017 I/O Expander, Debug Component.

Additional Custom Components

Generic Custom Component, Custom I2C Component, Custom SPI Component, Custom UART Component.

You can find out more here.

Understanding the Home Assistant

You can read more about it here.

Understanding the ESP32 Development board with WiFi and Bluetooth

You can read more about it here.

There are a lot of different ESP32 development boards made. You can find more information about them here

Understanding the Raspberry PI 3 model B

The Raspberry Pi 3 is the third-generation Raspberry Pi. It replaced the Raspberry Pi 2 Model B in February 2016.

Specification:

  • Quad Core 1.2GHz Broadcom BCM2837 64bit CPU
  • 1GB RAM
  • BCM43438 wireless LAN and Bluetooth Low Energy (BLE) on board
  • 40-pin extended GPIO
  • 4 USB 2 ports
  • 4 Pole stereo output and composite video port
  • Full size HDMI
  • CSI camera port for connecting a Raspberry Pi camera
  • DSI display port for connecting a Raspberry Pi touchscreen display
  • Micro SD port for loading your operating system and storing data
  • Upgraded switched Micro USB power source up to 2.5A

Signals and connections of the Raspberry PI 3 model B


Signals and connections of the ESP32 Development board with WiFi and Bluetooth

You can find more information (datasheets, schematics, pins descriptions, functional desgn descriptions) about each board (made by Espresiff Systems) by pressing Getting started link close to each board here.

Let's check our development board - ESP32 DEVKITV1with ESP-WROOM-32 module from Espressif Systems:

Pinout diagram for the ESP Wroom 32 breakout:

ESP32-WROOM-32 - ESP32-WROOM-32 module soldered to the development board. Optionally ESP32-WROOM-32D, ESP32-WROOM-32U or ESP32-SOLO-1 module may be soldered instead of the ESP32-WROOM-32.

USB-UART Bridge - A single chip USB-UART bridge provides up to 3 Mbps transfers rates.

BOOT button - Download button: holding down the Bootbutton and pressing the EN button initiates the firmware download mode. Then user can download firmware through the serial port.

EN button - Reset button: pressing this button resets the system.

Micro USB Port - USB interface. It functions as the power supply for the board and the communication interface between PC and the ESP module.

TX0, TX2 - transmit pin. GPIO pin

RX0, RX2  - receive pin.  GPIO pin

3V3 (or 3V or 3.3V) - power supply pin (3-3.6V). 

GND - ground pin.

EN - Chip enable. Keep it on high (3.3V) for normal operation.

Vin - External power supply 5VDC.

Wiring

Step by Step instruction

We recommend using a high-performance SD card for increased stability as well as plugging your device into an external display to see the default application booting up.

We assume that you have Windows 7 64 bit OS installed on your PC and empty micro SD card 32 GB with SD card adapter.

Configuration file attched for your referencenew_node.yaml

1. Do wiring.

  1. Do wiring for ESP32 development board and breadboard.
  2. Plug in your ESP32 development board to the Raspberry Pi 3 board USB port.

2. Installing Hass.io

It was explained in Raspberry basics: Project 29a Raspberry PI 3 model B board - Home assistant for beginners

3. Adding ESPhome addon

  1. In Home Assistant go to Hass.io ->ADD-ON STORE.
  2. In the Repositories part (on top), type the https://github.com/esphome/hassio in the Add new repository by URL field.
  3. Click on ADD.
  4. After that, wait a bit until the add-on is installed.
  5. Go to the add-on page. Click on INSTALL.
  6. Start the add-on by clicking on START.
  7. Click on Open Web UI.
  8. You will be greeted by a nice introduction wizard which will step you through creating your first configuration.
  9. Click on plus in orange circle.
  10. The ESPHome setup wizard opens. It will guide you through setting up your first ESP8266 or ESP32-powered device using ESPHome. This wizard will create a basic YAML configuration file for your "node" (the microcontroller). Later, you will be able to customize this file and add some of ESPHome's many integrations.
  11. First, we need to give this node a name. Choose this name wisely, it should be unique among all your ESPs. Names must be lowercase and must not contain spaces (allowed characters: a-z, 0-9 and _). Let's name it - new_node. Click on CONTINUE button.
  12. Select a type of microcontroller board you're using so that the ESPhome can compile firmware for it. If unsure you can also select a similar board or choose the "Generic" option.
  13. We have selected Doit ESP32 devkit v1. Click on CONTINUE button.
  14. In next step you need to type the local WiFi network SSID and password (leave empty for no password) to be able to connect node to WiFi Access Point.
  15. ESPHome automatically sets up an Over-The-Air update server on the node so that you only need to flash a firmware via USB once. This password is also used to connect to the ESP from Home Assistant. Optionally, you can set a password for this upload process too. Click on CONTINUE button.
  16. You've successfully created your first ESPHome configuration file. 
  17. When you click on SUBMIT, the wizard will save a configuration file under /config/esphome/new_node.yaml
  18. If you have Configurator installed in Home Assistant skip installation notes. Go to Hass.io -> ADD-ON STORE  and select Configurator.
  19. Click on Install.
  20. Click on Start.
  21. Click on Open Web GUI.
  22. The configurator GUI opens. Go to Browse FileSystem.
  23. Go to config/esphome/ folder and find the new_node.yaml file.
  24. Open this file and modify with code. You need toconfigure manual_IP with your static_IP and gateway. After putting a manual IP in your configuration, the ESP will no longer need to negotiate a dynamic IP address with the router, thus improving the time until connection. This can help with Over-The-Air updates if for example the home network doesn't allow for .local addresses. When a manual IP is in your configuration, the OTA process will automatically choose that as the target for the upload. Add a simple GPIO switches (pin 5 and 4 = GPIO5 and GPIO4) to the configuration.
  25. Save your new_node.yaml file. Click on the diskette.
  26. Go to ESPhome, make sure that serial port selected.
  27. Click on UPLOAD to flash firmware. This compiles the firmware for your node and uploads it using any connected USB device or, if no USB devices are connected, over-the-air using the OTA Update ComponentPlease note that Hass.io Add-On is currently not capable of discovering new USB ports after the add-on has started due to some docker restrictions. Please go to the add-on details page and restart the add-on if a new USB device is not automatically found. If the USB device is still not found, try changing the USB cable and restarting the add-on.
  28. You need to hold the ESP32 on-board Boot button while uploading.
  29. Click on STOP as soon you will get the message: Client 'Home Assistant 0.95.4 (xxx.xxx.x.xxx)' connected successfully!
  30. Your node 
    Over-The-Air Updates: 192.168.1.240:8266
    Over-The-Air updates link is 192.168.1.240:8266 and API Server link 192.168.1.240:6053

  31. Press the ESP32 development board on-board EN button to reboot it. 
  32. Go to Configuration->Integrations.
  33. Click on plus in orange circle.

  34. You need to setup a new Integration. Select ESPhome.
  35. Type the host and port (in our case it is 192.168.1.240 and 6053). Click on SUBMIT.
  36. You will need to type or paste the password witch you have assigned before when made the node (you can see it in new_node.yaml file as API password).
  37. Click on SUBMIT and FINISH.
  38. Click on ADD AREA if you want to assign this module to any area in the house (Living room, bedroom...).
  39. You can check the new_node integration configuration.
  40. Go to Overview and click on dots.
  41. Select Configure UI.
  42. Click on plus.
  43. Click on Entities.
  44. Type the title, select entities (in our case we had switch.red_led_2 and switch.green_led_2 and click on SAVE.
  45. Click on x to go back to normal mode or EDIT to change the card.
  46. Congrats! You have successfully completed this project and can turn on/off the Red LED (GPIO5) and Green LED (GPIO4) with Home Assistant now.

Summary

We have learnt how to add ESPhome addon, flash ESPhome firmware to ESP32 development board and use it in Home Assistant with Rasprberry Pi. 

Libraries in use

  • None

Resources

  • See on the begining of this project


Other projects of Acoptex.com

« Go back to category
Is this project fake? Report it!   
Recommend to a friend
Published at 11-07-2019
Viewed: 601 times