ESP32 + Common anode optocouplers

vortino
Posts: 1
Joined: Sun Feb 02, 2020 10:03 pm

ESP32 + Common anode optocouplers

Postby vortino » Sun Feb 02, 2020 11:19 pm

Hello guys!

Newbie here and a microcontroller newbie overall.

For a project I am working on I am using this stepper driver https://www.omc-stepperonline.com/download/ISD02.pdf. On page 4 it mentions that VCC acts as common anode for all signals and connects the cathode side of each signal to some generic MCU GPIOs.

It does mention that VCC could also act as common cathode since the Optos are bidirectional and it is more likely that at the end of the day I will use it like this to avoid all the hassle, yet, for my own education and future reference, I was wandering what it would take to wire and operate this driver with is originally stated method; using a common anode.

I would obviously need to reverse all logic in my software, but still, a typical GPIO LOW output is not GROUND. Could I sent 3V3 to the driver pins as an "off" signal and use external pull-downs (or use the internally pulled-down GPIOs) to resolve the "on" signal?

Just in case I am approaching all this totally wrong, your advice is appreciated.

Thank you!

username
Posts: 539
Joined: Thu May 03, 2018 1:18 pm

Re: ESP32 + Common anode optocouplers

Postby username » Mon Feb 03, 2020 3:24 am

a typical GPIO LOW output is not GROUND.
Well..... not technically. But we call it that because a typical low state is 0.2-0.7mv. So other hardware will recognize it as GND or low signal.

The ESP32 data sheet states that the max sink current (Low State) is 28ma, and source (High State) is 20ma.
Here is what you do. Tie pin 3 (VCC) of the module to a 3.3v source. Use your current meter and measure the current from say pin 4, 5 or 6 to GND. if its less than 20ma (but I would not push it that hard, i'd say <=15ma) you will be good to connect it directly to the port pin.

If it grater then this, then you should drive a fet or transistor to drive the opto pin.

Who is online

Users browsing this forum: top_secret_guy and 92 guests