So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By lingster
#77702 Hi,

For anyone who uses MicroPython and this LCTech single relay board, I have been able to get it working using the following steps:

1) download and install the micropython ESP from here:
http://micropython.org/resources/firmware/esp8266-20180511-v1.9.4.bin
2) reprogram your esp8266 (with esptools.py) and connect to the esp8266 via serial configure it to connect to your local wifi
3) enable webrepl by entering
Code: Select allimport webrepl_setup
at the >>> prompt
4) download https://github.com/micropython/webrepl and open the
Code: Select allwebrepl.html
in a browser
5) connect to your esp8266 and type the following:
Code: Select allfrom machine import UART
ut0 = UART(0, 9600)
ut0.init(9600, bits=8, parity=None, stop=1)

import ubinascii
# below will turn the relay on:
ut0.write(ubinascii.unhexlify('A00101A2') )
# below will turn the relay off:
ut0.write(ubinascii.unhexlify('A00100A1') )


I haven't got a web server up and running as yet, but that should be a fairly trivial task in micropython.

Hope this helps.
User avatar
By Narfel
#78103 So close and yet so far... I recently remembered the 5V LC Tech relay and decided to try and reanimate it. I'm one of the blinking led guys. I'm almost there, but need some help.

1- The esp01 is fine and i can program it with whatever i want.
2- The STC15F104W appeared empty so i reflashed it with the hex from this thread
3- The flashing LED now stopped flashing.

My problem now is, i can't find a way to get the reprogrammed STC15F104W to accept anything over Serial. Neither from Arduino code via byte relON[] = {0xA0, 0x01, 0x01, 0xA2}; nor via direct Serial over a FTDI232 or from the COM Helper section in the STC programming software.

Since i got the flashing right (verified by the flashing software) i'm pretty sure i just missed something obvious. Any ideas? Could this be a sign that i need to switch resistors? As far as i know the switching of resistors is only needed for the relay to actually actuate, yet i am still at the "make the firmware work at all" phase.
User avatar
By pilol34
#78158
Narfel wrote:So close and yet so far... I recently remembered the 5V LC Tech relay and decided to try and reanimate it. I'm one of the blinking led guys. I'm almost there, but need some help.

1- The esp01 is fine and i can program it with whatever i want.
2- The STC15F104W appeared empty so i reflashed it with the hex from this thread
3- The flashing LED now stopped flashing.

My problem now is, i can't find a way to get the reprogrammed STC15F104W to accept anything over Serial. Neither from Arduino code via byte relON[] = {0xA0, 0x01, 0x01, 0xA2}; nor via direct Serial over a FTDI232 or from the COM Helper section in the STC programming software.

Since i got the flashing right (verified by the flashing software) i'm pretty sure i just missed something obvious. Any ideas? Could this be a sign that i need to switch resistors? As far as i know the switching of resistors is only needed for the relay to actually actuate, yet i am still at the "make the firmware work at all" phase.


Hello Narfel;

Make sure you use the HEX code file of post # 74262 ( https://www.esp8266.com/viewtopic.php?p=74262#p74262 ) and that the speed of the port is 9600. If the module works well you will have to see the LED turn on and off by alternately using the codes "A1 01 01 A2"and "A1 01 00 A1". I recommend using the same program used to program the module via the "COM Helper" section and use the same wire setup. Ensure "HEX-mode" is set in TX Buffer before press "Send Data".

Good Luck.