ESP2866 and Optocouplers - Page 1
Forum section: electronics / projects

author: espfan
author_rank: Newbie
timestamp: January 07, 2018, 07:18:42 pm
content: Im just starting my first electronics project using an esp2866-01 to turn my PC on and off initially over wifi but eventually using an amazon echo.So far i have coded the esp (copied someone else's code) and i am turning an LED on and off through a 4N35 optocoupler simulating the power button on the PC which works a treat. Ive added my schematic but this is my first time with kiCAD and circuit diagramsThe problem I have is when the esp is powered on both the output pins gpio0 and gpio2 (im using pin2 to controller the 4n35) are sent high for a split second while the chip starts up which would switch the computer either on or off before the chip connects to wifi and i issue a command.My question is, is there some circuitry i can put in after pin 4 of the optocoupler and before the LED to remove this pulse. From what i have read this isnt possible using code as it happens before any of the code is ran.If anyone could point me in the right direction to do some research into fixing my problem that would be great.

author: moffy
author_rank: Super Contributor
timestamp: January 07, 2018, 10:45:49 pm
content: Normally you would just use an RC(resistor/capacitor) filter to remove the glitch. But you would need to buffer the output of the delay with say a transistor to drive the LED.

author: espfan
author_rank: Newbie
timestamp: January 07, 2018, 11:35:22 pm
content: Thanks for the reply moffy. Ill do some looking into that tomorrow while im supposed to be working.In the mean time I have gone down the route of plugging stuff in and seeing what happens. With your recommendation I have indeed got rid of the pulse and the on time is as near to instant as I care about. It still takes a while to bleed down but im guessing this can be solved when i have done some reading into correctly sizing a capacitor and actually have a clue what im doing!Thanks again for helping me out. Ill come back when i know more

author: danadak
author_rank: Super Contributor
timestamp: January 08, 2018, 12:05:00 am
content: Some info on possible solutions GPIO glitching -https://zoetrope.io/tech-blog/esp8266-bootloader-modes-and-gpio-state-startup/http://www.instructables.com/id/ESP8266-Using-GPIO0-GPIO2-as-inputs/http://www.esp8266.com/viewtopic.php?f=13&t=15976https://community.blynk.cc/t/on-boot-up-pins-go-high/10845Regards, Dana.

author: danadak
author_rank: Super Contributor
timestamp: January 08, 2018, 12:08:03 am
content: One other issue, when the output driving the LED and Optocouplergoes low, that floats the Optocoupler input, and subjects it to noiseand leakage. Plan on using a R to ground at its input so that whenexternal LED is reversed biased the input is forced low to the Opto-coupler.Rewgards, Dana.

author: witnessmenow
author_rank: Contributor
timestamp: January 08, 2018, 11:30:07 am
content: I don't work with the ESP-01 modules much due to the lack of pins, would you consider moving to a ESP 12? That has more GPIO pins and i know some of them definitely don't pulse on startup. Or even easier move to a development board like a Wemos D1 mini (if you saw Dave's ESP8266 video it's the one he used), it has the ESP12 board but also programmer and a 3.3v regulator so you can power it by an old phone charger. It's only about $2.70 delivered on AliexpressI know it's not the question you asked, but did you consider usingWake On Lan?It looks like someone has written a library for it (but I have never used it):https://github.com/koen-github/WakeOnLan-ESP8266The Alexa stuff is actually pretty easy, there are a couple of libraries for ithttps://bitbucket.org/xoseperez/fauxmoesp- I think most people use this one (I've never used it)&https://github.com/witnessmenow/esp8266-alexa-wemo-emulator- I maintain this, works fine but I took an existing example sketch and turned it into a library (so I didn't write how it works)