1
\$\begingroup\$

I excitedly received a ESP8266 based 5v relay board today (https://www.ebay.co.uk/itm/ESP8266-5V-WIFI-Relay-Module-TOI-APP-Control-For-Smart-Home-Automation-System/202004110898). The ESP8266 daughter board looks like the AI-Thinker ESP 01 (but is not badged as such). It is configured via serial connection. I am using a ch340 usb to serial. I am powering it with a USB phone charger (5v; board has a 5v>3.3v reg). The device appears to power on correctly and creates a WiFi AP with SSID AI-Thinker_xxxxxxx. I can connect to that AP and ping the device. I believe it has stock Espressif AI-thinker firmware but do not know the exact version.

I have tried all the common baud rates (9600, 57600, and 115200) but only get something unintelligible where I should get the boot welcome. enter image description here I have tried gtkterm and minicom (on Ubuntu). I also tried PuTTY on a different laptop with windows. Still get the same (i.e. same output for each baud setting). It does not appear to respond to commands.

What is the next step to diagnosing what's wrong?

[Update]- 1) The initial baud should be 74880 according to http://wiki.ai-thinker.com/_media/esp8266/esp8266_series_modules_user_manual_v1.1.pdf . I have tried this (tx and rx) but still get junk.

2) This thread http://www.esp8266.com/viewtopic.php?f=6&t=4459&start=4 suggests some units are dodgy and I should try reflowing solder joints (TX does look a bit dry) and/or flashing firmware.

3) In the mean time I ordered a new nodemcu board with a built in USB TTL.

Thanks

\$\endgroup\$
5
  • \$\begingroup\$ Can you link the actual thing you bought? They may have some custom firmware on it. Did it include any kind of documentation (online or other)? \$\endgroup\$
    – Ron Beyer
    Commented Nov 4, 2017 at 20:19
  • \$\begingroup\$ Hi @RonBeyer, I have added the link to the actual item. No documentation came with it. \$\endgroup\$ Commented Nov 4, 2017 at 21:08
  • \$\begingroup\$ Looks like this one: hackster.io/makerrelay/… \$\endgroup\$
    – Ron Beyer
    Commented Nov 4, 2017 at 21:20
  • \$\begingroup\$ Yes, thanks, it looks very similar (different branding though). \$\endgroup\$ Commented Nov 4, 2017 at 22:18
  • \$\begingroup\$ Hi @RonBeyer, in case you are interested a new USB-serial adapter got it working \$\endgroup\$ Commented Nov 21, 2017 at 22:59

2 Answers 2

3
\$\begingroup\$

I have tried one of the ESP8266 boards, I cannot say for sure if its exactly the same as yours, but it looks similar. This is what I found:

The initial boot up text is sent out at about 76900 baud. I had to get a scope and measure it at 13us per bit.

After the initial boot up text the board changes to 115200 baud, and I could then send commands to it. Initially I had some problems using PuTTY, I couldn't get PuTTY to send the correct end of line sequence of CR, LF. Using the Ctrl keys I could send A T ctrl-M ctrl-J and get back a response of "OK". Since then I have used Hercules, partly because in addition to the terminal emulator it also has TCP Clients and servers which make it easy to try out the ESP8266.

\$\endgroup\$
11
  • \$\begingroup\$ Thanks I just tried 76900 but it still looks like garbage :/ \$\endgroup\$ Commented Nov 4, 2017 at 22:19
  • \$\begingroup\$ Have you got 8 data bits, 1 start, 1 stop, no parity? \$\endgroup\$
    – Steve G
    Commented Nov 4, 2017 at 22:20
  • \$\begingroup\$ I have never seen an option for #start bits but otherwise yes \$\endgroup\$ Commented Nov 4, 2017 at 22:27
  • \$\begingroup\$ Do you have an oscilloscope to measure the frequency? \$\endgroup\$
    – Steve G
    Commented Nov 4, 2017 at 22:27
  • 1
    \$\begingroup\$ 99% of times, it does work, or not. If you have output in serial, if it created a hotspot, it's not damaged. Maybe the USB-TTL is not converting the output correctly. Some USB-TTL have a jumper for 3.3v or 5v adjust. \$\endgroup\$
    – mguima
    Commented Nov 6, 2017 at 2:01
1
\$\begingroup\$

A new USB-serial (Prolific Technology, Inc. PL2303) worked, even at 5v. Not sure why it didn't work my CH340 (I also bought a nodeMCU dev board that has a CH340 and it works fine with the same laptop and gtkterm settings).

After using AT commands to join my home network, I can just use netcat to control the relay:

# switch on
echo -e '\xA0\x01\x01\xA2'  | nc -q 1 192.168.0.37 8080
# switch off
echo -e '\xA0\x01\x00\xA1'  | nc -q 1 192.168.0.37 8080

where, as is likely obvious, 192.168.0.37 and 8080 are the ip and port. I could also use the host name without bothering to lookup the IP address.

For reference, the AT commands to join a network and start a TCP serial server:

AT+CWMODE=1
AT+RST
AT+CWJAP=<ssid>, <password>
AT+CIPMUX=1
AT+CIPSERVER=1,8080
AT+CIFSR

Firmware: for anyone interested, the version is:

AT+GMR
AT version:1.2.0.0(Jul  1 2016 20:04:45)
SDK version:1.5.4.1(39cb9a32)
Ai-Thinker Technology Co. Ltd.
Dec  2 2016 14:21:16

Out of interest I also plugged in a generic AI-Thinker module that I had recently bought (it's less than my morning coffee, after all :)) and the relay module works fine with it after switching to 9600 baud (it is 115200 by default with my version of the firmware). However there is a major gotcha: if you use AT+IPR=9600 it works fine.. until you reset the chip and realise it killed the firmware and you need to reflash!

\$\endgroup\$
2
  • \$\begingroup\$ If this is the solution you can accept it to indicate that your problem is solved. \$\endgroup\$
    – Transistor
    Commented Nov 22, 2017 at 21:44
  • \$\begingroup\$ @Transistor - done \$\endgroup\$ Commented Nov 22, 2017 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.