I am new IoT and I had built a module with Arduino Uno,Esp8266 and 5v Relay. It works fine if I doesn’t connect any load to the relay for hours. Suppose if i connect bulb to relay it works for few seconds and blynk shows SmartSwitch disconnected and it doesn’t works. However if I remove power supply to Ardunio and re-connect again it works for few second and disconnects. Below is the sketch, please advise whether it’s hardware or sketch problem.
@rajiv please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```
The Uno has one hardware serial port and this can’t be used for both debugging and communication with your ESP-01.
The normal solution is to use SoftwareSerial to create a second serial port and connect your ESP-01 to this. You’ve included the SoftwareSerial library, but aren’t using it. If you did use it then you’d need to drop your ESP-01’s baud rate to 9600 as the SoftwareSerial library is unreliable at faster speeds.
I’d suggest that you re-read what I’ve written, and search the forum for information about using the Uno/ESP-01 combination.
There is a lot that’s been written about the issues of using this combination and I don’t intend to repeat it.
The better solution would be to use an IoT ready board…