1
\$\begingroup\$

I think that I may have come up with a possible way to control a bipolar stepper motor using 2 simple H-bridges. The idea is to control the direction and the steps of the motor by switching the direction of the current flow using the H-bridges. Unfortunately, I am running into a few annoying issues. I am using a ROB-09238 bipolar, 1.8 degree step value stepper motor. I have an external voltage source of 12volts@5amps. For one, the rated current of the stepper motor is 0.33 amps, does this mean at max that the stepper motor will use is only 0.33 amps, or is this the average amperage? I am using a Raspberry Pi to output 3.3V and control the base of the transistors. The goal is to create an NPN transistor H-bridge using regular 2N2222 transistors. Will these transistors do the job? What is the required resistance value on each of the transistors to do the job efficiently without blowing the transistors?

No matter what I do to calculate the resistance value for the base of the transistors, I either make them get really hot, or can't even get enough current through the H-bridge to properly light an LED. I don't think that I am wiring it wrong because in my circuit simulation program, I get the same results. I have messed around with the resistance values within the program and still can't appear to get what I am looking for.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • \$\begingroup\$ Looking at the 2N2222 datasheet, at 300mA you'd be looking at a Vce of about 2V. The transistor will dissipate about 0.6W (0.3 x 2) with that. With no heatsink and a Junction-Ambient thermal resistance of 200C/W, you're looking at a temperature of about 120 degree C above ambient... In other words, you need a much beefier transistor to switch these kind of currents. \$\endgroup\$ – RJR Jul 16 '14 at 1:30
  • \$\begingroup\$ Thank you very much @RJR, by any chance could you recommend to me a cheep "beefier" transistor, and possibly explain how I could calculate the base transistor values?I am pretty new to electronics prototyping and just need this info. Thanks. \$\endgroup\$ – user3286192 Jul 16 '14 at 1:39
  • \$\begingroup\$ Some alternatives have been siggested in the answers. Generally, go with a transistor in a TIP package - it's easier to heatsink them is required. With regards to the base resistor, it isn't critical but you want to make sure you drive the transistor fully into saturation or it will dissipate too much power and not provide enough current. To calculate this, calculate the minimum base current using the Hfe parameter and then use that current, drive voltage (from the controller) and the base voltage (based on the Vbe at the required current) to calculate the resistor value... \$\endgroup\$ – RJR Jul 16 '14 at 2:57
  • \$\begingroup\$ ... you can't really go too low for the value (as you want maximum saturation of the transistor) - you're only limited by the amount of base current your microcontroller can supply. However if you're well into saturation you don't really gain anything by going lower with the resistor - you are just wasting current from the controller then. Some good reading: electronics-tutorials.ws/transistor/tran_4.html \$\endgroup\$ – RJR Jul 16 '14 at 3:00
  • \$\begingroup\$ Sorry - I mean TO220 package, not TIP. The TIP41/42 are in a TO220 package. Obviously, you also want to look at maximum collector current, required base current to drive the transistor in saturation and the thermal properties. \$\endgroup\$ – RJR Jul 16 '14 at 3:16
1
\$\begingroup\$

If you want to use BJTs, the following ought to work:

schematic

simulate this circuit – Schematic created using CircuitLab

You will, of course, need to do this 4 times.

ETA: I got the labeling wrong on the drive levels. Tip of the hat to Dave Tweed.

Q1 and Q3 take your 3-volt signals and use them to drive the bases of Q2 and Q4. The TIP series transistors are cheap and readily available (you can probably find them at Radio Shack). The 330 ohm base resistors will provide ~ 30 mA base drive to the power transistors, which will be enough for them to turn fully on when driving 300 mA to the steppers. If you use much less base current (larger base resistors), the power transistors will start getting hot, and the steppers won't get their rated current.

And yet another ETA: the 330 ohm resistors should be at least 1/2 watt, and 1 watt is better. Nominal power is .4 watts when conducting.

ETA: If you want to use a transistor as a switch, you want it to be fully on. This is characterized by an emitter-collector voltage of (about) .5 volts or less, and is referred to as saturation. To ensure that a transistor is in saturation, the rule of thumb is to provide base drive at 1/10 the desired collector current. This is not valid in some cases (particularly very high currents), but should work fine in this case.

If you want to really do this right, add 1K to 10K resistors from emitter to base on Q2 and Q4.

\$\endgroup\$
  • \$\begingroup\$ Thank you so much, I would vote your answer up but I don't have enough reputation. \$\endgroup\$ – user3286192 Jul 16 '14 at 3:00
  • \$\begingroup\$ What would the resistor from the base of Q2 and Q4 to the emitter do? \$\endgroup\$ – user3286192 Jul 16 '14 at 3:06
  • \$\begingroup\$ It will control the effects of leakage, ensuring that when a transistor is off, it is really off. \$\endgroup\$ – WhatRoughBeast Jul 16 '14 at 3:23
  • \$\begingroup\$ Your upper-left label is wrong: 3.3V will turn Q3 and Q4 on, not off. \$\endgroup\$ – Dave Tweed Jul 16 '14 at 11:14
  • \$\begingroup\$ Ack! You're right. And I thought I was being so careful, too. \$\endgroup\$ – WhatRoughBeast Jul 16 '14 at 11:29
2
\$\begingroup\$

Keep in mind that when you use NPN transistors on the "high side" of the H-bridge, you need to drive their bases to +12V, since they're functioning as emitter-followers. The emitters can't go any higher than one diode drop below the base voltage.

The better approach is to use PNP transistors on the high side, so that they can be put into saturation for minimal voltage drop and power dissipation. You can use NPN transistors driven by the 3.3V outputs of your controller to switch the PNPs on and off.

\$\endgroup\$
  • \$\begingroup\$ Could you please explain what you are suggesting slightly more simply and what you would recommend doing. Thank you very much! \$\endgroup\$ – user3286192 Jul 16 '14 at 1:49
  • \$\begingroup\$ What he's saying is this: if your power supply is 12 volts, you cannot drive the high-side transistor bases with 12 volts as you show. In order to give the base enough current you will need to provide a higher drive voltage. This does not apply to the low-side transistors. \$\endgroup\$ – WhatRoughBeast Jul 16 '14 at 2:05
  • \$\begingroup\$ So I cannot put 12v through the h-bridge and control the bases of the transistors with the 3.3v from a Raspberry Pi? \$\endgroup\$ – user3286192 Jul 16 '14 at 2:12
  • \$\begingroup\$ As shown, not even close. \$\endgroup\$ – WhatRoughBeast Jul 16 '14 at 2:21
  • \$\begingroup\$ Could you possibly suggest a way to do this with another setup? \$\endgroup\$ – user3286192 Jul 16 '14 at 2:23
0
\$\begingroup\$

Opto isolators are one way to accomplish a work-around for level shifting from your 3.3 volts to the necessary control voltage for the upper transistors of the H-bridge. However if you go to IGBT's rather than junction transistors you can radically improve the efficiency and get higher operating voltages. For stepper pulse rates both opto-isolators and IGBT devices are fast enough to give well shaped pulses.. IGBTs include back voltage protection from inductive devices like stepper motors. (Stepper motors make neat generators of voltage spikes. Extra voltage ratings are a good insurance.)

\$\endgroup\$

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.