CNC V3.0 Arduino Compatible Shield (HCARDU0086)

Post Reply
admin
Site Admin
Posts: 866
Joined: Sun Aug 05, 2012 4:02 pm

CNC V3.0 Arduino Compatible Shield (HCARDU0086)

Post by admin » Tue Oct 21, 2014 3:18 pm

Image
Image
Description:

This shield (HCARDU0086) is designed to allow you to control a CNC router or milling machine from an Arduino board. It contains 4 driver sockets which allows compatible Pololu A4988 driver modules to be inserted (see HCMODU0068 on our website) providing the ability to drive 3 stepper motor axis (X,Y, & Z) plus an optional 4th auxiliary motor. Additional connectors provide easy connection of end stop sensors and control buttons.

Order Yours Here.

Image
Shield with A4988 deiver modules (HCMODU0068) inserted - not included with shield

Features:

GRBL 0.8c compatible. (Open source firmware that runs on an Arduino UNO that turns G-code commands into stepper signals)
4-Axis support (X, Y, Z , A-Can duplicate X,Y,Z or do a full 4th axis with custom firmware using pins D12 and D13)
2 x End stops for each axis (each axis pair shared by same IO pin)
Spindle enable and direction connection.
Coolant enable connection.
Uses removable Pololu A4988 compatible stepper drivers. (A4988, DRV8825 and others) see our module HCMODU0068
Jumpers headers to set the Micro-Stepping for the stepper drivers.
Compact design.
Stepper Motors can be connected with 4 pin dupont/molex connectors.
Runs on 12-36V DC. (At the moment only the Pololu DRV8825 drivers can handle up to 36V so please consider the operation voltage when powering the board.)


GRBL users please see the FAQ section at the bottom of this post


Image


Schematic:
Image


Arduino Test Sketch:
  1. /*  FILE:    HC_CNC_Shield_Test
  2.     DATE:    21/10/14
  3.     VERSION: 0.1
  4.     AUTHOR:  Andrew Davies
  5.  
  6. This is an example sketch which tests some of the functions of the Hobby
  7. Components CNC shield (HCARDU0086). The sketch will step the X, Y Z, and Aux
  8. stepper outputs in both directions. It will also report if any of the endstop
  9. or control inputs have been triggered via the serial port.
  10.  
  11. WARNING: Ensure that your stepper motors are mechanically disconnected before
  12. running this sketch as it will not stop drive to the motors should an endstop be
  13. reached.
  14.  
  15. If you are using the Aux stepper output you will need to connect the pins labelled
  16. D13 to A-DIR and D12 to A-STEP on the shield.
  17.  
  18. You may copy, alter and reuse this code in any way you like, but please leave
  19. reference to HobbyComponents.com in your comments if you redistribute this code.
  20. This software may not be used directly for the purpose of selling products that
  21. directly compete with Hobby Components Ltd's own range of products.
  22.  
  23. THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES,
  24. WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED
  25. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR
  26. LACK OF NEGLIGENCE. HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE
  27. FOR ANY DAMAGES INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR
  28. CONSEQUENTIAL DAMAGES FOR ANY REASON WHATSOEVER.
  29. */
  30.  
  31.  
  32. #define EN 8      /* Enable pin for all stepper outputs */
  33.  
  34. #define X_DIR 5   /* Direction pin for X axis */
  35. #define X_STEP 2  /* Step pin for X axis */
  36.  
  37. #define Y_DIR 6   /* Direction pin for Y axis */
  38. #define Y_STEP 3  /* Step pin for Y axis */
  39.  
  40. #define Z_DIR 7   /* Direction pin for Z axis */
  41. #define Z_STEP 4  /* Step pin for Z axis */
  42.  
  43. #define A_DIR 13  /* Direction pin for Aux driver. Requires D13 and A-DIR pins to be shorted */
  44. #define A_STEP 12 /* Direction pin for Aux driver. Requires D12 and A-STEP pins to be shorted */
  45.  
  46. #define X_ENDSTOP 9   /* X axis endstop input pin */
  47. #define Y_ENDSTOP 10  /* Y axis endstop input pin */
  48. #define Z_ENDSTOP 11  /* Z axis endstop input pin */
  49. #define ABORT A0  /* Abort input pin */
  50. #define HOLD A1   /* Hold input pin */
  51. #define RESUME A2 /* Resume input pin */
  52.  
  53. int Count = 0; /* Counter to count number of steps made */
  54. boolean Direction = LOW; /* Rotational direction of stepper motors */
  55.  
  56. /* The setup routine runs once when you press reset: */
  57. void setup()
  58. {                
  59.   /* Initialize serial */
  60.   Serial.begin(9600);
  61.  
  62.   /* Configure the steper drive pins as outputs */
  63.   pinMode(EN, OUTPUT);
  64.   pinMode(X_DIR, OUTPUT);
  65.   pinMode(X_STEP, OUTPUT);
  66.   pinMode(Y_DIR, OUTPUT);
  67.   pinMode(Y_STEP, OUTPUT);
  68.   pinMode(Z_DIR, OUTPUT);
  69.   pinMode(Z_STEP, OUTPUT);
  70.   pinMode(A_DIR, OUTPUT);
  71.   pinMode(A_STEP, OUTPUT);
  72.  
  73.   /* Configure the control pins as inputs with pullups */
  74.   pinMode(X_ENDSTOP, INPUT_PULLUP);
  75.   pinMode(Y_ENDSTOP, INPUT_PULLUP);
  76.   pinMode(Z_ENDSTOP, INPUT_PULLUP);
  77.  
  78.   pinMode(ABORT, INPUT_PULLUP);
  79.   pinMode(HOLD, INPUT_PULLUP);
  80.   pinMode(RESUME, INPUT_PULLUP);
  81.  
  82.   /* Enable the X, Y, Z & Aux stepper outputs */
  83.   digitalWrite(EN, LOW); //Low to enable
  84. }
  85.  
  86. // the loop routine runs over and over again forever:
  87. void loop()
  88. {
  89.   /* Count one step */
  90.   Count++;
  91.    
  92.   /* If we have reached 500 steps then change the stepper direction and reset the counter */
  93.   if (Count >= 500)
  94.   {
  95.     Direction = !Direction;
  96.     digitalWrite(X_DIR, Direction); // Low = CW
  97.     digitalWrite(Y_DIR, Direction); // Low = CW
  98.     digitalWrite(Z_DIR, Direction); // Low = CW
  99.     digitalWrite(A_DIR, Direction); // Low = CW
  100.     Count = 0;
  101.   }
  102.    
  103.   /* Step the X, Y, Z, and Aux motors */  
  104.   digitalWrite(X_STEP, HIGH);
  105.   delay(1);
  106.   digitalWrite(Y_STEP, HIGH);
  107.   delay(1);
  108.   digitalWrite(Z_STEP, HIGH);
  109.   delay(1);    
  110.   digitalWrite(A_STEP, HIGH);
  111.   delay(1);
  112.  
  113.   digitalWrite(X_STEP, LOW);  
  114.   delay(1);
  115.   digitalWrite(Y_STEP, LOW);
  116.   delay(1);
  117.   digitalWrite(Z_STEP, LOW);  
  118.   delay(1);
  119.   digitalWrite(A_STEP, LOW);  
  120.   delay(1);
  121.  
  122.   /* Check state of inputs */
  123.   if (!digitalRead(X_ENDSTOP)) Serial.println("X-axis end-stop triggered!");
  124.   if (!digitalRead(Y_ENDSTOP)) Serial.println("Y-axis end-stop triggered!");
  125.   if (!digitalRead(Z_ENDSTOP)) Serial.println("Z-axis end-stop triggered!");
  126.   if (!digitalRead(ABORT)) Serial.println("Abort input triggered!");
  127.   if (!digitalRead(HOLD)) Serial.println("Hold input triggered!");
  128.   if (!digitalRead(RESUME)) Serial.println("Resume input triggered!");
  129. }


FAQ:

I am using this shield with GRBL but the Z axis endstop doesn't seem to be working, what's wrong?

Recent version(s) of GRBL default to a variable spindle control on digital pin 11 which is used by this shield for the Z axis endstop. To fix this you will need to open up the config.h file found in the GRBL library folder in a text editor like notepad++. Windows users, don't use the built in notepad text editor to do this as it messes up the formatting. Next locate the following section in the text file:

  1. // Enables variable spindle output voltage for different RPM values. On the Arduino Uno, the spindle
  2. // enable pin will output 5V for maximum RPM with 256 intermediate levels and 0V when disabled.
  3. // NOTE: IMPORTANT for Arduino Unos! When enabled, the Z-limit pin D11 and spindle enable pin D12 switch!
  4. // The hardware PWM output on pin D11 is required for variable spindle output voltages.
  5. #define VARIABLE_SPINDLE // Default enabled. Comment to disable.

You well need to comment out the '#define VARIABLE_SPINDLE' line by putting a // in front of it like this:

//#define VARIABLE_SPINDLE

Next, save the file, re-compile and upload it to your Arduino. This should then fix the z axis endstop issue



Disclaimer: Libraries, example code, and diagrams are provided as an additional free service by Hobby Components and are not sold as part of this product. We do not provide any guarantees or warranties as to their accuracy or fitness for purpose.

Descriptions and diagrams on this page are copyright Hobby Components Ltd and may not be reproduced without permission.

Post Reply

Return to “Arduino Shields”