Author Topic: ESP2866 and Optocouplers  (Read 1598 times)

0 Members and 1 Guest are viewing this topic.

Offline espfanTopic starter

  • Newbie
  • Posts: 5
  • Country: gb
  • If it isn't broke, take it apart and fix it
ESP2866 and Optocouplers
« on: January 07, 2018, 07:18:42 pm »
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 diagrams

The 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.
« Last Edit: January 07, 2018, 08:10:56 pm by espfan »
 

Offline moffy

  • Super Contributor
  • ***
  • Posts: 2106
  • Country: au
Re: ESP2866 and Optocouplers
« Reply #1 on: January 07, 2018, 10:45:49 pm »
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.
 
The following users thanked this post: espfan

Offline espfanTopic starter

  • Newbie
  • Posts: 5
  • Country: gb
  • If it isn't broke, take it apart and fix it
Re: ESP2866 and Optocouplers
« Reply #2 on: January 07, 2018, 11:35:22 pm »
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
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: ESP2866 and Optocouplers
« Reply #4 on: January 08, 2018, 12:08:03 am »
One other issue, when the output driving the LED and Optocoupler
goes low, that floats the Optocoupler input, and subjects it to noise
and leakage. Plan on using a R to ground at its input so that when
external LED is reversed biased the input is forced low to the Opto-
coupler.


Rewgards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline witnessmenow

  • Contributor
  • Posts: 32
  • Country: ie
  • Making Youtube Videos on ESP8266
    • My YouTube Channel
Re: ESP2866 and Optocouplers
« Reply #5 on: January 08, 2018, 11:30:07 am »
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 Aliexpress

I know it's not the question you asked, but did you consider using Wake On Lan?

It looks like someone has written a library for it (but I have never used it): https://github.com/koen-github/WakeOnLan-ESP8266

The Alexa stuff is actually pretty easy, there are a couple of libraries for it

https://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)


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf