And the parts list:
- 2 EasyDriver motor drivers from Sparkfun
- 2 12V 4-wire bipolar stepper motors from Sparkfun
- 1 12V small fan
- 1 slide switch
- 2 LEDs with 2 220K resistors
- 1 small flyback diode
To run two motors at a time, I wrote a small sketch that alternates movements between the two motors. The control of a motor is wrapped up in a for loop, so there is no way to run two stepper motors simultaneously. For example:
for (int j = 0; j<steps1[i]; j++)
{
digitalWrite(steppin1, LOW);
digitalWrite(steppin1, HIGH);
delayMicroseconds(spd1[i]);
}
for (int k = 0; k<steps2[i]; k++)
{
digitalWrite(steppin2, LOW);
digitalWrite(steppin2, HIGH);
delayMicroseconds(spd2[i]);
}
The steps1, steps2, spd1, and spd2 are just arrays of values that I was using to test the motor movements. As you can see, the program runs through the first loop then the second, not at the same time. The only way to run them at the same time would be if they were moving for the exact same number of steps and speed. I'm not sure how to deal with that at the moment.
Another option aside from writing my own code is to find someone who has written it already. That is the beauty of Arduino: people post their projects on the web and give you access to the code. I found a project that a group of people have been working on called "RepRap." The RepRap is a self-replicating 3D printer, meaning it can print plastic parts that can then be used to build another RepRap. And it runs on an Arduino sketch! The only difference between a RepRap and what I want to do is that the third "axis" on the RepRap is a thermoplastic extruder. All I have to do is modify the RepRap code to run three stepper motor axes. And as it turns out, someone already did that, too. I still have to modify the code though because their hardware is a little different than mine.
Phew, all that and I still have to find a way to draw parts to mill (I'm thinking Google Sketchup), a way to generate a toolpath, a way to generate G-code from the toolpath, and a way for an Arduino sketch to read G-code (probably through serial using another application). Finding a way to do all of that will be very difficult. It might be a while before I actually implement anything for this project, so I'll probably talk about my other project in my next post. What is it? Well, all I will say is that it has to do with the sun.
No comments:
Post a Comment