HW-622 Board Setup - Single relay, single input (opto isolated) ESP8266 ESP-12F ($3.80AUD)

Hi folks,
I am new to ESPHome and could not find anything on these boards. They seem pretty cheap and have a relay and opto-isolated input which is what I wanted. Was tricky for a new guy to work i out so thought I’d post here while it was fresh.
(Schematics and discussion about the board Blynking an IoT Yunshan ESP8266 250V 10A AC/DC WIFI Network Relay Module | µC eXperiment)

Hope this is of use to someone. I also have a 4 relay board that I’ll do a similar post on.

I bought mint (HW-622) here ~$4 AUD : [DC 5V-26V ESP8266 ESP-12F Wireless Wifi Relay Module 220V 10A Relay Module ESP12F 802.11b/g/n 2.4GHz 12V 24V]((DC 5V 26V ESP8266 ESP 12F Wireless Wifi Relay Module 220V 10A Relay Module ESP12F 802.11b/g/n 2.4GHz 12V 24V|Relays| - AliExpress)

To flash from HomeESP use this connection:


and it should appear in ESPHome.

Once it was in ESP Home, I then edited the config for it in ESPHome and reflashed it using this config:
image

esphome:
  name: relaysingle2

esp8266:
  board: esp12e

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "83x2bxxxxxxxx87xxxxxx8"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.0.142
    gateway: 192.168.0.254
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Relaysingle Fallback Hotspot"
    password: "4tVxxxxxxxxtSf"

captive_portal:

# Use the blue LED in the device as a status LED, which will blink if there are warnings (slow) or errors (fast)
status_led:
  pin:
    number: GPIO2
    inverted: True

# One  relay outputs, exposed as switches in Home Assistant
switch:
  - platform: gpio
    pin: GPIO4
    name: "relaysingle2_relay"
    id: relay1

# One sensor input
binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO5
      mode:
        input: true
        pullup: true
    name: "relaysingle2_switch"
    device_class: door
type or paste code here

Then remove the “boot” jumper and serial cable
Add the device IP to ESPHome (I use fixed IP’s)

Next, for me, I connected the external ground to the ESP ground pin and so could see the sensor input working in Home assistant.

3 Likes

Thanks a great deal for this Andrew, I had spent so much time looking for information on this board and it wasn’t until I searched HW-622 that I found your post.

Much appreciated,
Thierry

1 Like

This is great and super helpful … But one detail below

The grounding of the reset pin is risky. On some of the ones I have the RST is strapped directly to VCC with a wide trace under the ESP module. So grounding reset will create a short and may destroy F1, a 1A diode. I would skip the reset grounding to be safe.

1 Like

I would like to point out that the “Reset Pin” can be used as 3v3 VCC, so you can power the thing entirely from the UART module.
The downside to this is that the UART doesn’t have enough power to also trigger the relay and can only power the relay’s red LED.

Thank you @Andrew123. this is a brilliant post and helped me worked through the lack of information with this board.

I have my board up and running and I’ll definitely be using more of them around my home.

Keep up the great work, Take care

Duncan

1 Like

For anyone else that might stumble upon this thread, @Andrew123 did a solid job in describing the initial setup (including jumping the GND/Reset pins, I wasn’t able to get it working without that)

If you’re using a CP2102 USB to Serial converter like I have, I had to flip my TX/RX wires (as shown below) to get the board to flash correctly.

1 Like

Thanks Andrew123 for your post. I have flashed it correctly, I will also try to connect an OLED display and a temp sensor to turn it into a thermostat.

During flashing I was getting an error like

Failed to connect to ESP8266: Invalid head of packet (0x00): Possible serial noise or corruption.

But I discovered it was due to the fact I only connected TX/RX and not the ground pin to the programmer.