I've recently made an orrery (dynamic model of solar system) using a mega which I can upload sketches to with bluetooth and wifi. This is a requirement as the device is 3 metres off the floor. Sadly the processing power of the mega struggles to get all 9 stepper motors at full speed.
A due would solve my problems but I haven't managed to find a way of uploading sketches using OTA. I've scoured the forums but wanted to ask the question directly. I could consider using a second controller, even a rasberry pi if I had to, to upload the binary if there was a route in. The bigger boards are needed for the inputs, I need a few as there are seperate encoders and motors for each planet. Wires all over the place.
If you try the same with the DUE (OTA sketch upload) you also need to press the erase button at the same time, unless you have found a cunning workaround?
I'm using accelstepper to drive the motors, with half steps.
The mega drives the 9 steppers quite happily, I have a custom board with 9 separate A4988 drivers. The motor speed is dependant on the number of pulses the arduino can generate in a given time. The motors all spin uniformly to begin with, but when one stops, the remaining motors spin slightly faster, then another one stops and they spin faster still.
I tried the DUE as it's an easy replacement on my board with the same footprint, and hey presto they all span at a much higher speed, with better acceleration and deceleration. The accel documentation suggests a limit of 10 stepper motors.
Not to put too fine a point on it, but is that possibly a side effect of the way you've utilized the library functions? Perhaps there is a way that doesn't behave that way?
I thought that myself, I've tried a number of different combinations of commands and always end up with the same answer. Whatever the limitation is, seems to be fixed when I replace the mega with the DUE. The mega is an 8 bit device while the DUE is 32. It does make sense that the mega just can't get enough pulses out to the 9 motors simultaneously.
I think another arduino, with a solenoid operated plunger, to push the "erase" button in, might work.
How would you put the code to run the 9 motors together? This is what I have...
{
mer.run();
ven.run();
ear.run();
mar.run();
jup.run();
sat.run();
ura.run();
nep.run();
plu.run();
}
while ( mer.distanceToGo()!=0
or ven.distanceToGo()!=0
or ear.distanceToGo()!=0
or mar.distanceToGo()!=0
or jup.distanceToGo()!=0
or sat.distanceToGo()!=0
or ura.distanceToGo()!=0
or nep.distanceToGo()!=0
or plu.distanceToGo()!=0
)