Let's Make Robots!

A4988 and steppers My experience and mistakes

I've bought a few of the pololu stepper drivers A4988 to populate a ramps1.3 board used in printrbot. Before building the mechanics I soldered together the ramps board and plugged it all together with my arduino mega2560 and the drivers. Having tried to work out the best software combination with marlin version and either pronterface or replicator G I could not for the life of me get any action from the steppers in the control panel for either host software.
Anway I tried with only 1 driver plugged into ramps at a time just in case there were any shorts etc. After much persevering of trying many things and bleary eyed in the dim light at night I accidently misaligned the driver in the ramps slot and sparks and smoke ensued.
Realising I'd not only damaged the driver but my mega as well I immediately ordered replacements.
However it's at least a 2 week wait from China. So I thought I'll start back at the basics with my arduino duemilanove and the A4988 in a breadboard.

Having checked the circuit diagram for minimal wiring with the pololu information I wired it up found some arduino code and gave it a try.

Ok motor action, great. Hangon, no not great. It runs for a moment then stops and squeals like a bitch.
Disconnect, reconnect does the same thing, runs for a little then stops and squeals.
Ok so at this stage I have no idea what it can be. I read instructions in many places about the wiring of steppers thinking I may have it wrong.
I experimented with different current settings on the trimmer pot with no success. I have 2 different types of motor now because I thought perhaps I'd bought unsuitable steppers. Assisted by some nonsense I read somewhere that the pololu drivers don't work too well with the low voltage high current motors I'd bought.
Now I am big on reading datasheets maybe not always thoroughly at first but it is the thing you do. So I wondered at the start what kind of frequency you could use with the step pin. One pulse makes the stepper step once. So looking at the datasheet on page 6, I see logic timing.
There it says minimum step pulse 1us time on and 1us time off. Fine well thats as low a resolution as the arduino goes so I picked 2us on/off.
I even checked with my oscillosope at one stage to see how accurate it was and it was satisfactory.
However WRONG!!!
Update 21/10/12 - As Oddbot pointed out below this minimum refers only to the chip and not how fast your stepper
                                  can step. At 1us steps your stepper would have to be capable of 150,000 RPM

After much frustration and at the point of what the heck I'll try anything I changed the timing to 1 millisecond on/off. What do you know it works?
So I then set about finding what was the actual minimum on/off time for step frequency and it turned out to be 350us. Thats a bloody long way from 1us.
Now I just have to work out what needs changing in the pins.h and configuration.h to get it to work with my mega and ramps. 
Looking at pins.h for the mega2560 section the pins seem completely out. Like there is no pins 60 and 61 on a mega?
Only the z axis seems to have correct step and dir pin #defines.
Correction 21/10/12 - I have since learned the analog pins 6 & 7 are digital pins 60 &61

If anyone can explain why the pins.h file has these pin numbers for the mega2560 I would love to know. Also what else do I need to change in the marlin files to get it to work nicely?

One other thing do not forget the bridge from sleep to reset.  a floating value on the reset will cause you grief as well.

Now hurry up China Post I need to sort out Marlin and Ramps.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Hi Dears

Can I Use stepper motor "1.65A _2.4V" by A4988 Driver?

please guide me...