After some poking around researching building a small CNC machine for light carving, I came to the conclusion that the Zen toolworks CNC machine was a good deal and would shave months off my project. I figured by the time I collected steppers, lead screws, made parts etc I'd spend a more than this and get a worse result. This kit is the stage, leadscrews and steppers. No electronics/drivers are included. It is fairly small but it looks like a great leg up.
Here is what I'm planning to use
Zen Toolworks CNC Carving Machine DIY Kit 7x7.
Most CNC software uses a computer parallel port to synchronize output bits to control the motor, and perhaps the Arduino isn't really the best solution. However parallel ports are old and obsolete, so I'm going to make my own controller anyway. Irrational decision probably, but buying an old parallel port board makes me nauseous. If i can control all the motors from one Arduino, I can keep the synchronization with no work.
Motor driver controllers are way expensive and even with a coulple Arduinos and motor control boards, I'm probably coming out ahead.
Adafruit Motor/Stepper/Servo Shield for Arduino kit - v1.0
Will try to read back position via cheap rotary encoders,
I may just use the encoders for calibration, or monitoring. A feedback loop solution may be overkill. It depends on the torque and backlash of the motors. TBD.
The software is a journey, but there is tons of stuff on the web, so we will see!
DRIVING THE MOTORS
The stepper that comes with the Zen is this one:
I understand that it can take the higher voltage, but the current will go up. Have to be careful to not step too fast since I don't have a current limiter. Maybe I could put a 1.3 ohm resistor in series to limit the current to 1.68A. It would have to be a 3.6W resistor. They are available as wirewounds for >$1. That would add inductance for sure. I will wait and see how it works first.
Upgraded the L293D drivers with SN754410 in the adafruit stepper motor board, it wasn't driving the stepper very well. They are pin for pin compatible. I will solder two together to get 2A. Three might be even safer. Added a heat sink too. http://www.aavidthermalloy.com/cgi-bin/stdisp_print.pl?Pnum=580200b00000g. Bought this at digikey.com.
Stacking the two driver chips turned out to be tricky, and after making a big solder short, and apparently ruining one driver chip, i found the method to do this. Solder the two chips piggy back BEFORE you put them onto the pc board. Put one in a vice, piggyback the second, then solder tack the end pins on both sides. Then come back and one by one solder the pins together. Then put the assembly into the PC board.
To use a computer power supply, you have to trick it to turn on like this guy shows:
After that, just use any of the red and black wires. Says it will source 32A. wow.
Set it up, used a scrounged PC power connector to plug it in, shorted the two pins as described and 5.1V, cool and quiet. Plugged it into the stepper motor board and the Zen toolworks steppers, and it is working great. The chips do get a bit hot, so i'm thankful for the heat sink and I'm suing the power supply fan to blow across the driver boards.
In this photo you can see the power supply, the Arduino with the motor control board on top, the double stacked driver chips and heat sinks, connected to the stepper motors.
Then i moved on and modified the Adafruit motor shield so that I could stack two shields on top of each other and control 4 motors at once (only have three right now). Made a stand alone post for what I did here, it was so cool. Basically a small hack to give each board it's own latch pin. Only took one more pin to differentiate which board responds to the commands to the motors, and the other motors still hold their value. Awesome!
|Arduino with two Adafruit motor shields on top, connected to the PC 5V power supply and three motors (3rd is out of the picture)|
Now I need to build an Arduino module with the rotary encoders and an LCD display to show the position. I will also have at least one button to set the home position.
Back to the rotary encoders from sparkfun. Some sample code is here:
The sample code worked out of the box, now to modify it to read three encoders.
It makes use of port manipulation to read all the input simultaneously. This page helped http://www.arduino.cc/en/Reference/PortManipulation
Got the three encoder code working, I made a separate post for it so I could include it in the blog, look for it.
I rewrote the code so it made sense to me, the example took a lot of head scratching.
Attached the three encoders to the machine temporarily, and it is working great. Stepped over and back and it returns to the same position. No worries about he rotary encoders missing steps.
found some small limit switches for <$2 a piece. The plan is to use them to interrupt the jumper wire on the PC power supply, thereby killing power if the stage is going to hit the walls. I was advised by a friend that it can be a pain to unstick yourself if you have killed the motor power, but I will turn the stage back by hand if this happens.
WRITING THE CODE
Now I have moved on to coding. Plan is to write or borrow a simple Gcode interpreter than can run on the Arduino. I found this page, making a note:
I hope to be able to use some open source software for the graphics. Looks like the defacto is EMC2. EMC2 is open source CNC software at http://www.linuxcnc.org/content/view/11/10/lang,en/. I will have to use Linux ubuntu for this, but since it probably would be best to use a dedicated PC, Linux is a good choice because I can use an old PC knocking about. Had hoped to use windows to be able to make visual basic widgets. I'll come back to that later. I may need to write some layer of code between the serial ports and the EMC2, since it wants to drive a parallel port and do all the thinking. "G-code" is the format for the commands that EMC2 produces.