- Joined
- Aug 25, 2007
- Messages
- 3,890
- Reaction score
- 715
I need a little help please. I'm a first time user of an Arduino so bear with me. I have a Uno, Sainsmart LCD shield, but i'm trying to use an H-bridge stepper driver. It uses 4 wires instead of 2 like the Pololu. I tested it through the LCD shield using "stepper_onestepatatime" from the Arduino library. I used pins 2,3,12,13. It works as it should. I thought it might be a simple matter of just adding another "#define stepGo and #define stepDir" to the shetch. No such luck. The LCD program works, but it just causes the stepper to buzz until it gets to where it would go if it were moving, if that makes sense. What else would I need to change? Attached is a copy of what the 2 lines I've added.
The LCD program, which I wrote, requires a stepper controller. A stepper controller provides all the logic necessary to energize the motor coils in the proper sequence and polarity to make it turn in the desired direction. Most stepper controllers also provide current limiting so you don't need to use a specific voltage to get the proper current through the stepper. All the LCD program does is tell the stepper controller when to turn the motor 1 step and in what direction.
Example:
1. Set direction to Forward.
2. Step
The H-Bridger driver is a much lower level device and requires the arduino sketch to provide the stepping logic to the individual coils in the proper sequence to make the motor turn. All the H-Bridge does is amplify the voltage/current and set the voltage polarity. The arduino has to individually tell the H-Bridge which coil(s) to energize and in what polarity.
Example:
1. Energize Coil A, forward.
2. Energize Coil B, Forward,
3. Energize Coil A, Reverse.
4. Energize Coil B, Reverse.
5. Etc...
This is just an example and is not necessarily the right sequence. A different sequence is required to make the motor turn the other direction. You would have to modify the LCD program to incorporate the forward and reverse logic from the "stepper_onestepatatime" sketch to make it work.
Chuck