-->
Page 14 of 29

Re: Trouble with ESP-01 + 1Ch 5V relay from LC Technology

PostPosted: Tue Dec 19, 2017 7:01 pm
by hkusp
I tried all of the above suggestions, but was never able to get the relay to work. I'm done lurking here, so I'm offering a way to get these modules to work. I ordered a bunch of them and couldn't afford to just junk them.

The main issue with this board is the ESP-01 doesn't directly control, the STC15F104-SOP8 microcontroller does. This also means you can't directly retrieve the state of the relay.

Through brute force and a soldering iron, I got the relay module to work doing this:

1. Soldering a jumper on the ESP-01 from VCC to GPIO0.
2. Soldering a 10K pullup resistor from VCC to GPIO2.
3. Desoldering and removing the STC15F104-SOP8 micro controller, being careful not to damage the pin 7 pad.
4. Desoldering and removing R4, the 4.7K resistor connected to the base and emitter of Q1. It only took away base current.
5. Soldered a very fine wire from GPIO2 to the now vacant pin 7 pad where the micro controller used to be.

I then loaded https://github.com/KmanOz/KmanSonoff/tr ... ff_v1.00sc onto the ESP-01. With very few modifications, the code runs on the ESP-01, adds OTA, adds MQTT, allows you to retrieve the relay state, optionally retains relay state when reset and gives you the ability to remotely reset the ESP-01. If you take out or move references to the Sonoff LED, temp/humidity sensor and button, you are left with the relay control code and are good to go.

The serial Rx and Tx connectors on the relay board are still usable for debugging purposes.

Re: Trouble with ESP-01 + 1Ch 5V relay from LC Technology

PostPosted: Wed Dec 20, 2017 8:03 am
by jbrowne
sorry for not posting sooner, got busy....
here are some pics of what I did...

I cut the trace here:
Image

and, then I soldered a transistor (2N3904) to the pins:
Image

Re: Trouble with ESP-01 + 1Ch 5V relay from LC Technology

PostPosted: Thu Jan 04, 2018 1:33 pm
by lotus49
hkusp wrote:If you must have a relay board get one of these:
https://www.aliexpress.com/item/ESP8266 ... 97306.html

This relay board must be modified to work. GPIO0 must be connected to a 10K pullup resistor. Once the pullup is installed, the same software for the Sonoff can be loaded. (See below)

I made the mistake of buying 6 relay modules foolishly expecting that they would just connect one of the GPIOs to the relay. I have spent several days researching these (which has slightly improved my Russian skills) and was on the point of giving up. However, purely by chance, I did buy the ones you link to here not the other slightly different looking ones that I had assumed were otherwise identical.

Am I correct in interpreting what I quoted as meaning that the ESP-01s will successfully boot as long as CH_PD and GPIO0 are pulled up to Vcc at boot time? I understand that I would still have to work around the stupid serial nonsense but the Yorkshireman in me hates the idea of just wasting these relay modules even though they were very cheap.

Re: Trouble with ESP-01 + 1Ch 5V relay from LC Technology

PostPosted: Sat Jan 06, 2018 1:31 pm
by hkusp
If you follow my directions, the ESP-01 will boot. Be sure to tie RST and CH_PD to VCC. Also, tie GPIO0 to VCC with a 10K resistor. If you actually want to be able to control the relay, then you will have to do the rest of the modifications in my post. (Removing the microcontroller, 4.7K SMT resistor, running a short jumper, etc.)

Once you get setup and going, it takes about 10 minutes modify each relay board. Then, I program the ESP-01 on an external programmer and install on the relay board. When the ESP boots, it will be responding to MQTT messages and you'll be able to change the software over the air (OTA)!