Chat here is you are connecting ESP-xx type modules to existing AVR based Arduino

Moderator: igrr

User avatar
By MeeGz
#60962 Hello all,

This is my first post here and I've just begun working with the esp8266. If I have placed this post on the wrong board I hope the mods will move it to the appropriate place.

Recently I purchased a LinkNode R4 by LinkSprite. For those of you who are unfamiliar with this device it is simply an esp8266 with four 5V/125VAC10A/250VAC10A relays with a 5VDC in. Unfortunately none of the other GPIO pins are broken out. Currently I have the R4 stuffed in a gangbox with its own dedicated 4A PSU. It's relays are each connected to a single 125VAC plug socket. Power is provided through a standard 3 prong recepticle that accepts a standard 3 prong pc power cable. Both the DC PSU and 125VAC mains are individually switched to allow for debugging and programming the R4 without having hot mains running through its relays.

Currently the R4 is controlled by the LinkNode app that interfaces with their cloud. It works quite well but the reason for this project was to emulate a Belkin WeMo smart switch and control it through my Echo Dot. I will be flashing that firmware later today as my FTDI adapter has finally arrived. Initially I experimented using an Arduino Nano clone(ch340 USB to serial) connected to an esp201 with communication handled by Software Serial at 115200 bauds. The esp201 shipped with AT firmware so I thought it might be a good idea to see if I could program it with an Arduino first as a test rather than risk bricking my R4. At any rate I had very inconsistent results. At times certain commands would work, at other times the very same command would return either an error or garbage. Initially I was unsure if I had perhaps wired the esp201 incorrectly on my breadboard this damaging it. Last night I(finally) received my 3.3/5V FTDI adapter and connected it to me esp201. My AT commands finally worked flawlessly and I was able to upload a number of sketches successfully. Now that I have a working UART connection I am ready to flash the FauxMo firmware to my R4 without any worries of bricking it.(Ironically I never thought to use my RPI 2 or Odroid's built in UART pins to communicate with my ESP devices until yesterday morning. Oh well live and learn!)

As I previously mentioned the R4 does NOT breakout the remaining GPIO pins. Once reflashed the R4 should work wonderfully with the Echo. I did however want to add 4 push buttons to also have the option to manually control each relay. This would not be an issue if I had access to the remaining GPIO. I initially considered hijacking the 5V "On/off" signal right at the relay but that will not work as I understand that the "On" state requires continous current rather than just a pulse.

My solution to this, I hope, would be to wire up 4 push buttons to a nano and attach that nano to the R4's UART to send high/low commands in order to control each relay's respective GPIO pin. What I am a bit wary of however is my experience with Software Serial on my 201. That being said many others seem to have had satisfactory results with the nano acting as a programmer for the 201.

Finally, my question: Does it seem feasible to use a nano to send hi/low commands to the LinkNode R4 over UART via Software Serial? Also is it possible for me to actually use the nanos ch340 TTL chip to communicate directly with the R4 as I could potentially use my FTDI cable to program the nano. If either is possible does anyone have any references as to how to control GPIO pins over serial on the esp8266.

Any and all help or feedback will be very much appreciated.

Thanks in advance,
MeeGz