Monday, 22 August 2011

Moving in the X and Y axis

Using a ULN2003A darlington array (sometimes called a relay driver when used for switching things on and off) we're working on building our own stepper motor control board.

This isn't quite as crazy as it sounds and there are a few reasons for doing this.
First off, we're making a pick-and-place type machine, so drawing complicated shapes and arcs isn't important. It's not going to be g-code compatible (at least to begin with) so we can use our own protocols and data formats. And it'll be PIC-based, so we can use the USB interface, rather than the usual parallel port.

All we're going to worry about for now is moving in two axes (eventually we'll have three when we introduce the up/down head movement). Traditional CNC machines time their stepper movement, so that when a co-ordinate is sent, both motors are powered to arrive at the correct X and Y co-ordinates the same time.



Our plan is to send values to the controller board, indicating how far in each axis we want the motors to move. The controller board translates these into "steps required per axis" and then sets counter values.

For example, if we're using half-step control, with 1.8 degree motors so that 400 pulses are required for a single rotation, one pulse should create a 0.25mm movement (see previous post for explanation)

We can send data to the control board, saying we want to move 10mm in the X and 25mm in the Y axis. This translates as 40 pulses on the X motor, 100 pulses on the Y motor. So we set the x counter to 40 and Y counter to 100.
Now, on the controller board, we send a pulse to every motor that has a counter value greater than zero, and decrease those counters by one. When all counters have a value zero, we send a report back to the host PC to say we've arrived at our destination.

The resulting movement would be similar to the diagram below:



No comments:

Post a Comment