Newbie with relay issue

Hey, i bought this,

With the idea of controlling it with homeassistant ESP Home.

My previous experience with ESPhome and haos is the ratgdo. I plugged it into the computer and used the esphome dashboard to flash it and then it was picked up in homeassistant.

So let me know what I have to do to get this thing flashed or other alternatives. I was going to use it with my garage heater to control a larger 240 relay and only allow it to be powered when the garage door is close. Thie kids have a habit of leaving it open and I don’t want to accidentally be heating the outside.

I am open to other solutions if this one was stupid.

Here is a simple yaml for a relay on an ESP12.

NOTE: Your listing doesn’t appear to have a data sheet or schematic, so I am not sure what pin your GPIO is on. The same needs to be said about whether it is inverted or not.

Lastly, that USB looks like it may be power only - I can’t see a USB to serial bridge on that board. You may need to provide your own to flash.

esphome:
  name: relay
  friendly_name: Relay

esp8266:
  board: esp12e

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "0a00496fd351ad507a59cbf6f8eecec9"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

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

captive_portal:

switch:
  - platform: gpio
    pin: 00
    name: "Relay Switch"
    id: relay_switch
    inverted: true # only required on some relays
1 Like

So something like this?

Also, this is a closeup of the board. I’m assuming I just match up the pins from the serial adapter to the pins on the board and will need to solder them in place.

Is that the pinout you were referring to or is there something else? Like we don’t know which gpio pin actuates the relay?

It only allowed me to attach one image

I assume you got some header pins with the board? You solder them on to the board, use the jumper cables to connect. RX connects to TX and vice-versa, the rest as labeled.

Only use the 5V or 3.3V connector, not both. Personally I would put a header pin on the 3.3V and use that rather than the 5V.

Once it has been programmed the first time you can remove the USB-TTL adapter, any further programming can be done via wifi.

ALSO: ensure that all 110V/240V connections are removed when programming with the adapter. Power the board with the micro USB connector.

It looks like on the board 5v will be in that lower breakout of pins. I could use any 3.3 header correct? It looks like there are 2. I will solder the headers onto the board and give it a shot.

Correct - any 3.3V pin should work.

Thanks, I will let you know how it goes.

Confused now. I was able to get it to flash. Did it through the esphome dashboard. Had the reversed tx/rx pins, and had to jump IO0 to ground to get it to recognize and flash. I guess that is probably the programming mode.

When i reset, taking the jumper off, it stays with just one solid red and never connects to wifi. No fallback AP either. Can’t read logs off of it. Seems like the board is just dead.

I tried both your yaml, and the one that HA generated on it’s own but the only difference was in the board type. Instead of 12e, it was esp01_1. Neither worked. Is there something i’m missing?

Were there logs displayed via the serial connection after you flashed it?

Leave it plugged in after flashing and there should be logs, showing if it connected to the wifi network etc. Post them here.

That’s just the default ESP8266 chip. ESP01 has 1MB of memory, ESP12 has 4MB. If all you are going to do with the device is toggle a relay then shouldn’t make a difference

No logs displayed at all. Now I was trying to flash it again to see if leaving it plugged in would let it connect like you said but now it times out and can’t initialize the flash. Possible i got a dud? Can these be factory reset or wiped externally without flashing?

Are you running ESPHome as an add-on, or some other way? Is the board connected to the device running ESPHome.

It’s extremely hard to break these, pushing the flash button (shorting GPIO0) should always put them in flashing mode.

I’m running esphome as the addon. I also tried installing manually by using the web dashboard and a bin compiled from the addon but it still won’t connect. I’m going to check my jumper wires to see if those somehow went bad.

When i flashed before i jumped it to put it in flash mode. Jumper on the pins. When i pushed the button like it says, that did nothing. Is it possible i screwed something up that way?

No - the button does the same thing…

It’s possible it has a power issue. Maybe try powering via one of the other options - like the DC 7-12V I see on the left?

Otherwise, can’t think of anything.

BTW once the upload starts you can remove the jumper and the board should reboot once flashed - but I assume you are not even getting that far now.

yeah, definitely not getting that far. i was unplugging, removing the jumper, then repowering and it wasn’t showing any activity. It’s weird because i flashed it a bunch of times and it seemed to work flashing every time, completing to 100% but now just seems to be dead. Still gets power but no activity.

Hi

In my experience some of the USB uart programmers don’t have the power. I would plug in a usb power supply via the micro usb port and just use Gnd, Tx and Rx and leave the 3.3v and 5v disconnected on the uart. You’ll still need to connect IO00 to GND.

Check your config for Wi-Fi details.

Andy

Well, got a new one in today, flashed like we had talked about, took a bit after rebooting and it did end up connecting to wireless and being recognized by esphome. Assing in the switch from your config file and I will be playing with the GPIO numbers to see what will actually trigger the relay. Thanks for your help.

I wonder what happened to the old one… It’s more likely an issue with the 3.3V power than anything with the ESP.

You could prove that by checking the 3.3V pins with a multimeter.