Thursday, March 31, 2016

Review: tiny Arduino Nano-based CNC shield

"Keyes_CNC" Arduino Nano shield for 4 axes CNC machines

The Keyes_CNC controller embarks an Arduino Nano
This little board is an "inverse" shield, on which an Arduino Nano must be plugged to provide functionality. It offers the same functionality as a regular Arduino Uno or Duemilanove CNC shield, with the same power.

But the result is both extremely compact and cheap: less than 7€ for the naked shield (or here), and about 22€/$25 for a complete setup: the shield plus an Arduino Nano and basic Pololu stepper drivers (here or there if you want ebay -- but the latter seems to be a reseller). And for once, it seems to come from a Chinese seller who designs and makes its own boards, which I tend to like.


Add a few Dupont wires (well, Jump wire is the generic name) and you are ready to go!
Fifteen years ago it would have cost thousands of euros!



A regular Arduino CNC shield has 4 axes
Important note 1: Even though 4 general purpose input/outputs are left to the user, this shield is not meant for 3D printing. It lacks a fourth axis (for the extruder). It has no support to read temperature inputs and has no power MOSFET or relays to drive the heaters. It is meant for 3-axis machines like CNCs, plotters and laser engravers.

Important note 2: the connectors are not meant to be abused. This is no industrial stuff, and there is no secure way to attach the steppers for example. As usual when a motor is disconnected while it is powered, back emf will generate a high current back into the board, which definitely can kill it. You do not want this to happen! This applies to all boards and all motors, but special care must be taken without better locking connectors.

Also, there is no documentation and GRBL does not come pre-installed. Hence this post.

Board pinout

I had to revert to my multimeter in order to double check the pin attributions.

Place the board in landscape view, with the power plug to the top left. You should be reading "Control by GRBL" in the center of the board in the correct orientation. Also, plug the arduino nano into the board so its USB plug goes to the right side of the board, as in the top picture in this post.

The silkscreen properly shows most of the signals, ground and power lines.

Here are the Arduino pins that control the outputs and the inputs of the board;

Note that the DIR signals are permuted with the STEP signals with respect to regular Uno CNC shields!

''
X
DIR D2
STEP D5
EN D8 (shared X,Y,Z)

Y
DIR D3
STEP D6
EN D8 (shared X,Y,Z)

Z
DIR D4
STEP D7
EN D8 (shared X,Y,Z)

CoolEN A3 (bottom row) and GND (top)
Resume A2 (bottom row) and GND (top)
Hold A1 (bottom row) and GND (top)
Abort A0 (bottom row) and GND (top)

E-STOP RST (bottom pin) and GND (top pin)

Generic extensions:

A7 From top to bottom: GND, 5V, A7
A6 From top to bottom: GND, 5V, A6

Tx TX
Rx RX
SDA A4
SCL A5
''
The SDA and SCL are part of so called I2C bus. These are very interesting for fast serial communication, where you talk to one or many slaves by referring to their "address" (use and I2C scanner to know the addresses if you need to). When you need many more input/output, you can use I2C "expander" chips like the MCP23017 (gives 32 more I/O) or PCF8574 (only 8 more I/O but with interrupt for when a slave wants to talk!).

Reciprocal view: here are the Arduino Nano pin attributions
''
RX0 $serial$
TX0 $serial$
D2 X-DIR
D3 Y-DIR
D4 Z-DIR
D5 X-STEP
D6 Y-STEP
D7 Z-STEP
D8 EN
D9 X- and X+ (endstops)
D10 Y- and Y+ (endstops)
D11 Z- and Z+ (endstops)
D12 [gpio]
D13 [gpio] / onboard LED
A0 Abort
A1 Hold
A2 Resume
A3 CoolEN
A4 $SDA$
A5 $SCL$
A6 [gpio]
A7 [gpio]
''

Power line for the stepper motors: a drawback!

The main power plug accepts up to 12V, but it always powers the Arduino Nano.

When the nearby jumper (named ''Mot_VOL_Sel'') is put in place, this power plug also powers the stepper motors. So there is no way to send 24V to the motor with the jack as you would burn the Arduino.

Reciprocally, without the jumper in place, the stepper can only be powered by the ''Mot_VCC'' and ''Mot_GND'' (common ground). These are unpopulated vias on the PCB, and located strangely far from each other on the top of the board.



The spacing between the two pairs of pins is 4 mm, and I found no connector to fit these pins and drill diameters. The best solution I found out is to solder thick wire directly to the board and add some gun glue to relief the cable. Not good.

Another solution could be to cut the trace between the power jack and the nano board, so as to leave the jumper in place and power the steppers from the jack (and the nano board from the USB plug, or from one of the many ''+5'' pins available on the board).

This is a pity as the remaining of the board is pretty nicely done. Some more routing and a footprint for a usual 2-pin screw terminal would have been easy to do in the first place, leaving a much better way to power the steppers independently of the Arduino board.

Flashing the GRBL software on the Keyes_CNC controller board

GRBL is a software initially designed for the Arduino ecosystem. It will run on this board exactly as on an Arduino Uno, since they have the same microcontroller inside. The pinout is slightly different though.

GRBL really is dedicated to efficient G-CODE interpretation. These are the data sent to 3D printers and CNCs alike. GRBL will convert the commands to stepper impulsions, and it will optimize the paths to take inertia into account.

Why use GRBL instead of the regular Arduino stepper library?

Indeed, you can also use this shield with the default Arduino stepper controller examples when you do not need to interpret G-CODES. This may happen also when you need more room for your own programming, as GRBL does not leave much memory!

The Arduino stepper libraries are quite inefficient compared to the dynamics of GRBL, which takes care of inertia and path optimization in your place. But they do the job and they are way easier to use if you just need to control small stepper motors, slightly loaded, or at slow speed.

Back to GRBL

Now that we know how to wire the board, we can tweak the GRBL configuration file. Note that even though GRBL can be uploaded very easily to your board, thanks to their little Arduino library that only uploads the binary to the board, it will not be possible here as it does not give the chance to depart from the default pinout!
You have to build it from source... This is slightly more complicated than a regular Arduino program because GRBL does not use the slow and bulky Arduino software ecosystem. Check the doc.

12 comments:

  1. This site is actually amazing. We constantly run into something new & diverse correct right here. Appreciate which data. aluminum cnc service

    ReplyDelete
  2. I would also motivate just about every person to save this web page for any favorite assistance to assist posted the appearance. helical gear

    ReplyDelete
  3. Exercise is any bodily activity that required and necessary for the people today as it enhances or maintains the body of any one fit. exercise step bench

    ReplyDelete
  4. It is the intent to provide valuable information and best practices, including an understanding of the regulatory process. stone cnc router

    ReplyDelete
  5. I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much. flat screen printing machine

    ReplyDelete
  6. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. humidity chamber
    I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. humidity chamber

    ReplyDelete
  7. Thank you for taking the time to publish this information very useful! STEBRO MOLD

    ReplyDelete
  8. I would like to say that this blog really convinced me to do it! Thanks, very good post. laser welder for metals

    ReplyDelete
  9. Hey There. I found your blog using msn. This is a very well written article. I’ll be sure to bookmark it and return to read more of your useful info. Thanks for the post. I’ll definitely return. fiber laser marking machine suppliers

    ReplyDelete
  10. Very efficiently written information. It will be beneficial to anybody who utilizes it, including me. Keep up the good work. For sure i will check out more posts. This site seems to get a good amount of visitors. cnc electronic components

    ReplyDelete
  11. After study several of the content on your own internet site now, and I really appreciate your way of blogging. I bookmarked it to my bookmark website list and are checking back soon. Pls look into my internet site also and figure out how you feel. cnc services

    ReplyDelete
  12. China BoYang Hardware is a high-tech enterprise focusing on the design,R&D,manufacturing,sales and service of household hardware.The main products are: CNC machining parts,Stamping,Injection,die-casting,PRECISION CNC MACHINING PARTS, CNC ALUMINUM PARTS.Welcome to call or email to discuss business cooperation China cnc machining aluminum manufacturer

    ReplyDelete