4
\$\begingroup\$

enter image description here

In the figure(V2 is a DC motor by the way) an isolated way of switching recommended. But what if we use a transistor such as in the figure. Why many say that the motor current would harm the micro controller and we need an opto transistor. I don't get it. Doesn't the current flow in a loop? Motor current according to theory should start from positive end and return to ground not inside the micro-controller pin?

edit: Ok my schematics is wrong I guess it is because the leg with arrow is base right?? base(arrow) should have been in the middle which is switching via Arduino pin. But I asked this question because I'm mostly concerned with the danger of DC motor current. How can DC motor current flow inside the Arduino pin ebenthough there is a 0 resistance conductor instead of a transistor. Theory says current always flow in a loop from positive to its negative. Is there a path for DC motor current to flow inside the microcontroller?

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Not only should your transistor be an NPN, you also need a base resistor to protect the Arduino's output. \$\endgroup\$
    – radagast
    Nov 20 '13 at 13:52
  • \$\begingroup\$ NPN or opto transistor? \$\endgroup\$
    – user16307
    Nov 20 '13 at 14:02
  • \$\begingroup\$ Also, if V2 is a motor and not a Voltage Source (as the symbol suggests) - where is the power source for the motor? \$\endgroup\$
    – Mels
    Nov 20 '13 at 14:02
  • \$\begingroup\$ yes but I mentioned that it is a DC motor in my question. Too late to edit it for me. \$\endgroup\$
    – user16307
    Nov 20 '13 at 14:11
  • 1
    \$\begingroup\$ +1 for raising an interesting question and extracting great answers from the experts, despite imprecisions in the schematics. \$\endgroup\$
    – Ricardo
    Dec 18 '13 at 12:19
12
\$\begingroup\$

Those that don't understand the science resort to religion. The rule of always opto-isolate a motor driver is a religious belief that seems to have a small cult following, but that doesn't make it good engineering.

If the motor power supply and the micro power supply both have the same ground, then there is little reason for isolating the control signal. I have designed a number of real industrial devices where motors were controlled by microcontrollers with the same ground reference, and I haven't otpo-isolated the control signal once. There can be reasons to do this, but they are unusual. There is no substitute for understanding what is going on. Religion has no place in engineering.

However, you do have to use the right circuit. Your's is a mess, considering there are only 4 components and most of them are wrong or don't make sense. First, the transistor should be a NPN, not a PNP, if it's going to be a low side switch. Second, the resistor and inductor make no sense at all. The resistor will only waste power, and the inductor will cause even higher kickback voltages than the motor by itself. Third, you left off the all-important kickback catch diode. Without it, the switch will be fried when the motor is turned off. Fourth, you need to limit the current into the base.

Here is a circuit that would actually work:

In this case I used a N channel MOSFET instead of a NPN transistor as the low side switch. The advantage is this FET can be driven directly from a 5 V digital output and can support higher motor current without the current gain of the transistor getting in the way. This particular FET can support up to a few Amps and a power voltage up to 20 V. Since it appears you are using a 12 V supply for the motor, this will be fine.

Note D1. The motor is partially inductive. When trying to switch off the current in a inductor, the inductor will make whatever voltage it needs to sustain that current in the short term. Without the diode, it would make enough voltage for the FET to conduct despite being off, which would damage it. The diode provides a safe path for that current that requires no high voltage to be produced.

\$\endgroup\$
7
  • 1
    \$\begingroup\$ I appreciate your capacity in the field and understand your points. I draw V, R and L as an equivalent DC motor circuit instead of a Motor symbol. I didnt draw the flyback diode because thats not about my question. I want to know how the current flows through mincrocontroller's pin into the IC. Theory says the current only flows in loop from positive to negative. How can Motor current (when even there is no flyback diode) penetrate base and go into the microcontroller? Thats my question. \$\endgroup\$
    – user16307
    Nov 20 '13 at 14:43
  • \$\begingroup\$ @user: In theory, which the flyback diode, it shouldn't. If the transistor fails, it could possibly leak the motor power back to the micro, but that would be quite unusual. However, without the diode, the transistor is almost guaranteed to fail eventually. Also, draw a schematic with what you really mean. If you want to show a motor, show a motor. \$\endgroup\$ Nov 20 '13 at 15:30
  • 1
    \$\begingroup\$ yes it could be a relay that's why i draw like that. but yest it should be a motor in my case. 1-) the point is i want to know without a flyback diode and without an opto transistor scenario is that possible that the high current penetrate and flow through the base leg into the microcontroller. I mean in that case in my opinion I would say the current wouldnt flow into microcontroller since base gate and microcontroller has much higher impedance than collector gate impedance. 2-) this is another issue. maybe because those fellows who doesnt want to use flyback use opto instead? \$\endgroup\$
    – user16307
    Nov 20 '13 at 15:40
  • 1
    \$\begingroup\$ @AndreKR, haha, I already did I wondered what a productive looking member was doing defacing posts ;). \$\endgroup\$
    – PeterJ
    Jan 10 '14 at 11:11
  • 1
    \$\begingroup\$ @lun: The flyback catch diode clamps the voltage already, so a TVS would add nothing useful. A small cap across the motor can help with EMI by lowering the dV/dt. However, it will also cause a current spike every time the motor is switched on. If that is only occasionally, then that can be a useful addition. If doing PWM, then capacitance across the motor can be a problem, and the whole system needs to be thought about carefully. \$\endgroup\$ Aug 17 '18 at 18:25
3
\$\begingroup\$

There is probably a mistake in your schematics. You used a PNP transistor would it rather be a NPN?

By the way, a bipolar transistor doesn't provide a galvanic insulation. If your transistor got burnt it could be that the base voltage become higher that the max allowed on a arduino pin.

Using a optocoupler, event if something goes bad, your arduino remains safe.

It's just a matter of confidence in your design. If properly designed, a system without any galvanic insulation would work perfectly.

\$\endgroup\$
2
  • \$\begingroup\$ Ok my schematics is wrong I guess it is because the leg with arrow is base right?? base(arrow) should have been in the middle which is switching via Arduino pin. But I asked this question because I'm mostly concerned with the danger of DC motor current. How can DC motor current flow inside the Arduino pin ebenthough there is a 0 resistance conductor instead of a transistor. Theory says current always flow in a loop from positive to its negative. Is there a path for DC motor current to flow inside the microcontroller? \$\endgroup\$
    – user16307
    Nov 20 '13 at 14:08
  • 1
    \$\begingroup\$ An optocoupler is probably harder to replace than an Arduino nowadays :) \$\endgroup\$
    – Lundin
    Aug 17 '18 at 9:37
1
\$\begingroup\$

Optoisolation is somewhat unnecessary for low-voltage motors, but the main reason it might matter is that "ground" is not a magic sink for all current; depending on how you've laid it out, and how your power supplies are constructed, there is a risk that the return flow of current might raise the voltage of ground. In particular, small spikes of current from arcing motor brushes can get transmitted all over the place.

If you use a "star ground" layout, as in your picture, this is less of a risk.

\$\endgroup\$
1
\$\begingroup\$

In a perfect world, your design would be safe (apart from the few flaws already mentioned by others). But in the real world, semiconductors (such as the transistor in your design) will occasionally fail.

When that happens, all bets are off. As a worst case scenario, it might fail in such a way that it becomes low-impedance from collector to base. It would then effectively connect your microcontroller's I/O pin to the 12V voltage source, which likely destroys your Arduino.

An ATmega328P (the most common uC for Arduino boards) has an Absolute Maximum Rating of Vcc + 0.5V on all pins. If your Vcc is 5V, that means you'll "blow up" the pin when you present it a voltage greater than 5.5V.

By using an optocoupler to achieve galvanic separation, you can rest confidently that pretty much anything can happen on the high-voltage side (even when you scale up to much higher motor drive voltages) without affecting your microcontroller and other digital logic circuits.

\$\endgroup\$
1
\$\begingroup\$

I have never seen an opto-isolator in these circumstances that isn't superfluous. They have there uses such as when controlling a mains voltage motor from a micro controller that for electrical safety purposes needs to be isolated from mains, but otherwise its superfluous.

A few comments on this thread and elsewhere from people who believe that opto-isolation will protect their micro controller from motor transients etc. To an extent they are correct, but they are forgetting that the transient will already have toasted the transistor before it is able to propagate through the gate (or base on bipolar) of the transistor and then through another resistor into the micro controller.

And often I see circuits where the drive transistors cost nearly as much as the microcontroller.

If a drive transistor dies, but the microcontroller is saved but for an also toasted opto-isolator. Are you really going to ask the electronics equivalent of the old "apart from the interruption how was the play Mrs Lincoln?"

\$\endgroup\$
0
\$\begingroup\$

Why use opto's Well what do OPTO's do? They provide galvanic isolation for a signal.

So if the controller & the source/emitter of the switch is at a different reference then yes an OPTO (or XFMR) will be required. A typical H-Bridge where the DClink potential is high enough not to permit the use of P-N & the use of bootstrapping isn't possible would require OPTO's to provide a floating drive to the higher switches (and gnd reference from the -DClink)

What you have shown, a single ended chopper for a brushed DC machine, would not immediately lend itself to the use of an OPTO.

However... What usually occurs is VERY POOR LAYOUT resulting in alot of the power return current from the chopper going via the controller, this then upsets the controller OR there is significant ground bounce (due to voltage drop over reasonable impedance power return line) that then causes the drive signal to be upset. Quick fix? OPTO! proper fix is correct layout of the powercore w.r.t. the controller

\$\endgroup\$
0
\$\begingroup\$

The schematic is comprehensible, you have modelled a simple motor, but in the next time create a dashed square about the components and create a label "motor" to people understand =] About your question, when working with motors and control circuits together, protections is never too, in this case how the Blup1980 wrote, the tjb dont have galvanic insulation, so the arduino port will be exposed too higher currents

\$\endgroup\$
-1
\$\begingroup\$

I'm sorry, but I think the reason of the opto isolator... is for optical isolation. If the opto is near the processor then you don't have to worry about inductance [from your 12v PWM signal] back feeding into your arduino "BLOWING UP" inputs. I am having a similar problem with a 24vdc motor. It runs for about 2 seconds,but then the arduino's red led blinks, the motor turns off, and the arduino resets. I think this is because the modulated 24volts going to motor looks like AC to the cables that are ziptied together and the continuous change in voltage/curreuunt to the motor is creating a negative current/voltage on the mosfet gate/arduino input wire. When this happens I'm assuming the arduino is basically shorting itself out and shutting down.

\$\endgroup\$
1
  • \$\begingroup\$ Nope. And your problem is probably grounding related, and isolation would do nothing to solve it. \$\endgroup\$
    – Matt Young
    May 2 '17 at 4:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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