Stepper library with homemade H bridge

Hi guys,
For a project (in groups of 4), a friend of mine had to design a H bridge, see added picture. With the h bridge I want to control a stepper motor, and I had seen that there's a library which we can use but in the library they use a H bridge, which you can buy and the look like the picture added. But we can see that the H bridge which we made and the H bridge which is used in the examples at the library are not the same. So I'm wondering does the library even work with the H bridge that we use or do I have to create something like a PID regulator?


I hope the pictures are visible, because I see that the forum had updated.
Well I see that I can only upload one image so here's the link where you can see the H bridge which is used in the examples: https://www.arduino.cc/en/Tutorial/LibraryExamples/MotorKnob
Snor

Bipolar drivers are not really up-to-date, better use MOSFETs instead.

Your driver should have an already existing hardware interface, as known to the stepper library.

You dont control a stepper motor with a H bridge wired as a “H” configuration as would be used with a normal DC motor , where the current through the winding can be reversed ; you use the drivers to switch each winding separately .
A stepper has two ( or more ) separate windings that a driven by separate circuits with a series of sequential pulses to make it revolve , by changing the sequence , not the direction of connection to windings, you reverse it

Bipolar steppers require a H-bridge. Only unipolar steppers can be driven by transistors. Current driven steppers or microstepping require even more efforts.

I’ll stand corrected - never used one of those ? Sorry if I’ve confused matters.

( just read up on that -thx)

Congrats, some people still are capable of learning :wink:

2 Likes

Stepper motors should be current driven, with special chips like the A4988 or the DRV8825.
Only some (high impedance) steppers can be voltage driven with a plain H-bridge.
So it all depends on which stepper you're using, but a common H-bridge is usually a bad idea.
Leo..

Thanks guys, I will look further into it!

Wawa is spot on. From what I read in your question, a driver board like that A4988 is the easiest. These are very cheap to buy and are very capable. You can adjust the max current also which is important for steppers.
Plus, if you want to do micro-stepping that that is also standard on the A4988.
Essentially, at a basic level, you supply 2 signals: Direction (1 or 0) and step pulses.

Yes, but we had to make one ourselves (as part of an assignment)

Was the stepper motor provided, and what are it's coil resistance and current limits.
Leo..

Does your circuit have a DIR and STEP input? Then it is compatible with all stepper libraries.

Else study and implement the L293D interface, it should be compatible with all driver libraries.

And where is the other H-bridge.
Steppers usually need two.
Leo..

This is what I found.
image

That I do not know, because it was not me who designed this, but a group member of mine.

Blockquote
#include <Stepper.h>
int Sensorpin = 6;
int Hoekverdraaiing=0;
int Draaifout = 0;
const int stepsPerRevolution = 200; // stappen van 1.8 graden
// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
int BeginSignaal = pulseIn(Sensorpin,HIGH);
int HuidigSignaal = BeginSignaal;
void setup() {
myStepper.setSpeed(80); //zou tot 100 rpm wel kunnen denk ik
pinMode(Sensorpin,INPUT);
}
void loop() {
int SensorSignaal = pulseIn(Sensorpin,HIGH);
if (abs(SensorSignaal-BeginSignaal) >=85) {
Draaifout+=1;
}
else if (abs((SensorSignaal-HuidigSignaal))*360/(1025)>=1.8){
myStepper.step((SensorSignaal-HuidigSignaal)360/(10251.8));
HuidigSignaal = SensorSignaal;
}
}

That's the code I wrote, I tried using the stepper.h library, but I can only test it next week so I'm not sure if it would work

That is a high-impedance stepper (34 ohms), and can be driven with two common H-bridges powered with 12volt. Just don't expect high speed with that setup.
Leo..

That's okay, do I have to add a delay then in my code or will it work even without one?

Try to understand the AccelStepper library. Each physical setup (motor, load...) has a specific maximum acceleration and speed. That means a delay is required so that the maximum or desired speed is not exceeded, and possibly a variable delay until the speed is reached.

I see,
So it's better that I use the AccelStepper library (and maybe use classes because my arduino also needs to do other task while operating the stepper, so those tasks won't suffer from the delay)

Hi,
Welcome to the forum.

Can you please post a copy of your H-Bridge circuit so we can comment further on how to use it with an Arduino controller?

Tom.... :smiley: :+1: :coffee: :australia: