0
\$\begingroup\$

Apologies in advance if this is really simple and I've missed the obvious!

I understand that there are benefits to having a resistor before the base of a transistor going directly to the common/ground (for example R4, R5, and R6). I have been successful when working with individual NPN transistors, however, I found that when they're wired the way they are in the schematic, it caused issues with the other transistors becoming unpredictable even when they're supposed to be off; which makes perfect sense I think. Is there a way to do this that works as intended?

R1, R2, and R3 will be receiving PWM input from an Arduino to control a 12v supply going to several motors. Common/ground is going to the Arduino GND pin too.

It was around two years ago when I last did anything to do with electronics, so I am little rusty; I just wanted to see if I can get it right before starting without head-scratching for hours over something hopefully simple!...

Thanks for any help! Much appreciated!

Edit: I've left out the fly-back diodes and resistors for the motors to keep the schematic simple.

Edit: "Updated version" schematic is in response to Tony's reply.

Final Edit!: Re-added that I left diodes and resistors out of the original schematic to reduce clutter.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • 4
    \$\begingroup\$ You changed the schematic so that the answer you got no longer appears to make sense. Leave the old schematic there. You can add the new one, indicating it is in response to Tony's answer. \$\endgroup\$ – Olin Lathrop Apr 12 '17 at 11:29
  • \$\begingroup\$ Hopefully I've got it now, it's my first post and wanted to make sure I understood what Tony was saying correctly. Hopefully what I've done to update it is ok? \$\endgroup\$ – Timeless Apr 12 '17 at 11:35
  • 1
    \$\begingroup\$ @Tony: This has happened to me a few times in the past. I now copy the schematic, even if just a shrunk version or snippet, into my answers when I think it might get changed. The more wrong a schematic is, like the original here, the more likely it will be changed out from under the answer. \$\endgroup\$ – Olin Lathrop Apr 12 '17 at 11:47
  • \$\begingroup\$ Also, how much current do your motors require? With, let's say, a 1k base resistor and 3 volts base drive, any more than about 25 mA is likely to start causing the transistors to heat. \$\endgroup\$ – WhatRoughBeast Apr 12 '17 at 12:23
  • \$\begingroup\$ @WhatRoughBeast They're rated at 250mA, although peak they draw ~270mA, and average around 230mA from my notes. The hFE of the 2N2222 shows 233, with a Vbe of 0.673. I haven't tested the actual motors yet, but using basic defaults (12v Vcc and 3.3 Vi), that should be around 790 Ohms resistor on the base? Bare in mind I had all this worked out a couple of years ago and I've just started again so I am likely well off and mostly guessing at the moment... All I know is I had it working perfectly with one 2N2222 previously, I just never got around to scaling it up without issues... \$\endgroup\$ – Timeless Apr 12 '17 at 12:48
3
\$\begingroup\$

Your circuit won't work, I'm afraid. The highest voltage delivered to the motor load will be something like 3.3-0.7 V or lower. The 3.3 V is the best voltage out of the MCU I/O pin on a good day, the 0.7 V is the transistor's base-emitter voltage drop).

Use the following circuit for each of your three coils.

schematic

simulate this circuit – Schematic created using CircuitLab

R1 determines the transistor base current and is driven by your MCU's General-Purpose Output (GPO) pin. The base current is something like (3.3-0.7)/2200 or just over 1 mA. Try reducing this resistor if your motor coils are not being driven hard enough when on (Vce is above 0.5 V), maybe 1 K will be more suitable.

R2 drains away GPO's leakage current when GPO is configured as an input after reset and is hi-Z.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the reply! So, I should have the motor before the Collector? and not after the Emitter? If I swapped the motor to before the Collector, on each 2N2222, would it all work ok that way with how I have it? \$\endgroup\$ – Timeless Apr 12 '17 at 10:21
  • \$\begingroup\$ So long as what you're describing is changing what you have to what's shown with these resistor values, then yes :-) Glad it helped, upvote the answer if you're sorted. \$\endgroup\$ – TonyM Apr 12 '17 at 10:25
  • \$\begingroup\$ Ok! I have updated the schematic in the original post just to make sure I'm getting it. How's that look? Minus the resistor values, I'll be measuring voltage and working out everything on the multimeter as I go (it has a hFE slot). \$\endgroup\$ – Timeless Apr 12 '17 at 11:04
  • \$\begingroup\$ Now that you've edited the question and changed the schematic, the answer from @TonyM makes no sense as it's pointing out issues that aren't there any more. Please restore the original. \$\endgroup\$ – Finbarr Apr 12 '17 at 11:05
  • \$\begingroup\$ I don't know how to add the "fixed version" (two schematics) to see if I have it right... I'll have a look and see... \$\endgroup\$ – Timeless Apr 12 '17 at 11:09
0
\$\begingroup\$

I would not use an NPN for this, MOSFETS make better switches for driving motors and the like and are not dependent on the IO pins current.

schematic

simulate this circuit – Schematic created using CircuitLab

Or if you really want top drive.... use a P-Channel

schematic

simulate this circuit

NOTE: Devices shown here have suitable specs. You should choose similar devices for whatever load you need to drive.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the suggestion! I've never used MOSFETS before so I'm just having a read to see how they work and how they cope with PWM, much appreciated! \$\endgroup\$ – Timeless Apr 12 '17 at 12:20
  • \$\begingroup\$ @Timeless they are basically voltage controlled transistors. The output is only coupled to the gate capacitively. \$\endgroup\$ – Trevor_G Apr 12 '17 at 12:22
  • 1
    \$\begingroup\$ Nice! They look promising! I just had a hunt and thought I had one; turns out it was a voltage regulator... Which is a shame! I've got some on my next order though to give them a try in a few weeks! \$\endgroup\$ – Timeless Apr 12 '17 at 12:55

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.