2
\$\begingroup\$

I am working on a project in which I need to operate a DC motor and some ultrasonic sensors.

I want to operate the motor using motor driver DRV 8871 by giving logic signals and read sensor value on controller pin.

I also need to maintain isolation between my motor and microcontroller and same with the sensors.

I tried to prepare circuit with optocouplers for isolation, but I am very confused between sink and source circuit for the optocoupler.

Will this circuit work ?

  1. Datasheet Optocoupler PC817
  2. Ultrasonic sensor NPN and normally open, Operating voltage (10-30VDC)
  3. DC motor supply voltage is +24 V
  4. Motor driver data sheet 5.Microcontroller Ti CC1350

Optocoupler circuit fig-1 for motor and fig-2 for sensor

\$\endgroup\$
1
  • \$\begingroup\$ If you have square signals activating the optocoupler why do you use ZD1 and ZD2? Perhaps with the zener diodes the current that passes through the internal led of the optocoupler is not enough for activation. Choose the led resistors to reach the minimum drive current. \$\endgroup\$ Commented Feb 8, 2021 at 11:50

1 Answer 1

2
\$\begingroup\$

As suggested in the comments, I'm not sure on why you used zeners, expecially on the MCU side where the GPIOs are well specified.

I didn't check the computations (I'm lazy) however the golden rule with transistor output optos is to check the range of CTR: your part can do 50-600% if not binned so work with that.

An 'excess' current is not a problem since it's limited by your R3/R5.

Nominal current for the led is 20mA, with some margin, of course. I don't know what your '24V' sensor can source, you need to check it. Also an MCU GPIO rarely can source so much (PIC are the big exception); check your datasheet to be sure.

EDIT: I reread the question and it's a simplelink cortex, I know them and they are quite anemic as GPIO goes (MSP430 are even worse). They are specced at 8mA on 'high drive' pins and 4mA on the other ones. I would consider some kind of booster for driving the LED: a MOSFET, a BJT, a spare logic gate you have around. Having 8mA at best with a 50% CTR would mean 4mA on the collector, 4mA from a standard GPIO would enter a penalty zone in the CTR chart so you would have less than 2mA on the collector. It can works if the signals are slow and there isn't too much noise around. Be sure to design the drop resistor for the maximum Vf possible on the led (1.4V), in this case. If you calculate it for a Vf of 1.2V you risk to have even less current available if you are unlucky!

Of course you could choose to go for a lower current, like 10-15mA, however be careful that the CTR could be even worse (figure 2 in datasheet). That said, in the worst case, you have a 50% CTR. This means that when you put 20mA on the LED, the output transistor can sink at maximum 10mA.

This dictates the pullup on the output. Unless you are signalling at fast rates it doesn't really matter. You are driving high impedance inputs (some control pins) so you only need to be sure that with your 10mA available (in the worst case) the line can go to 0V (well, actually it can't since there's the output Vce, but that's trascurable, check figure 5). Do some math and you'll see that your 4.7k is adequate.

However, be careful with your output capacitor. I guess it's for noise immunity and when doing motors is a good idea. When you activate the opto the output goes to 0 almost immediately (subject to the opto propagation time, some µs, figure 6). When the line needs to rise, however, the load resistor needs to charge the filter. So total turnoff time is more than shown in figure: the figures shows the time needed for the internal capacity, and you should add to that (about 80µs, from the chart) you filter. 100nF and 4.7k have a tau of 470µs so you turnoff time would be more than 1ms.

That could be significant or not, depending on the application. You can speeding it up simply reducing the load resistor. If you do the math I wouldn't go lower than 680 ohm, I'd stick with a minimum of 1k for that (that would be about 5 times faster!).

PS: these are all worst case and best practice for design. If it's a one off circuit and you are lucky just design for the 'typical' values and it may even work!

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.