The last post saw me putting the finishing touches to my machine build, by adding the belts. Unfortunately that's the easy part over, now I'm tackling electronics.
There are two stages to controlling a CNC machine. The first is a controller which will take a Gcode file* and turn it into step and direction pulses that tell each motor when to turn.
The second is a motor driver which takes these low voltage data signals and sends high power signals to actually drive the motor.
For the driver (the second part) I'm using pololu a4988 drivers along with a stepper shield. After finally sourcing all the parts this is what they look like.
The driver is quite small, you can see one of them in the top left. The rest is just capacitors, to even out power, and connectors, to attach all the motors.
This board is a 'sheild' which is intended to be used with an arduino. You can use an arduino as your controller, but I wanted to use a PC because it gives me more control and a nice graphical interface.
Which means I had to build a separate board to make it so the signals to and from this shield could be sent via a parallel cable.
This is what I put together. Again not much going on here, the parallel cable is broken out and the signals sent to the right sockets (so they match up when the shield is plugged in on top).
There is also a 5v regulator to supply the logic voltage and all the connections are optically isolated. This means that the CNC motors and the computer aren't physically connected, this means any noise caused by the motors won't affect the computer.
Bart Dring, of Buildlog.net designed this board which does exactly what I want. But he doesn't sell them anymore. So what I did was buy the arduino version (also designed by Bart, but now made by Reactive Substance) and adding in the missing components so that it was functionally the same. It probably would have been easier to just build the whole thing myself from Bart's schematic. But the black boards help with heat dissipation as well as matching the drivers I bought, and looking badass.
Edit: of course now that the M6 is finished, I could design a new PCB with everything on and mill it on my machine, how ever I'm unlikely to ever get round to this.
Now the shield carrying the stepper drivers, just plugs in on top. Each one of those drivers (now with large blue heat sinks on) controls one of the motors, each motor has 4 wires.
The large silver box off to the left is the 24V power supply, this is the power that is used to drive the motors, the 5V logic is supplied by a small regulator I put on the lower board.
That's most of the hardware set up, the other end is an old PC running Ubuntu, I'm using LinuxCNC to control my machine, it's a very powerful tool (probably overkill for this little thing) but nice all the same.
What came next was lots or testing tinkering and , to be honest, swearing as I tried to figure out why it wouldn't work.
(figured it out eventually WooHoo!)
*Gcode is the end result of designing on a computer, it's composed of simple lines of text that instruct the machine where to go using an absolute positioning system. E.g. g0 x10 y10 would tell the machine to move to that co-ordinate (g0 is just max speed) so kind of like playing Battleships.