how to integrate a 12V 4-CH ESP8266 WIFI Relay - ebay - china - lctech ?

180 views
Skip to first unread message

wro...@tirnet.de

unread,
Jan 7, 2019, 5:30:23 AM1/7/19
to SonoffUsers

Hello together.

Last night I flashed tasmota on a really cheap ( EUR 8,50 each) 4 channel china relais card I bought form chinese ebay diystore.
It looks like there are similiar widgets flooding in from the far east, 1 and 2 channel, too.
Basically, It works, i.e I can switch the relais on and off by issuing serial command strings, but it does not well integrate into the rest of tasmota framework.
So I had to keep track of relais state in some mqtt client, maybe FHEM (in some distant future end...)

So preferably, we could expand the sonoff 4CH backend stuff to use those thingies with the sonoff 4CH frontend (web buttons, dedicated relais commands, status message...)

It has a (presumably) ESP-01-s (1MB) plugged on its board, talking serially to some other µcontroller for the relais.
Similiar to the sonoff 4CH, but obviously not identical.

"API" of the thingie in a nutshell, as delivered on the sellers ebay page:
    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

what I did:
- flash a stock sonoff-sensors.bin (v6.4.1) on the ESP
- configure it as "Generic" with all GPIO left unassigned
- (kept an Arduiono console for debugging on the line to find out what's going on)
- plug the ESP to the board again
- issue a
- $ mosquitto_pub -h 192.168.XXX.YYY -t 'cmnd/sonoff/serialsend5' -m '0xa00101a2'


voila - that's it :-)
No soldering or board tweaking required :-)
(well, actually I crafted a programming plug for the ESP01, because I think I will buy some more of those...)

I Tried to assign the RX/TX GPIO 1&3 to "SerBR", but this broke communication on the serial line, as I could watch on the arduino console.
The same happens when I switch the module type to some sonoff 4ch variant.

Anybody there having experience with such thingies?
btw: long term reliablity still to be tested, of course.
Maybe already code to share?
Or will it be my great occasion to dive into tasmota development;-O
I'd like to beg for assistance, then.

Is there a best point to start with module development?
Where is the code in the sonoff 4CH relais interface where I might step in?
How could any modification properly be integrated into the tasmota configuration framework?
How is the best way to organize github workflow?

==============

last but not least:
Great stuff, your tasmota!
Looks like it might solve 70 % of my problems I got stuck when I started with ESP-IoT two years ago.
The other 30 % I'm just trying to catch up with :-)

cu
Wolfgang Rosner

Philip Knowles

unread,
Jan 8, 2019, 12:15:18 AM1/8/19
to wro...@tirnet.de, SonoffUsers
Sometime ago there was a discussion about these devices and someone (KPK75) produced a version which worked with the single and two channel devices. If you look in the issues you'll find it. Theo decided not to port into the full version but to use SerialSend5 instead.
Essentially you tell your HA software this is the string for Power3 ON and Power3 OFF and it sends it.
So the option is to use KPK75's version or stick to SerialSend5 I'm afraid.

Regards

Phil K

--
You received this message because you are subscribed to the Google Groups "SonoffUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "SonoffUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ash Scott

unread,
Jan 8, 2019, 2:48:43 AM1/8/19
to SonoffUsers
Could you post a link to the device please?

wro...@tirnet.de

unread,
Jan 8, 2019, 12:53:40 PM1/8/19
to SonoffUsers

Hope it is OK with the Policy of the list to point to ebay sellers here.
This is where I got the samples I testet these days:
(Go for the last one in the list)

But there is a growing number of other CN suppliers listing these widgets now.
There are also some variants without the ESP-Socket, but I haven't tried them.
Maybe they are first choice when you need more GPIO and go for a D1 mini instead of a ESP01

wro...@tirnet.de

unread,
Jan 11, 2019, 12:57:11 PM1/11/19
to SonoffUsers
Hi Phil,

thanks for the pointer.
Worked through this issue and came out here:

.... Added support for LC Technology 1, 2 and 4 channel boards....

this version either was not merged, but I'd prefer the approach over KPK75's
It is  still available:

so I think I'll try some git exercises this night...

wro...@tirnet.de

unread,
Jan 13, 2019, 8:31:57 PM1/13/19
to SonoffUsers
Took a bit more work than expected, but in the end, I conquered :-)
The results are here:
with some comments here:

The main issue is that one has to wait some time (>20ms) between subsequent commands, and to code that in an nonblocking way required a little bit more work that I initially expected.
Reply all
Reply to author
Forward
0 new messages