# Bipolar Stepping Motor with selfmade H-bridge

Hello everybody,

This week I found again a bipolar step motor in an old scanner but it looks bigger then the one I found before, so i decided i'll try again to get a step motor running.

When I asked last time about step motors I got a lot of replies that I should just use a prebuild H-Bridge like the L293. I'm thankful for all the replies, but as I'm new to electronics I prefer to build the circuit myself and understand what's going on and why. That's why I'll try to build the H-Bridge myself, like I "designed" in the schematics below:

All the transistors are NP2222A, the diodes are 1N4001 and the step motor is a STH-39D1126.

To rotate the motor clockwise I would basically program the Arduino as following:

D0 D1 D2 D3

where D0, D1, D2 and D3 are the digital pins and + stands for HIGH and - for LOW.

My questions are:

Will this theoretically work or are there any "big" problems?

Which restistance should R1 - R4 have? I know that the resistors are there to protect the arduino from to much current, but how do I calculate the value?

How can i figure out which voltage I should use for my step motor? It's an STH-39D1126, but I can't find any datasheet.The only thing i know is that is has a coil resistance of 4,1ohm.

Are the transistors and diodes ok for this purpose or should I use others? Sorry, I know basically how they function, but when it comes to there specification, I'm pretty lost.So I would be really grateful if somebody could explain why they are "good or bad" for this purpose. But this would be an extra task for somebody who is explaining mood :).

Thank you very much for any reply.

Will this theoretically work

No, the circuit is wrong. The base of Q2 and Q3 are connected together. The voltage on Q2 can not be more than 0.7V the Vbe of the transistor, therefore the voltage on the base of Q3 can not be any greater so you can never turn it on.
Normally you should use PNP transistors in the top of the bridge.

The only thing i know is that is has a coil resistance of 4,1ohm.

So ohms law says the current will be 5 / 4.1 = 1.2 Amps. The 2N2222 has a maximum current of 600mA the equals destruction of the transistors if the circuit could work, which it can't.

Thanks for the fast answer... I still don't understand the first problem, but i'll read up on it.... Thanks

For a switching transistor you want it to be off or on, and not anywhere in-between. At full-on (saturation) the collector voltage should be close to the emitter voltage (say 0.1V or less above the emitter voltage).

However the base will be 0.7V or so higher than the emitter - so in your upper transistors this cannot be the case - at best the bases will be 5.0V, the emitters 4.3V, and 0.7V between collector and emitter. If the motor takes 1.2A, this means the transistor will dissipate 1.2x0.7 = 840mW. If it was saturated it would be more like 1.2x0.1 = 120mW.

Using PNP for the upper switches means the symmetrical equivalent circuit can be used - and full saturation is achievable - the motor terminals only connect to the collectors of the transistors.

Aim for transistors that can comfortably handle 2A, say, and have high gain at high current (> 50 at 1.2A) or the Arduino pins will be overloaded. I've used STX724 / STX790A in the past for similar circuit, but they would need about 30mA base current to saturate, a little close to the Arduino's limit of 40mA.

Darlington's are much more easy to interface since they have plenty of gain, but they lose a lot of voltage (1.5V or so each instead of 0.1V or so for standard transistor) and will run very hot.

Thanks for the great explanation. I think it made a lot of things clearer and i hope i understand my problem now. I also read a little about transistors and made a new schematic :):

And again: Will this work?

I choose the resistors 220ohm, so the current on the base will be 20mA. Hope that will be enough to saturate the transistor.

Do you know any other transistors i could use, except "STX724/STX790A"?

I found some 2N5336, which can handle up to 5A, but i dunno how much base-current they need to be saturated.

And will the 1N4001 diodes be fine? They handle 1A average-current and 30A peak-current.

Thanks again

Getting closer. Hove vet don't use pins 0&1 as these are used fore the serial port.

Now that will switch if the output line is zero or five volts but what happens as it makes the transition between the two. There will be a time when both Q1 and Q3 are on at the same time thus shorting out the power supply. This is known technically as shoot through.

Good comments and advice. However, the schematic of the H-Bridge is not safe. Inductive spikes can go back to the Arduino and damage the board. The transistors must be high current, like TIP31 or some MOSFET type. There is no isolation between the Arduino and the H-Bridge. I suggest using a chip and many have suggested, just to be safe. Keep the power supplied to the stepper seperate from that which supplies the Arduino.

IMO using optoisolators like that will make matters worse. Optoisolators turn off more slowly than they turn on, which will greatly increase the amount of time during which shoot-through occurs.

1N4001 diodes are OK for this application. They have a peak current rating of around 3A (depending on the exact variant), and in this circuit they will need to pass less than 1.2A for short periods only. Alternatively, a single 1A bridge rectifier can replace all 4 diodes in one H-bridge.

The main problem with that circuit is that 1.2A is a little too high to be using BJTs driven from an Arduino. Above about 0.5A, mosfets are a better choice. Unfortunately, the most economical mosfets for this sort of current are mostly available only in SMD packages - especially the P-channel ones.

Elokuu:
How can i figure out which voltage I should use for my step motor? It's an STH-39D1126, but I can't find any datasheet.The only thing i know is that is has a coil resistance of 4,1ohm.

Thank you very much for any reply.

I'm driving an STH-39D1126 at 4.5 Volts using a SN754410NE H-bridge and the circuit is drawing ~0.8 Amps. The shaft resists movement when one coil is powered with 3V so you may also be able to drive it at 3V as well. The SN75410NE only supports voltages as low as 4.5V. Also, I found that the hookup wires are out of order. The dark and light tan wires form one coil with the yellow and magenta wires forming the second.

You don't want shoot-through at all - nasty current spikes will generate heat in the transistors, possibly damage them and give more interference in any sensors.

Separate control of the two desired current paths in the H-bridge is one nice way to do this - use cross-connected topology:

Each control input turns on one current path, you just ensure one is turned off before the other is turned on, allowing
enough deadtime for the transistors to de-saturate (1us is a good guess for this, so using digitalWrite will be slow enough).

Here the resistors R5 and R6 are chosen to provide adequate base drive for the supply voltage involved. Choosing low-saturation
voltage main transistors is going to help - the 2N2222 is an old device and nowhere near the state of the art, note. Finding transistors
with 0.1V Vsat at 1A will be worth it (you'll only lose 0.2V rather than 2V in the bridge).

But back to the problem, your stepper motor might be intended for chopper drive, not H-bridge drive, in which case using a
bridge is likely to both over-drive it and get only low speeds from it - what was the supply rail voltage for the scanner the motor
came from?