Need help with writing code for two stepper motors

Hello I’m trying to use an adafruit motor/shield v2 in combination with an arduino uno to control two 12V 1.7 A 666 oz-in bipolar stepper motors to turn two power screws. The application is for my senior design project and is intended to be part tensile testing machine. We’re currently having trouble getting started with the code and would like some guidance. We would like the motors to be able to turn the power screws in an upward manner. Below I provided a CAD model of our device and will also provide link to motors we’re using. The aim is to have the motors turn a power screw lifting plate pulling apart our sample.

http://www.robotshop.com/en/geared-bipolar-stepper-motor-3v-555-oz-in.html

:%

The usual questions apply. What have you tried? What were the results?

an adafruit motor/shield v2

Hunting is not my thing. Provide a link.

Do the motors have to turn together? If so then wire them up together and they will track.

Sorry about the lack of adequate info after a reply from adafruit, apparently the motor shield is not adequate for controlling our two stepper motors however after doing some searching I found a shield that I think might work. The one listed below supposedly can handle to 2A per coil which should be enough for our 1.7A motors.

the new motor shield I hoping that works

http://www.robotshop.com/en/dual-bipolar-stepper-motor-controller-arduino.html#description

the motor description

the link for motor description

http://www.robotshop.com/en/geared-bipolar-stepper-motor-3v-555-oz-in.html

I can't see if there are heat sinks for the A4988 chips. If not they won't manage 1.7amps. I understand they need decent cooling to go beyond 1 amp and I have heard (elsewhere on the forum) that the claim for 2 amps is very optimistic. Unfortunately the price goes up steeply if you want a beefier controller.

The driver boards have potentiometers that allows you to limit the max current.

With a 99.5 to 1 gear box ratio you will have mathematical fun relating the number of steps to the number of turns of the output shaft.

It seems the gearbox can't take the full motor torque which may mean you can run the motor with a lower max current well within the scope of the A4988.

...R

Thanks Robin, I have access to a C.N.C machine at school what if I were able to manufacture a heat sink for the A4988 chip. Also do you have any suggestions or idea on how difficult it would be to write the code outside of the calculation for number of steps for control of the two motors. I need them to turn in sink. Some above suggested that I should wire them together

You need two motor drivers, one for each motor. If they are the same, to make the motors step together, just wire the motor driver inputs (e.g. STEP and DIR) together and send the same signal to both.

Agreed that the A4988 motor driver chip cannot handle 2 amperes/winding without agressive cooling, and maybe not even then. You may have to enable the current-limiting feature and live with lower motor torque.

Make your own drivers - http://forum.arduino.cc/index.php/topic,84809.0.html - is one I did using ATtiny2313. The transistors you use can be sized for the current you need to drive your motors.

Before you go to the trouble of making heat sinks I suggest you limit the current to (say) 0.9 amps and see if that gives you enough torque for your application. In view of the cautionary words about the strength of the gearbox I suspect it may be enough.

As @jremington said, getting the two motors to step in sync is easy. The maths only comes into it if you want to figure out how many steps are needed to to precisely (say) 12.5 turns of the output shaft and then undo those 12.5 turns exactly. Because it must eventually resolve to integer maths I suspect there will be odd steps that cause things to stray from the base condition over time. But maybe that level of precision isn't needed for your application.

I don't think I would take on the job of making my own driver board. For a little while I toyed with buying the Allegro A4988 chips but sense prevailed and I bought the Pololu boards. However I will study @kf2qd's link.

Edit to add ... I have had a quick look at that link and it hasn't encouraged me to make my own driver boards. The Allegro A4988 chip has a huge amount of capability built in that would take an enormous effort to replicate, particularly the ability to limit the current in the motor coils so you can use a high supply voltage without frying the motor.

...R

So I wanted to say thanks for all the replies and input first off, second I have taken the advice of jremington and looked up drivers I think I found some adequate ones and just wanted your opinions. The plan is the wire the drivers in parallel and run them to an arduino, I hope you guys don't mind me asking for more help when comes to wiring the drivers in parallel and then connecting to the arduinos. The drivers I'm thinking of using are presented below:

How would I wire this driver with an arduino ?

You have only shown part of the specification - a link would be more useful.

It seems to have step, direction and enable pins just like the Pololu A4988 driver so I presume the connections will be the same.

...R

http://www.cnc4pc.com/Store/osc/product_info.php?cPath=75_74&products_id=493

user manual link: http://cnc4pc.com/Tech_Docs/PoStep25_UserManual.pdf

Thanks. I don't see anything to contradict my earlier suggestion.

...R

Thanks, so the drivers I posted should work ?

I think so, but I'm not giving a guarantee!

And I have no idea whether they can really deliver 2.5 amps continuously. Paper doesn't refuse ink and screens don't refuse pixels.

As a matter of interest where are you getting them and how much do they cost?

...R

I just want to say thanks for all the response once again, So did some further consulting with a friend who also has some experience with steppers and decided on this. Its a driver than can handle 4.2 A

http://www.cnc4pc.com/Store/osc/product_info.php?cPath=75_74&products_id=478

Also did some research I should be able to run the two stepper motors of the same driver with this guy

and for drivers previously listed they are from cnc4pc.com and cost $29 per

http://www.cnc4pc.com/Store/osc/product_info.php?cPath=75_74&products_id=478

Posted above is a link to the driver I will be buying

and below a link for the previous driver I was looking at

http://www.cnc4pc.com/Store/osc/product_info.php?cPath=75_74&products_id=478

Thanks you guys so much greatly appreciate the advise and the effort to help

There was another Thread here recently where the OP had a driver board that contained 4 stepper drivers. I can't remember the current capacity. It seemed good value if you need to drive 4 motors http://forum.arduino.cc/index.php?topic=226046.msg1636469#msg1636469

...R

Hey Robin you've been a great help with your suggestions, would it be too much trouble to ask you to help me write the code or provide a few pointers for beginner writign code for the arduino

You keep posting and I'll keep reading.

Just as long as you do most of the hard work.

...R