The use of the ESP8266 in the world of IoT

User avatar
By mrespman
#57009 So I built a wifi smart plug using an ESP8266-01. The program is generic, using GPIO0 and GPIO2 to turn on (high) and off (low) a simple LED. No worries with the program.
My problem is, I tried to design a board to make assembly easier, and something I have done is causing the ESP to not start up. Rather, the red LED comes on and stays on. The serial monitor shows no communication.

If I disconnect GPIO2 from its opto and leave GPIO0 connected to its opto, I get the following serial monitor feedback:
ets Jan 8 2013,rst cause:2, boot mode:(1,6)

If I connect GPIO2 to its opto and disconnect GPIO0 its opto, I get the following feedback:
ets Jan 8 2013,rst cause:2, boot mode:(2,6)
Fatal exception (0):
epc1=0x40100002, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
(this just keeps repeating endlessly)

In short, the design (Eagle file attached) connects GPIO0 to a MOC3021 via a 1k resistor. The MOC3021 then connects to a BT137 triac via a 220ohm resistor to drive the mains. (Same setup for GPIO2). Although, I have not actually finished building the circuit beyond the optocouplers. I don't have any triacs on hand at the moment.

I'm obviously missing something pretty simple, but I don't see it. I must be pulling the pins low and don't understand how/why. Shouldn't the MOC3021 not allow the pin to be connected to ground, but rather, only allow the pin, when high, to trigger the MOC?

I've seen most designs use a transistor as part of the drive circuit, but I am novice enough not to understand why. I've made many home made SSRs using the same opto/triac combination and never had problems with a pin being driven low for other chips (typically PICs).

I sure could use some help. I'm trying to keep this board as tiny as possible so it will fit inside the junction box, along with a small 3.3v power supply.

Thank you in advance for your assistance.
You do not have the required permissions to view the files attached to this post.
User avatar
By Barnabybear
#57021 Hi, +1 on the above comment. You need to move the track that runs between the 'high' and 'low' voltages of the MOC. The gap between is to electricaly seperate the two different voltages and you should never run a track through that gap (also any spare copper needs to be removed).
User avatar
By mrespman
#57034
Barnabybear wrote:Hi, +1 on the above comment. You need to move the track that runs between the 'high' and 'low' voltages of the MOC. The gap between is to electricaly seperate the two different voltages and you should never run a track through that gap (also any spare copper needs to be removed).


Thanks to both responders for their input. I've redrawn the board with the suggestions. A quick look to see if I understood them correctly. Thanks.
You do not have the required permissions to view the files attached to this post.