logo elektroda
logo elektroda
X
logo elektroda

We are modifying the relay controller so that it works without a microcontroller – ESP8266 Relay V2.

p.kaczmarek2  2 84 Cool? (0)

TL;DR

  • The LC Technology ESP8266 Relay V2.3 is converted from a UART-controlled Wi-Fi bridge into a standalone, locally controlled Tasmota relay by removing its extra microcontroller.
  • Removing the UART jumpers enables ESP8266 flashing; the modification then routes an ESP GPIO through R5 to transistor Q1, which switches the relay coil.
  • The board runs from 12 V DC, while the relay-drive path uses R5, a 4.7 kΩ base resistor, and diode D3 to suppress coil switch-off spikes.
  • The modified relay responds from the Tasmota panel and its button, and Tasmota detects button-triggered state changes.
  • One of the two buttons may be lost because it was not connected to GPIO, and the reason for the original MCU remains unresolved.
AI summary based on the discussion. May contain errors.

Join me for a presentation on modifying the LC Technology ESP8266 Relay V2.3 controller so that it works locally with the Tasmota firmware. This will be a rather unusual modification, as, for some inexplicable reason, the manufacturer decided to use an additional microcontroller to control the relay. Is the ESP8266 capable of controlling the relay without an additional microcontroller? Let’s find out!

The device discussed here was sent in by a reader; it is exactly the same unit as the one featured in the Tasmota thread:
https://www.elektroda.pl/rtvforum/topic3760371.html#21922314
The reader was having trouble updating the firmware. After connecting the UART, the ESP failed to respond to communication attempts. The device was sent to me so that I could investigate the situation. A mysterious pair of jumpers immediately caught my eye.

Underneath the ESP8266 module is an additional microcontroller that communicates with the ESP via UART. But what for? Details of the protocol can be found on the Blakadder website; it seems fairly straightforward:
https://templates.blakadder.com/LC-ESP8266.html
But why make it so complicated? After all, Tasmota can control the ESP’s GPIO pins directly. For this reason, I decided on a different modification to Mr Blakadder’s, but more on that in a moment.
First off – a copy of the original setup. Once the jumpers connecting the ESP’s UART lines to the MCU have been removed, esptool starts up correctly straight away.
https://github.com/openshwprojects/FlashDumps/commit/ce13ed9575049e19c7a8c4a6f36283318770bfd4
I briefly analysed the extracted firmware. Here is some of the information I found:
- the firmware is 2 MB, but it is a 1:1 duplicate of a 1 MB image (MD5 sums match)
- it contains the factory-installed AT command firmware from Ai-Thinker / Espressif (Non-OS SDK 3.0 from 2020)
- the default UART speed is 115,200 baud (bootloader v1.7 transmits at 74,880 baud)
- the module sets up a SoftAP network named "AI-THINKER_XXXXXX" (IP 192.168.4.1) and supports SmartConfig (ESPTOUCH/AIRKISS)
- By default, the ESP8266 acts solely as a Wi-Fi bridge to the UART, transmitting hex frames to the second MCU

My idea was to remove the microcontroller and connect the ESP pins to a relay, a button and an LED, as described in the thread
ESP8266 and Tasmota – step-by-step Wi-Fi relay control . You can desolder the microcontroller using hot air, but it’s worth applying flux to the pins.

I know my hot air gun well enough that I didn’t need to protect the screw terminals or nearby components with tape. With the right nozzle and sufficient power, the component comes off quickly, the board doesn’t swell and the other components don’t burn.

Next, you need to make the jumpers. The ESP8266-01 only has a 2x4 connector, which carries power, ground, UART and a few GPIO pins, including GPIO0 for programming. You need to be careful with these pins; for example, you mustn’t short GPIO0 to ground during boot-up, as the module will enter flash mode instead of starting up normally.

This is how the relay connection turned out. The entire board requires a 12V DC power supply – this voltage powers the Songle relay coil directly, whilst the board features a 7805 regulator and a separate 3.3V LDO for the ESP8266. The ESP itself, with its 3.3V logic, cannot control the coil directly; therefore, I routed the control signal from the ESP pin via a single wire stripped from an Ethernet cable on the underside of the board to the base resistor R5 (4.7 kΩ, marked 472). This resistor limits the current from the ESP pin and drives transistor Q1 into saturation, connecting the relay coil to earth. Diode D3 is connected in parallel with the coil to suppress voltage spikes when the coil is switched off.

I disconnected the button and LED in a similar way. The button is shorted to ground, so it’s ideal for use with GPIO0, just as is done in IoT devices, so that pressing it when power is applied activates programming mode.

Finally, I protected the more sensitive areas with a UV-curable solder mask:

Final test – the relay control works, both from the Tasmota panel and via the button. Tasmota also detects state changes triggered by the button:



Settings:


To sum up, this was a modification of the relay module so that it could work with the open-source Tasmota software. It would have been possible to do this without soldering, by sending UART packets via the software so that the microcontroller would interpret them correctly and carry out the required operations, but I decided that this made no sense, as I already had the equipment and was keen to do some soldering. We’ve potentially lost one of the two buttons as a result of this modification, as I didn’t connect it to a GPIO pin, but I can’t see any use for it anyway and don’t consider it a loss, especially since… on the Blakadder website, the Tasmota script doesn’t even support reading the relay status from the MCU, so it would have been useless anyway – what’s the point of a button that won’t provide feedback to the Home Assistant interface? For this reason, I consider the modification a success, although I still don’t really know why the MCU is there in the first place – perhaps it’s a remnant from the 2- and 4-channel versions, where pins are already running out when using the ESP8266-01? But then again – no one said you have to use the ESP8266-01; you could use the TYWE3S or similar modules, which have more GPIO pins exposed. Interesting

About Author
p.kaczmarek2
p.kaczmarek2 wrote 14758 posts with rating 12885 , helped 659 times. Been with us since 2014 year.

Comments

%}