Skip to content

Invary/cnc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to setup/use CNC3040 with GRBL

About 

Smaller CNCs such as the CNC3018 use GRBL as the controller.
However, for CNC3040 and above, Mache 3/4, which is older in design and less user-friendly, is often used. Here we show how to build a CNC3040 system with GRBL/wifi.

CNC3040


Preparation / CNC3040Z

Required

Optional

** Shielded cable is required. Unshielded cables will cause motor errors such as stalling.


Test wifi connection

GRBL board, 32bit 6axis CNC card, is equipped with an EPS32 and has a standard FluidNC(GRBL for ESP32) firmware burned in.
Wireless connectivity is supported. Before wiring, first check this operation.
This board is compatible with 12-24V power supply, 36V is not support.

Connect to 24V power supply. Then the on-board LED glows momentarily and ESP32 operates as an access point mode.
Enable the wireless on your smartphone or PC and you can find the SSID GRBL_ESP. The password is 12345678.

Once connected to the GRBL board, access http://192.168.100.101/ in your browser.
If connection failed, try another URL http://192.168.100.104/ , http://192.168.101.100/ or so on. Or, open a command prompt on your PC and run arp -a to identify the IP address = URL.


Motors wiring

GRBL board, 32bit 6axis CNC card, is equipped with an EPS32 and has a standard FluidNC(GRBL for ESP32) firmware burned in.

  • PUL/DIR/EN pins are 5V high/low output. DO NOT connect to over 5V voltage power supply.
  • High voltage of PWM-OUT is adjustable.
  • Both 24V pins are directly connected. Therefore, they can be used for both IN and OUT.

GRBL board


DM542 is stepper motor driver.
This is compatible with 20-50V power supply.

  • PUL-/DIR-/ENA- pins are connected to GND.
  • If you want to keep motor always on, connect both ENA+/ENA- pins to GND.
  • When wiring more than 2m, use shileded cable, or motor trouble will occur.

Dual 8mm shaft NEMA23 motor, 23HS5628-SZ for X/Z axis
Mono 8mm shaft NEMA23 motor, 23HS5628-8mm for Y axis
23HS5628 is 56mm height, 2.8A, 126N.cm.

  • Pin assignments vary by product, so check with a tester.

The direction of motor rotation is not important because it can be changed by software.

DIP switch setting of DM542 is 1.0A, Full Current, 25600 steps, on on on on off off off on.
The motor's rated current is 2.8 A, but it is better to keep the value small unless it is necessary because it generates more heat.

CNC3040Z's ball screw are SFU1605 with 5mm pitch.
In other words, the 25600 steps in DM542 are 5mm, so 5120 steps/mm.

Connections for motors

Setting of DM542


Spindle wiring

WS55-180 is brushless spindle motor driver.
RPM can be manually set by volume (10k ohm) or automatically adjusted by G-CODE.

For automatic control, turn the PWM-ADJ volume to 0-10V PWM output before wiring.
To adjust, access GRBL board with a browser. Set speed value 1000 in spindle tab and press the On Fwd button. Then voltage is output to PWM-OUT pin. Turn the PWM-ADJ volume so that the output is 10V.

The direction of spindle rotation is important. Be sure to set correctly by change order U/V/W to U/W/V, etc., if in reverse.
Auto control connections for spindle

  • Manual control Manual control connections for spindle

  • Automatic control Auto control connections for spindle

  • Value in G-CODE vs RPM (no load)

value rpm
200 2200
300 3800
400 5400
500 6800
600 8000
700 9200
800 10200
900 11300
1000 12000

g-code value vs rpm


GRBL/FluidNC setting

To change the GRBL configuration, follow the steps below.

  1. Access GRBL board with browser
  2. Download the configuration file from GRBL board to your PC
  3. Edit the configuration file on your PC
  4. Upload the file to GRBL board
  5. Restart GRBL board

Here is my CNC3040Z configuration file

The various port settings on the GRBL board are not problm as default.
The following items are important

steps_per_mm: of X/Y/Z set to 5120.000.
max_rate_mm_per_min: of X/Y/Z set to 500.000.

homing:cycle: of X/Y set to 1.
homing:cycle: of Z/A/B/C set to 0.

max_travel_mm: of X set to 300mm.
max_travel_mm: of Y set to 400mm.
max_travel_mm: of Z set to 100mm.

start:must_home; set to false.

When the direction of the stepping motor is reverse rotation, edit direction_pin:.
Just add :low to reverse rotation, ex. direction_pin: I2SO.4 to direction_pin: I2SO.4:low


Offline controller

GRBL board, 32bit 6axis CNC card, has no port for offline controller.
But you can control via wifi. Although it is not an offline controller, it can be used like an offline controller.

  1. With smart phone, access GBRL board with browser.
  2. Open Tablet tab.
  3. You can control CNC via wifi.

Stand alone CNC machining

GRBL board, 32bit 6axis CNC card, has a microSD slot.
Stand-alone processing is available by uploading g-code file in microSD. Upload can do via wifi.

  1. Access GBRL board with browser.
  2. Upload g-code file to microSD. File extension is like .nc.
  3. Set GRBL Reports: to Auto
  4. Set endmill to the spindle.
  5. Move spindle head to start position.
  6. Press ⌀XYZABC button, work coordinates set to zero.
  7. Start CNC machining.

If you want to abort, press pause and refresh button.


Serial connected CNC machining

GRBL board, 32bit 6axis CNC card, has a microUSB connector.
It supports HID/serial protocol. So you can control CNC via serial port.


Serial connected CNC machining via wifi

GRBL board, 32bit 6axis CNC card with firmware of FluidNC, supports multiple wireless protocol.
So you can control CNC via wifi, and by using a wireless-serial port bridge with virtual serial port, it can be controlled like as wired connected CNC.

  • Bluetooth/serial (not recommended)
  • WebSocket via wifi (not recommended)
  • Telnet via wifi (recommended)

Bluetooth is for exclusive use with wifi. Therefore, enabling bluetooth is not recommended since wifi is not available.

WebSocket is also used for control by browsers. This is not recommended as the connection is a bit unstable and can be dropped.

So telnet/wifi is recommended.

The following is an example of a setup is with Candle for windows.

  1. Install virtual serial port com0com.
  2. In setup of com0com, check enumulate baudrate and add one pair of virtual serial port, COM19 & COM20.
  3. Download latest version of IvyTcp2Serial and extract.
  4. Create shortcut file of IvyTcp2Serial.exe .
  5. Right click shortcut file and open property.
  6. Edit shortcut link IvyTcp2Serial.exe to IvyTcp2Serial.exe /server=192.168.100.101 /port=23 /comport=COM19 /baudrate=115200 /parity=none /stopbits=1. IP address and comport should be changed according to your environment.
  7. Execute IvyTcp2Serial with serial, and connected to CNC via wifi/telnet.
  8. Execute Candle with serial port like COM20.
  9. At first, send command to CNC, $Report/Interval=50. This is because the default frequency of coordinate report is low.
  10. Now you can control CNC via wifi with Candle.

Cable management

CNC3040Z has several screw holes for cable management and comes with an adapter to secure the drag chain.
However, we don't know which drag chain would fit perfectly. So, we made our own adapter with 3D printer.

Usable drag chain is inner size 10x20mm, close type.
Since there are slight differences in size between drag chain products, it is better to design your own 3D printed parts without using stl.

Dimension for drag chain

The required length of the X axis drag chain is about 60cm.

Stl file of drag chain end cap for X axis type1 drag chain end cap for X

Stl file of drag chain end cap for X axis type2
Multiple holes are for cable tie 3x100mm
drag chain end cap for X

drag chain end cap for X

The required length of the Y axis drag chain is about 70cm.
The gap between the stage and the side panel is 26.5mm, which is a little narrow for a drag chain. Therefore, it is fixed in an irregular manner.

Stl file of drag chain end cap for Y axis drag chain end cap for Y

M5 screw holes are provided near the Y-axis motor. This is used to secure the cable between Y-axis and X-axis.
Stl file of cable adapter between Y and X cable adapter between Y and X

drag chain end cap for Y, cable adapter between Y and X


Power unit terminal guard

This CNC use 2 power units, 24V 360W-Quiet and 36V 400W-Quiet.
This power unit is easy to short-circuit because the terminals are exposed. Create a protective cover.

Stl file of Power unit terminal guard Power unit guard

Power unit guard


Knob for X/Z axis

Knob on dual shaft motor make manual position adjustment easier.
So, for X/Z axis, It is better to use dual shaft motors, 23HS5628-SZ.

NEMA23 with knob

Parts list

  • x1 dual 8mm shaft NEMA23 motor, 23HS5628-SZ
  • x1 knob body, CNC machined 6mm thick MDF, STL file
  • x1 knob adapter, 3D printed, STL file
  • x6 spacer for small knob, CNC machined 3mm thick acrylic board, STL file
  • x4 M3-10mm screw
  • x3 M3-12mm screw
  • x7 M3 nut

knob

knob body

knob adapter

knob spacer


Knob for Y axis

The Y-axis of CNC3040Z has ball bearing nut out. This nut is used to create the knob.

Y-axis knob

Parts list

  • x1 knob body, CNC machined 6mm thick MDF, STL file
  • x1 knob adapter, 3D printed, STL file
  • x3 M3-12mm screw
  • x1 M3-10mm screw
  • x4 M3 nut

Y-axis knob Y-axis knob body Y-axis knob adapter


20 alminium profile stage

CNC3040Z has 360x545mm stage using 3 pcs of 20120.
This stage is common in CNC, but has some disadvantages such as wide groove spacing, necessity to use big screw for T-nut, etc.
Therefore, change to user friendly 20 alminium profile stage.

stage

Parts list

20100 450mm has has holes in the side. The diameter of this hole is 4.2mm or 5.0mm, depending on products. Use M5 or M6 tap to make threaded hole.


GRBL board's chips

GRBL board, 32bit 6axis CNC card is not open source device. Threfore, schematic and specification are unknown.
Looking at the PCB... there is some famous chips. We have not followed the schematic, but we predict the approximate function from PCB layout.

  • ESP32-WROOM-32: MPU module
  • 74AHT595: 8bit shift register. X/Y/Z/A/B/C and maybe SPIN/MIST out is through this chip
  • MC34063: DC-DC converter, 1.5A. Maybe for 5V-OUT
  • AMS1117-3.3: 3.3V regulator. ESP32's power supply
  • CH340K: USB-Serial bridge
  • LM358 (up): opamp. Unknown
  • LM358 (down): opamp. Maybe for PWM-OUT
  • EL3H7: photo coupler. LIMIT/PROBE and maybe PWM for laser is isolated by this chip
  • LM2576S: DC-DC converter, 3A. Maybe for laser power supply
  • 20P06: P-ch power MOSFET. Unknown

GRBL board's chips


Probe

Simple probe using a tactile switch.

Probe Probe

Parts list

Generally, PCB pattern cutting is done by generating gcode from gerber and cutting with V-cutter. However, for a simple board like this, it is easier to use general CAD and endmill.
In this case, we used 0.5mm corn endmill.

Probe body Probe PCB pattern






Suggestions and feedback

If you have any idea or suggestion, please add a github issue.





Copyright (c) Invary