Escher Lizard Flooring Project (part 4)

Here’s the router I’ve purchased. It’s an Indimco ICS2500 3-axis CNC router, with a working bed of about 1m by 70cm..

Indimco ICS 2500

It is a sturdy piece of kit (it took four of us to get it in the back of the car) and needed a clean. When first testing it we found it jammed occasionally, but tracked this down to grime that had dried into the grooves of the drive-screw. A lot of cleaning, oiling and greasing later (entirely my Dad’s labour, I have to say) and it runs very well!

Also included with the purchase was an elderly Pentium-2 to control it. The software is MS-DOS based, and controls the CNC via the parallel port. This was an unexpected bonus – not because I’m planning on using it (I’m not) but because when setting up my own controller I’ll need some statistics about the router. If I can get this information from preconfigured software, then it saves me a lot of experimentation and wasted time.

Controlling the CNC is done via a 25-pin D connector. An appendix in the back of the software’s manual reveals the pinouts:

25-pin D connector on CNC.

As you can see, there are two pins for each axis – clock-pulse and direction. The pins are TTL digital, so they can either be off (0v) or on (5v).

The software moves an axis by pulsing the clock-pulse pin. The motors turn a very specific amount of rotation (which in turn leads to movement along that axis) in response to each pulse. Which direction it moves in is dictated by the direction pin. In case you’re interested, this is how quadrature pointing devices (like mice and trackballs) communicate movement to a computer.

So: all I need to do is write software which takes my outline of a lizard, and turns it into very precise pulses to control the three axes of the CNC.

In theory this is fairly straightforward, but in practice it requires a lot of experimentation, writing code to generate reliable pulses at high speed and so on. But fortunately I don’t need to do this, as other people have already solved this problem for me! This is exactly the problem solved by the GRBL project.

I’m dedicating the rest of this blog entry to my notes on getting GRBL to control my CNC. I hope they are useful to someone. I’ll try to provide links to more official help pages rather than duplicate other people’s hard-written notes – otherwise I’ll introduce mistakes.

GRBL?

GRBL is an open-source project that turns an Arduino Uno into a parallel-port CNC controller. It sits between your PC and your CNC (or laser cutter, or engraver). It accepts “G-Code” (a very standard set of commands familiar to anyone in engineering) via USB and generates the very precise pulses understood by the CNC.

To utilise GRBL I must flash the software onto an Arduino (see info here), then make connections from the Arduino to a 25-pin connector.

My CNC also includes limit switches – switches pressed if the cutting head butts-up against the origin of the cutting area. By reading the state of these, the controller can know when the head is in its “home” position – an essential reference point.

Though the software manual wasn’t clear which pins were connected to the limiter switches, a bit of experimentation with a logic probe whilst pressing them soon revealed their wiring. The pins are high when the switches are open, going low when closed.

Here, then, is a complete wiring list for my CNC – referring to the Arduino pin-designations for GRBL:

How to wire an Arduino Uno to my parallel CNC router.

How to wire an Arduino Uno to my parallel CNC router.

My wiring looks like this:

ArduinoGRBLWiring

The Arduino is housed in a metal project box just to better protect it in the workshop.

Easy as that! No buffer circuitry required or anything! I found some jumper-wires out of my junk box (normally used with breadboard experiments), cut one end off, then soldered them to the connector. Though if I were to do this again, I imagine I’d solder a prototyping shield rather than rely on thin bits of solid-core poked into the Arduino.

PC control software

When the Arduino is connected via USB to the PC, it appears as a virtual serial port. To communicate with it I could just use any old comms package to send it commands, which are all text-based. But there’s a few free pieces of software out there that make things a bit more ideal for amateur CNC-ers. It’s worth having a look at the ShapeOko wiki page that lists helpful software. I settled on GRBL controller – which has some niggles, works quite well.

Configuring GRBL

It’s worth spending a good amount of time reading the GRBL Wiki, paying particular attention to the configuration options. For example: I needed to tell GRBL how many pulses-per-millimetre the stepper-motors expect. A quick look at the MS-DOS computer reveals that the value for my CNC is 533.3 pulses/mm. So the commands for GRBL are:

$0=533.3
$1=533.3
$2=533.3

I also needed to reverse the output of the direction pins for all three axes:

$6=224

To configure “homing” I had to activate it, and also configure the axes to be reversed for this process too. That’s because the limiting switches have been installed on the positive end of each axis (they’ll be triggered when an axis is moved in a positive direction) rather than the negative:

$17=1
$18=224

Testing

Creation of “proper” G-Code for my lizard is the next thing to tackle … but for now, here’s a summary of commands I’ve had to use during testing.

$H - return to "home"
G21 - co-ords are in millimetres
G90 - any co-ords supplied will be ABSOLUTE (that is: they'll be
      relative to the origin)
G0 - move at fast speed ("traversal")
G1 - move at slow speed ("feed" or "cutting")
M3 - turn the drill on
M5 - turn the drill off
X(value) - move to position along X axis
Y(value) - move to position along Y axis
Z(value) - move to position along Z axis

When you want to update more than one axis simultaneously (essential if you want to cut lines which aren’t completely along a single axis) then you put multiple commands on the same line. Like this:

X(value) Y(value)

Other notes

  • I’m using GRBL version 0.8c, but the initial documentation I read was for 0.7. It seems that between the two versions, the axis-reversal parameter was changed. I wasted a good hour on that one.
  • We had a lot of problems when reading the limiting switches. The problem turned out to be electronic noise, confusing the Arduino. We fixed that by earthing the 0v line to the chassis.

[Part 1] [Part 2] [Part 3] [Part 5] [Part 6] [Part 7] [Part 8]


One thought on “Escher Lizard Flooring Project (part 4)

  1. FANTASTIC project. Very nice indeed. This is something that I would seriously consider myself now.

    On a side note though, quadrature encoders in mice etc… don’t use direction/pulse coding. They typically use Gray coding with 2 wires/signals which are 90 degrees out of phase. Gray coding ensures that there are no noise/bounce or metastability issues.

    Very impressed though. Looks great.

    BR,
    Steve