Hello,
I am trying to use a 2x relay ESP module (http://www.chinalctech.com/xwzx/24.html) to work as USB module, but the module does not seem to respond to the instructions sent via serial.
I have connected the module like this:
In words:
- TX of USB is connected to the RX on the board
- RX of USB is connected to the TX on the board
- GND to GND
- Jumper on the board is on the upper two pin pairs (this should probably connect the TX/RX of CPU to the board header where USB cables are)
- board is powered by the 5V IN+/IN-1 connectors
When turned on:
- LED D7 constantly lights red - which means mode 1 is selected
- LED D6 is blinking green in 1s intervals - which means something about TCP, but that shouldn't be important now
USB is connected to the Win10 computer with the Chinesse soft "sscom32" to handle Serial communication. I have already used the computer and USB stick before to program ESP, so the driver (340C) and serial comm should not be an issue. However, when I try to send instruction "A0 01 01 A2" or "A0 01 00 A1" (open/close relay 1) to the associated COM port (see attachment), nothing happens. No "sound" of relay switching, no relay LED flashing and just to be sure, after every change I was checking the relay by multimeter.
I have tried different jumper positions, RX/TX combinations ... but I am not sure what to try next .. any ideas?
Thanks
2x relay ESP module - STM8S003 - controlling over serial
2x relay ESP module - STM8S003 - controlling over serial
- Attachments
-
- Screenshot_1.png (19.21 KiB) Viewed 1890 times
Re: 2x relay ESP module - STM8S003 - controlling over serial
Ok,it started working with ESP instead of USB.
This is the test code:
The reason I was trying to get it to work with USB was just that it was not working with ESP before, so the problem is now solved I hope. I suspect that the problem was wrong mode selected - the board has two modes that can be set with button S1. In order to be able to use custom firmware on ESP, mode 1 has to be selected.
The USB serial communication still doesn't work though even with correct mode selected .. I wonder why ..
This is the test code:
Code: Select all
void setup() {
Serial.begin(115200);
}
void loop() {
//open first relay
char bb[] = {0xA0, 0x01, 0x01, 0xA2};
Serial.write(bb, sizeof(bb));
delay(1500);
//close first relay
char bb1[] = {0xA0, 0x01, 0x00, 0xA1};
Serial.write(bb1, sizeof(bb1));
delay(1500);
//oipen second relay
char bb2[] = {0xA0, 0x02, 0x01, 0xA3};
Serial.write(bb2, sizeof(bb2));
delay(1500);
/close second relay
char bb3[] = {0xA0, 0x02, 0x00, 0xA2};
Serial.write(bb3, sizeof(bb3));
delay(1500);
}
The USB serial communication still doesn't work though even with correct mode selected .. I wonder why ..
Who is online
Users browsing this forum: No registered users and 102 guests