H-Bridge (HIP4082IPZ) & stepper motor (PM2515-03)

Hey guys

I'm trying to hook up the above to components and I'm having some difficulty.

http://www.mantech.co.za/Datasheets/Products/HIP4082.pdf http://www.mantech.co.za/Datasheets/Products/PM25XX-FULL.pdf

I managed to get the motor working without the H-Bridge using the Arduino Stepper library, but there didn't seem to be much power. Also, the other odd thing about it was that, it worked if I had the 4 control pins in, but as soon as i put one (or both) of the supply's in it just vibrated.

I then hooked up the H-Bridge, but because of my limited knowledge of it, nothing seemed to work. THE H-Bridge did get a bit warm though.

And looking at the datasheet for the bridge, I'm confused as to whether I need the bootstrap pins, and the delay. Are they just there for protection?

Any help would be much appreciated.

Regards

I'm curious how you got the motor to turn without the H-bridge. I can't open the datasheet for the motor -- it crashes my browser every time.

You do need the bootstrap circuit; otherwise, the chip won't be able to switch the high side MOSFETs. You also need the delay, because that holds off switching the high side MOSFETs long enough to prevent shoot-through, i.e. both MOSFETs on one side turning on at the same time, shorting power to ground.

What kind of MOSFETs are you using for switching?

The H-Bridge looks pretty standard. 4 channels, nothing too fancy. I've never needed any additional circuitry to get my H-Bridges working. Usually any extra circuitry is to protect the Arduino from back-EMF. The motor coils are essentially an inductor, which resists sudden changes in current flow. If you suddenly switch off the power, there will be some residual current in the motor coil which attempts to continue to flow. It always drains through the path of least resistance, which may be through your Arduino board if you don't protect it from doing so.

The pdf for the stepper is for an entire line of similar motors, so it's unclear which model you actually have.

One of the biggest gotchas for using H-Bridges is that you need to link your H-Bridge's ground to the Arduino ground. Otherwise your ground floats and the noise in the circut causes the motor to vibrate. The noise is actually turning on random channels for very brief moments randomly.

Your H-Bridge is ok to get warm... but not hot. Check the specs in the datasheet. It says it can go up to 125 degrees C, but it should never get anywhere near that. There is some warmth that comes off it because of how fast it's switching the direction of current. That's to be expected.

The motors, however, should not be getting very warm. The datasheet says it could increase 80 degrees C at maximum. (So, 80+room temperature... about 100 degrees C). Usually, if they're getting warm, you're pushing too much current through them. When the coils of the stepper motor are un-energized, the motor should spin freely. However, if you leave one of the coils energized, there will be resistance when you try to spin the motor shaft by hand. This is because the electricity running through the motor's coil is causing a magnetic field. There must be current flowing to maintain the field. Usually motor coils do not provide very much resistance. Usually less than 50 ohms. So keeping a coil energized for a long period of time is basically leaving a short circuit. This could cause your motor to warm up, if you're running it with a lot of current. Best practice is to un-energize the coils whenever you don't need holding torque.

If you have a current limiting power supply, I'd suggest you use that until you have the correct level for your motors worked out. More current = more torque (and slower stepping speed) but also increases the risk of damaging either the motor or the H-bridge.

The motor datasheet says you can use up to a max of 450mA per phase in the motor coils. So if you ran all 4 coils at the same time, you'd need 2A. But, with 4-wire stepper motors, you never have all 4 channels active at the same time. It can be driven in full-step or half-step, which is essentially saying that you drive the motor with just 1 phase at a time, or 2 phases at a time. So you'd only ever use a max of 1A.

The H-Bridge datasheet says it'll handle 1.25A, but I couldn't find if that's total, or per-channel. At any rate, you should be fine, the H-Bridge should be able to handle that motor.

One other issue is that you could have your motor coil lead wires mis-matched. That can cause the motor to stutter-step or to step only at certain resonant frequencies.

That chip isn't an H-bridge; it's an H-bridge driver. It requires external power MOSFETs to do the actual switching. The 1.25A rating is the maximum gate drive current, which is about right.

Thanks for the reply guys.

To get it working initially, I just connect the 4 control wires directly my Arduino output pins, and it just worked. So, with the supply wires, do I "turn those on" when I want it to stop spinning, to just get it to hold something?

Hmm, bugger. I didn't know there was a difference between a bridge and a bridge driver. So I'll have to do some more research now.

I'm also just concerned about the load it will be able to carry, because, perhaps it was just the way I hooked it up, but when I attached a wheel to it it didn't want to go anywhere.

An H-bridge is the arrangement of transistors or switches in the form of an 'H' that lets you drive current across the load in either direction. An H-bridge driver is a circuit that powers the switches (usually MOSFETs) that make up an H-bridge.

The reason it had no power when directly connected is because the Arduino can't source/sink much current.

Also, I'm a little confused about how you intend to drive your motor. If you're wiring it up as a unipolar stepper (which seems to be what you're describing), then an H-bridge is inappropriate -- you just need four MOSFETs or NPN transistors switching to ground. If you're wiring it as a bipolar stepper, you need two H-bridges.

The Wikipedia article (http://en.wikipedia.org/wiki/Stepper_motor) on stepper motors does a decent job of describing why that's so.

Ok cool. That's pretty much what I thought. I was a bit confused as to how the H-Bridge Driver I have would give me what I needed.

Now it all makes sense. I'm going to use 2N2222A transistors.

Ok, that didn't wok...

The resistors just got super hot and burnt out :/ Do I have to put resistors to the motor leads? If I do, why? Surely the transistors can handle the current from the 5V Arduino supply.

And the motor didn't even budge. I'm not sure what I'm doing wrong.

I'm going to use 2N2222A transistors.

Ok, that didn't wok...

The resistors just got super hot and burnt out :/ Do I have to put resistors to the motor leads? If I do, why? Surely the transistors can handle the current from the 5V Arduino supply.

And the motor didn't even budge. I'm not sure what I'm doing wrong.

Willy-nilly sticking parts together?

Do you have a circuit diagram?

Not really willy-nilly.

I couldn't get the Fritzing program to generate a nice diagram, but here's the somewhat messy breadboard layout.

I put the two resistors in before leading the 5V into the transistors, which stopped them from heating up, but still nothing in the motor. I also put LED's in to see if things were working, and they did flicker, so current was flowing.

The Arduino pins are connect to the following, according to the motor datasheet.

Pin2 - Red Pin3 - Black Pin4 - Yellow Pin5 - White

I'm not sure if it's entirely correct though.

The whole reason for using a transistor is that it is a switch. It takes a little bit of current to turn the switch on, allow large amounts of current, from an external source, to flow.

You are using the transistor to turn on current flow from a low current source - the Arduino. That is nowhere near enough current to drive a stepper motor.

4 transistors, 6 resistors? Why are there not equal numbers or integer ratios?

If I don't have those two resistors coming from the 5V, the transistors get super hot and burn out.

I also hooked up a 12V battery, and used the VIN pin, to try get more power and still it didn't move. It is a 5V stepper motor.

It takes a little bit of current to turn the switch on, allow large amounts of current, from an external source, to flow.

The transistor is too switch an external power source. The Arduino can NOT supply the current needed to power a stepper motor.

Repeat after me. “I need to get the correct stepper motor driver, since I don’t know what I’m doing”.

Do you not think that if I knew what I was doing, it would all be working, and I wouldn't need to post here?

Forums are a place to learn. Why tell someone they don't know what they are doing when that's the reason they are asking the question.

Perhaps you didn't read all the posts above.... I do have a driver, the HIP4082IPZ, but it was mentioned that I didn't need it as I can just use transistors.

Perhaps you missed this...

I also hooked up a 12V battery, and used the VIN pin, to try get more power and still it didn't move. It is a 5V stepper motor.

If I can't just use the vin, then perhaps you could have told me that.

If the Arduino can't supply the power then please could you explain the following...

http://www.arduino.cc/en/Tutorial/StepperUnipolar

Perhaps you could also tell which driver I should get, since I don't know what I'm doing, and why I actually need a bigger supply, when it's a 5V motor.

I'm actually not even going to bother posting on this forum anymore if this is the attitude when people humbly ask for help. All I want is to learn from mistakes, not be pushed down because I don't know everything like the mighty Paul.

Is that the same stepper motor that you have?

Do you understand the difference between voltage and current?

Just because a device is a 5V motor does not mean that every 5V power source is going to be able to power it. A 40mA pin is limited to 40mA. And even that much is not good for the Arduino to deliver on a regular basis.

If the stepper motor needs 15A, 40mA is like a gnat trying to push an elephant. All it will do is annoy the stepper motor.

According to the data sheet you linked to, the motor you have needs 0.5A per phase. The Arduino can not supply that much current.

For small motors like yours, a motor driver shouldn't cost more than $15 US. Since you don't seem to know how to design a driver yourself, you could save yourself a lot of aggravation, and avoid the risk to the Arduino, by just buying one.

But, it's your motor, your Arduino, your time, and your dwindling supply of parts.

Check this one out. At $2.35, it’s hardly a budget breaker.

If the Arduino can’t supply the power then please could you explain the following…

http://www.arduino.cc/en/Tutorial/StepperUnipolar

If you go to the bottom of that page, there is a link to the specs of the motor in the picture.

It says:

When the center-taps of these motors are connected to +12 and one end of either winding is grounded, the winding will draw from 170 mA to 250 mA, depending on the motor

Their motor draws about half the max current your motor does. ie: If they activate 2 phases at 250mA, they’re at 500mA. If you activate 2 phases at 450 mA, you’re at 900mA. Keep this in mind when you read further about power supplied from USB.

If you check out the specs on the Arduino (This is the Duemilanove, pick yours if you have a different one).
http://www.arduino.cc/en/Main/ArduinoBoardDuemilanove

DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA

These are limited to 40-50 mA because the current is actually traveling through the microcontroller. If you pull much more than that through the microcontroller, you’ll burn it out in short-order.

If you hook it up directly from the VIN pin (like they did in the picture, and like your schematic showed), this is completely different. The Current coming into the VIN pin does not go through the microcontroller. It does, however, use the board’s routing to go over to the pin headers, which could be an issue if the board doesn’t have wide enough routing. With that aside, the routing is fine for 250 mA. So their picture looks good.

But… they have the board hooked up supplying power through the USB cable in the picture.

Wikipedia describes what current can be drawn from a computer’s USB:

A unit load is defined as 100 mA in USB 2.0, and was raised to 150 mA in USB 3.0. A maximum of 5 unit loads (500 mA) can be drawn from a port in USB 2.0, which was raised to 6 (900 mA) in USB 3.0. There are two types of devices: low-power and high-power. Low-power devices draw at most 1 unit load, with minimum operating voltage of 4.4 V in USB 2.0, and 4 V in USB 3.0. High-power devices draw the maximum number of unit loads supported by the standard. All devices default as low-power but the device’s software may request high-power as long as the power is available on the providing bus.

The Arduino is set to be a high-power device as far as the USB host controller is concerned:

The Arduino Duemilanove has a resettable polyfuse that protects your computer’s USB ports from shorts and overcurrent. Although most computers provide their own internal protection, the fuse provides an extra layer of protection. If more than 500 mA is applied to the USB port, the fuse will automatically break the connection until the short or overload is removed.

Even at 500mA, I wouldn’t risk pulling that much through my computer. If your motors draw anywhere near 500mA, but not enough to trip the polyfuse, it’s likely that your Arduino will not have enough current to continue running properly. It’s also likely that attempting to pull more than 500mA from the USB is causing your problems.

Even though the Stepper Motor example on the Arduino page shows the motor hooked up to the Arduino that way, they shouldn’t have done it. It wasn’t smart. People who copy that design without knowing the implications of doing so are likely to damage their Arduino, or that it just won’t work. They pictured it that way because it looked simple and easy.

There are some implications of powering both the Arduino and your Motors off of the same power supply. For example: The Arduino only requires 7-12 volts to run properly, but is probably ok to run with 6-20V. They only list the voltage there, because the current consumption will vary as you connect periperhals, and depending on how much the processor is doing. Unless there’s a short, or a peripheral that wants to sink a lot of current, the Arduino will run with a fairly low current. The danger of supplying the Arduino with an over-zealous current supply (one that can supply much more current than the Arduino needs) is that if something does go wrong, you’ll burn out your board… because the peripherals can pull the current through the microcontroller.

It is a much safer practice to use two completely seperate power supplies. Power the Arduino from one with a much lower current, and the motors off one that is higher. This way, if the Arduino (or the motors stupidly connected directly to it) attempt to pull too much current, it burns out the power supply, not the Arduino. Protect the part that costs the most. A black-box AC to DC wall-plug power converter costs $2 at a 2nd hand store. That’s way cheaper to replace than your Arduino. A free motor from a disk drive, or a $2.35 transistor package is a lot cheaper to replace than your Arduino.

The truth is that the Arduino board is probably manufactured to handle more than what they rate it at, just so people who do stupid stuff like that don’t destroy their boards. So it’s true, they probably got lucky and their example worked with the hardware they were using. --or-- they read the datasheets and knew what they were doing. At any rate, they shouldn’t have put it up as the model example, because people blindly copy the picture and don’t take time to look at what’s really going on.