Serial MCU controlled relay/switch
Moderators: grovkillen, Stuntteam, TD-er
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Serial MCU controlled relay/switch
Look at the wiki for the Sonoff Touch.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Serial MCU controlled relay/switch
Sorry, I meant this one: https://www.letscontrolit.com/wiki/inde ... ff_DIY_1ch
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



-
- Normal user
- Posts: 32
- Joined: 12 Jun 2017, 11:12
Re: Serial MCU controlled relay/switch
Heyhey
Looking further : would I be able to use this to flash it? Looked at the above link, but don't have a 3.3 + GND on the print.
Would I be able to solder on the chip
https://docs.tuya.com/en/hardware/WiFi- ... e-mcu.html
pin 16/15 and 12 for comms and 8 and 9 to put 3.3V on it?
Kind regards
Steve
Looking further : would I be able to use this to flash it? Looked at the above link, but don't have a 3.3 + GND on the print.
Would I be able to solder on the chip
https://docs.tuya.com/en/hardware/WiFi- ... e-mcu.html
pin 16/15 and 12 for comms and 8 and 9 to put 3.3V on it?
Kind regards
Steve
-
- Normal user
- Posts: 32
- Joined: 12 Jun 2017, 11:12
Re: Serial MCU controlled relay/switch
and don't bother going any further, I just literally burned some of the traces... To be honest, crappy PCB
.
Still have a Sonoff Touch 2-gang to go with
Kind regards
Steve



Still have a Sonoff Touch 2-gang to go with
Kind regards
Steve
Re: Serial MCU controlled relay/switch
Hello,
I have a LCTech Relay X4 board. I installed ESPEasy on the ESP-01 (ESPEasy_1M_128kSPIFFS_PUYA.zip) and the first two relays are in function, but the last two relays are not contolled.
What can I do to use all four relays?
I would like to control with HTTP commands:
HTTP commands:
Relay 0 Off: http://ESP_IP/control?cmd=relay,0,0
Relay 0 On: http://ESP_IP/control?cmd=relay,0,1
Relay 1 Off: http://ESP_IP/control?cmd=relay,1,0
Relay 1 On: http://ESP_IP/control?cmd=relay,1,1
Relay 2 Off: http://ESP_IP/control?cmd=relay,2,0
Relay 2 On: http://ESP_IP/control?cmd=relay,2,1
Relay 3 Off: http://ESP_IP/control?cmd=relay,3,0
Relay 3 On: http://ESP_IP/control?cmd=relay,3,1
Who can help me?
Thanks
I have a LCTech Relay X4 board. I installed ESPEasy on the ESP-01 (ESPEasy_1M_128kSPIFFS_PUYA.zip) and the first two relays are in function, but the last two relays are not contolled.
What can I do to use all four relays?
I would like to control with HTTP commands:
HTTP commands:
Relay 0 Off: http://ESP_IP/control?cmd=relay,0,0
Relay 0 On: http://ESP_IP/control?cmd=relay,0,1
Relay 1 Off: http://ESP_IP/control?cmd=relay,1,0
Relay 1 On: http://ESP_IP/control?cmd=relay,1,1
Relay 2 Off: http://ESP_IP/control?cmd=relay,2,0
Relay 2 On: http://ESP_IP/control?cmd=relay,2,1
Relay 3 Off: http://ESP_IP/control?cmd=relay,3,0
Relay 3 On: http://ESP_IP/control?cmd=relay,3,1
Who can help me?
Thanks
Last edited by desprueht on 17 Jun 2018, 16:09, edited 1 time in total.
Re: Serial MCU controlled relay/switch
Hi,
I've never seen a 4 relay version, can you provide me the link or the datasheet, to find out what serial commands needed to operate it?
Re: Serial MCU controlled relay/switch
Hello,
Relay control instructions (hex hexadecimal):
Open the first relay: A0 01 01 A2
Turn off the first relay: A0 01 00 A1
Open the second relay: A0 02 01 A3
Close the second relay: A0 02 00 A2
Open the third relay: A0 03 01 A4
Turn off the third relay: A0 03 00 A3
Open the fourth relay: A0 04 01 A5
Turn off the fourth relay: A0 04 00 A4"
and the link:
http://www.chinalctech.com/index.php?_m ... &p_id=1288
Relay control instructions (hex hexadecimal):
Open the first relay: A0 01 01 A2
Turn off the first relay: A0 01 00 A1
Open the second relay: A0 02 01 A3
Close the second relay: A0 02 00 A2
Open the third relay: A0 03 01 A4
Turn off the third relay: A0 03 00 A3
Open the fourth relay: A0 04 01 A5
Turn off the fourth relay: A0 04 00 A4"
and the link:
http://www.chinalctech.com/index.php?_m ... &p_id=1288
-
- Normal user
- Posts: 32
- Joined: 12 Jun 2017, 11:12
Re: Serial MCU controlled relay/switch
Hi all
sorry is this is a stupid question, but will your firmware work with the Sonoff T1 2Gang (similar to the dual?). I both 2 and want to be able to control them using ESPEasy and Domoticz.
Kind regards
Steve
sorry is this is a stupid question, but will your firmware work with the Sonoff T1 2Gang (similar to the dual?). I both 2 and want to be able to control them using ESPEasy and Domoticz.
Kind regards
Steve
Re: Serial MCU controlled relay/switch
This plugin will not work with any Sonoff T1. According to Tasmota wiki:countcobolt wrote: ↑17 Jun 2018, 16:13 sorry is this is a stupid question, but will your firmware work with the Sonoff T1 2Gang (similar to the dual?). I both 2 and want to be able to control them using ESPEasy and Domoticz.
"When pushing a button, the touch chip lift the power high to the EFM8BB1, and the EFM8BB1 chip ties the signal line for each button low, for the full duration of the keypress. There is no serial data, that i have seen at all."
The device's operation is somewhat obscure to me, i am using my own T1 2Gang with Tasmota without problmes.

Re: Serial MCU controlled relay/switch
Ok the commands seems consistent, i expanded the plugin to support 4 relay, now it can be selected in plugin options.desprueht wrote: ↑17 Jun 2018, 15:53 Hello,
Relay control instructions (hex hexadecimal):
Open the first relay: A0 01 01 A2
Turn off the first relay: A0 01 00 A1
Open the second relay: A0 02 01 A3
Close the second relay: A0 02 00 A2
Open the third relay: A0 03 01 A4
Turn off the third relay: A0 03 00 A3
Open the fourth relay: A0 04 01 A5
Turn off the fourth relay: A0 04 00 A4"
and the link:
http://www.chinalctech.com/index.php?_m ... &p_id=1288
Last edited by enesbcs on 18 Jun 2018, 19:03, edited 1 time in total.
-
- Normal user
- Posts: 32
- Joined: 12 Jun 2017, 11:12
Re: Serial MCU controlled relay/switch
enesbcs wrote: ↑17 Jun 2018, 20:24This plugin will not work with any Sonoff T1. According to Tasmota wiki:countcobolt wrote: ↑17 Jun 2018, 16:13 sorry is this is a stupid question, but will your firmware work with the Sonoff T1 2Gang (similar to the dual?). I both 2 and want to be able to control them using ESPEasy and Domoticz.
"When pushing a button, the touch chip lift the power high to the EFM8BB1, and the EFM8BB1 chip ties the signal line for each button low, for the full duration of the keypress. There is no serial data, that i have seen at all."
The device's operation is somewhat obscure to me, i am using my own T1 2Gang with Tasmota without problmes.![]()
Hey Enesbcs
do you use the web or MQTT component for this? (On Tasmota)
Kind regards
Re: Serial MCU controlled relay/switch
Re: Serial MCU controlled relay/switch
Hi, thank you very much for your work.enesbcs wrote: ↑17 Jun 2018, 22:44Ok the commands seems consistent, i expanded the plugin to support 4 relay, now it can be selected in plugin options.desprueht wrote: ↑17 Jun 2018, 15:53 Hello,
Relay control instructions (hex hexadecimal):
Open the first relay: A0 01 01 A2
Turn off the first relay: A0 01 00 A1
Open the second relay: A0 02 01 A3
Close the second relay: A0 02 00 A2
Open the third relay: A0 03 01 A4
Turn off the third relay: A0 03 00 A3
Open the fourth relay: A0 04 01 A5
Turn off the fourth relay: A0 04 00 A4"
and the link:
http://www.chinalctech.com/index.php?_m ... &p_id=1288
Download and try: v23
I have a problem with the webinterface. when i click on Devices and add a Serial MCU controlled switch, then I can't edit the device. The ESP-01 makes a restart.
Re: Serial MCU controlled relay/switch
You're right... i left out one index, and ESP did not honor buffer overflow.

Try the updated binary.
Re: Serial MCU controlled relay/switch
It's so wunderfull. Thank you for all...enesbcs wrote: ↑18 Jun 2018, 19:05You're right... i left out one index, and ESP did not honor buffer overflow.
Try the updated binary.
Re: Serial MCU controlled relay/switch
Very new to all this so forgive me.
Had one of these laying around as it was useless in its original state. Managed to flash the firmware and get it working.
I wish to use it to control a garage opener that only requires a momentary switch. Is it possible to do that with this?
Have tried the pulse command but had a feeling it wound not work and I was correct.
At the moment I have a script setup in home assistant that turns the off after 1 second but find this is more like 2 or 3 seconds. The script is a very crude way to do what I want so was hoping for a better solution.
Had one of these laying around as it was useless in its original state. Managed to flash the firmware and get it working.
I wish to use it to control a garage opener that only requires a momentary switch. Is it possible to do that with this?
Have tried the pulse command but had a feeling it wound not work and I was correct.
At the moment I have a script setup in home assistant that turns the off after 1 second but find this is more like 2 or 3 seconds. The script is a very crude way to do what I want so was hoping for a better solution.
Re: Serial MCU controlled relay/switch
What device? This plugin supports some kind from Lctech, Tuya, S.Dual.. be a little more specific. I think it can be done with EspEasy rules.
Re: Serial MCU controlled relay/switch
I see. You have to enable rules in Espeasy advanced settings, then if the serial device name is "lc" and the first relay named as "Relay0" (default) then the code below switches off the relay one seconds after switched on. It has to work, if somehow not, then i will ty to implement it inside the plugin.
Code: Select all
on lc#Relay0>0 do
timerset,1,1
endon
on Rules#Timer=1 do
relay,0,0
endon
Re: Serial MCU controlled relay/switch
Will give it a go when I get home in an hour or so.enesbcs wrote: ↑05 Aug 2018, 09:52I see. You have to enable rules in Espeasy advanced settings, then if the serial device name is "lc" and the first relay named as "Relay0" (default) then the code below switches off the relay one seconds after switched on. It has to work, if somehow not, then i will ty to implement it inside the plugin.Code: Select all
on lc#Relay0>0 do timerset,1,1 endon on Rules#Timer=1 do relay,0,0 endon
Thanks heaps
Re: Serial MCU controlled relay/switch
Can't get it to work. Relay still just turns on or off as if there are no rules.
Will have a play with the rules and see if I can get something working tho
Will have a play with the rules and see if I can get something working tho
Re: Serial MCU controlled relay/switch
Check v2:
Code: Select all
on lc#Relay0 do
if [lc#Relay0]>0
timerset,1,1
endif
endon
on Rules#Timer=1 do
relay,0,0
endon
Code: Select all
on lc#Relay0 do
timerset,1,1
endon
on Rules#Timer=1 do
if [lc#Relay0]>0
relay,0,0
endif
endon
Re: Serial MCU controlled relay/switch
Will give V2 and v3 a try and watch the logs.
I assume the rules don't need to be enabled anywhere else in the settings to enable them? Just enable rules in advance settings then create the rule for them to work.
Thanks for for assistance and patience so far.
I assume the rules don't need to be enabled anywhere else in the settings to enable them? Just enable rules in advance settings then create the rule for them to work.
Thanks for for assistance and patience so far.
Re: Serial MCU controlled relay/switch
Update.
Managed to get it working with your first code. Appears sleep and reading instructions correctly kinda help.
I had my device named Relay and say you had it name lc. A simple change in name fixed it.
Sorry for the stuff up my end.
Thanks heap in helping me out here.
Is it possible to reduce the time to less than 1 second? I will have a read and see if I can find the answer myself but just in case I fail again.
fyi all 3 rules work and give the desired result
Managed to get it working with your first code. Appears sleep and reading instructions correctly kinda help.
I had my device named Relay and say you had it name lc. A simple change in name fixed it.
Sorry for the stuff up my end.
Thanks heap in helping me out here.
Is it possible to reduce the time to less than 1 second? I will have a read and see if I can find the answer myself but just in case I fail again.
fyi all 3 rules work and give the desired result
Re: Serial MCU controlled relay/switch
Great news, you are welcome.
In rules one second is the smallest interval as i know.
I think i can implement a new command in the plugin for example "relaypulse" for smaller intervals, but due to the characteristics and speed of the serial connection the results will not be as you expect. I have an LCTech relay somewhere hidden in my shelf, will try it and publish the plugin if it can handle it.
Re: Serial MCU controlled relay/switch
Thanks for the offer but no need to worry if it isn't currently supported. This is just a test device I had laying around while I learnt the ropes. Have ordered some sonoff low voltage boards to use as the garage control runs off 24V DC and this test board is a 12v board so I will be using a power pack while I test.
Thanks again for your help. It was very much appreciated.
Re: Serial MCU controlled relay/switch
Hi.
Anyone sucessfully used this on the "ESP8266 4CH 12V WiFi" found on aliexpress ?
https://www.aliexpress.com/wholesale?ca ... H+12V+WiFi+
Anyone sucessfully used this on the "ESP8266 4CH 12V WiFi" found on aliexpress ?
https://www.aliexpress.com/wholesale?ca ... H+12V+WiFi+
Re: Serial MCU controlled relay/switch
I do not own this model, but according to this description:oleost wrote: ↑22 Aug 2018, 21:12 Anyone sucessfully used this on the "ESP8266 4CH 12V WiFi" found on aliexpress ?
https://www.aliexpress.com/wholesale?ca ... H+12V+WiFi+
https://www.aliexpress.com/item/4CH-ESP ... 90810.html
it is controlled by the standard LCTech serial commands (A0 01 01 A2...) which is supported by this P165 plugin. Also the onboard ESP-01 may require the 1MB Puya safe binary.
Re: Serial MCU controlled relay/switch
Looking for the tuya dimmer in EU format but can't find a place to buy. Any tips?
Re: Serial MCU controlled relay/switch
Hi
having this modul attached to fhem via espbridge
How can I switch the relay?
do int it at the moment via wget
but isn't there a option via esp module fhem?
Thanks
having this modul attached to fhem via espbridge
How can I switch the relay?
do int it at the moment via wget
but isn't there a option via esp module fhem?
Thanks
Re: Serial MCU controlled relay/switch
How can you execute any ESPEasy command via fhem? You can use exactly the same way the relay command, mentioned at the first post of this thread. I am using relay command via HTTP and within RULES.
I am not familiar with FHEM, but with MQTT there are a third way:
Code: Select all
<MQTT subscribe template>/cmd with payload: <command>
Re: Serial MCU controlled relay/switch
thanks
good idea via mqtt
good idea via mqtt
Re: Serial MCU controlled relay/switch
Hello. I was looking for firmware to control LCTech 4ch board and I've found this forum. Unfortunetly above link is not working anymoreenesbcs wrote: ↑18 Jun 2018, 19:05You're right... i left out one index, and ESP did not honor buffer overflow.
Try the updated binary.

Re: Serial MCU controlled relay/switch
As always, you can find the compiled binaries attached to the first post in this thread. Try the PUYA safe binary if you are not sure which one is for your ESP-01.
Re: Serial MCU controlled relay/switch
Re: Serial MCU controlled relay/switch
Sorry, i left out the Puya binary, i forgot that previous version is not capable to handle 4ch.fahrt wrote: ↑14 Nov 2018, 21:08I've flashed with "ESPEasy_Mega_P165_1M_128kS_lwip20_PUYA.bin" but This one works only with 2 relays

Try this:
- Attachments
-
- ESPEasy_Mega_P165_1M_128kS_lwip20_PUYA.zip
- ESPEasy dev with P165
- (388.99 KiB) Downloaded 4819 times
Re: Serial MCU controlled relay/switch
Thank You for the file I'll test it on weekend

Re: Serial MCU controlled relay/switch
Re: Serial MCU controlled relay/switch
You are welcome. Maybe you can try faster serial speed, some device can be used at 115200 baud. Some can not.

Also disable command doubling if device works without it. Anyway, Wifi devices have some delays basically.
Re: Serial MCU controlled relay/switch
Hi
using latest firmware,
but FHEM is not available as controller?
Could you make a version with Fhem enabled in controller list?
OpenHAB MQTT and FHEM would be perfect
Thanks T
using latest firmware,
but FHEM is not available as controller?
Could you make a version with Fhem enabled in controller list?
OpenHAB MQTT and FHEM would be perfect
Thanks T
Re: Serial MCU controlled relay/switch
Yes i can. 4MB version will be OK?
Re: Serial MCU controlled relay/switch
Hi
thanks
perfect,
No i would need a small version for esp01S
LC TEch with 2 relays
Thanks a lot T
thanks
perfect,
No i would need a small version for esp01S
LC TEch with 2 relays
Thanks a lot T
Re: Serial MCU controlled relay/switch
OpenHab+FHEM included
Re: Serial MCU controlled relay/switch
Thanksgiving perfekt
Re: Serial MCU controlled relay/switch
Hi
could you please double check.
Do not see FHEM as Controller?
Thanks Thomas
Firmware
Build 20102 - Mega
Libraries ESP82xx Core 2_4_0, NONOS SDK 2.1.0(deb1901), LWIP: 2.0.3
GIT version (custom)
Plugins 11 [Normal]
Build Md5 4d44355f4d44355f4d44355f4d44355f
Build time Dec 5 2018 18:55:03
Binary filename ThisIsTheDummyPlaceHolderForTheBinaryFilename64ByteLongFilenames
could you please double check.
Do not see FHEM as Controller?
Thanks Thomas
Firmware
Build 20102 - Mega
Libraries ESP82xx Core 2_4_0, NONOS SDK 2.1.0(deb1901), LWIP: 2.0.3
GIT version (custom)
Plugins 11 [Normal]
Build Md5 4d44355f4d44355f4d44355f4d44355f
Build time Dec 5 2018 18:55:03
Binary filename ThisIsTheDummyPlaceHolderForTheBinaryFilename64ByteLongFilenames
Re: Serial MCU controlled relay/switch
Yep, sorry i forgot, that i not just deleted the file, but removed my pluginset completely before.
Recompiled.
- Attachments
-
- ESPEasy_P165.zip
- ESPEasy P165 1MB
- (781.87 KiB) Downloaded 1510 times
Re: Serial MCU controlled relay/switch
thanks, perfect, working now!!
Re: Serial MCU controlled relay/switch
Hello, I have LC Tech relay x2 12v, I followed post #138 on installing ESP Easy (ESPEasy_1M_128kSPIFFS_PUYA.zip)
Everything works, MQTT, HTTP, and I can hear the switch clicking when turning it on or off, but I am not getting any output voltage from both relays, what could be the cause? This is the second board I have bought already, the first one burned(https://www.aliexpress.com/item/12V-WIF ... 34092.html) and I dont want to order another one, any ideas? Thanks
Everything works, MQTT, HTTP, and I can hear the switch clicking when turning it on or off, but I am not getting any output voltage from both relays, what could be the cause? This is the second board I have bought already, the first one burned(https://www.aliexpress.com/item/12V-WIF ... 34092.html) and I dont want to order another one, any ideas? Thanks
Re: Serial MCU controlled relay/switch
If the relay clicks the works.. my first idea is: the 12V power supply is weak to power the relays, try with larger, 1A,2A...xonecell wrote: ↑06 Jan 2019, 17:24 Hello, I have LC Tech relay x2 12v, I followed post #138 on installing ESP Easy (ESPEasy_1M_128kSPIFFS_PUYA.zip)
Everything works, MQTT, HTTP, and I can hear the switch clicking when turning it on or off, but I am not getting any output voltage from both relays, what could be the cause? This is the second board I have bought already, the first one burned(https://www.aliexpress.com/item/12V-WIF ... 34092.html) and I dont want to order another one, any ideas? Thanks
Second thought: Check soldering points of the relays at the back side, resolder them if necessary - of course check NO/NC with a multimeter previously.
Re: Serial MCU controlled relay/switch
Is there a way to use this with the 4x channel LC Tech relay? Works on my 2ch version, but the only option in 'number of relays' is 1 or 2.
Who is online
Users browsing this forum: Ahrefs [Bot] and 31 guests