Arduino Plus CNC Shield in K40 Laser

by Garrystr in Workshop > Laser Cutting

7080 Views, 13 Favorites, 0 Comments

Arduino Plus CNC Shield in K40 Laser

K40.jpg
arduino_uno.jpg
CNC-Shield_01.jpg

So I bought the K40 Laser having read all the horror stories about the controller and the wiring and the lack of power control and setting the house on fire and so on. I also downloaded Lightburn to give it a go as I had heard good things and spent a couple of weeks creating stuff in lightburn, saving as on SVG, loading into K40 Whisperer and engraving, quite successfully.

I then installed a BigTreeTech SKR V1.3 with DRV8825 stepper drivers. This worked really well and is the subject of a different instructable. https://www.instructables.com/SKR-V13-in-K40-Laser...

Inevitably I needed the SKR board to run a Mainly Printed CNC router that I was building, and I had the CNC Shield, some spare DRV8825 stepper drivers and a spare Arduino and thought I would give it a bash instead of splashing out for another BTT SKR board.

Spoiler, it works really well for my needs, noting I only use the K40 occasionally and for relatively small gifts mainly for friends and family.

This instructable will assume you can connect up the board to the machine. I will also try to link the sites I found useful and link to the places I got firmware from. I will also include any specific files I created / edited with the caveat that they have been created for my specific needs.

Supplies

Arduino Uno

CNC Shield (V3.0 used for my application)

1Kohm Resistor

BC547B Transistor or similar.

Small Proto Board (not Strictly necessary)

CNC Shield - Wiring to Control the Laser

CNC wiring.jpg
BC547.jpg

The attached photo details the connections that need to be made to the K40 Power supply from the CNC shield for controlling the Laser Power through software running on a connected PC / Mac to the Arduino.

I have not included the motor connections as these should be obvious.

X limit switch should be connected to X-

Y limit switch should be connected to Y-

Z limit switch if you have one should be connected to Spindle enable

The base or gate of the transistor needs to be connected via a 1 Kohm resistor to Z+ pin on the CNC shield.

I have not included the requirement to power the CNC shield, but Power will need to be connected to the CNC shield, in this case, 12 to 36v DC, make sure the polarity is correct.

Note, the CNC shield does not provide 5V, this is supplied to the shield directly from the Arduino, which in turn is supplied by the PC / Mac from the USB cable.

For connection of an ammeter see https://k40.se/k40-laser-electronics/install-ma-meter/...

For connection of a potentiometer and voltmeter see https://k40.se/k40-laser-electronics/digital-to-an...

Firmware GRBL 1.1H

In order to build the firmware, you are going to have to go to https://github.com/gnea/grbl to get the firmware first and you will need the Arduino IDE from https://www.arduino.cc/.

There is a Wiki page on how to build the firmware and install it to your machine. You should only need to edit the Config.h file if you have any specific requirements. An example of specific requirements could be disabling the need to Home the Z axis for instance if you don't have a variable height table or in my case, as I have 2 optical endstops and a mechanical one, you can invert each endstop individually in the config file.

Note you have to add the GRBL library to the Arduino IDE to get it to work, details on this are at https://github.com/gnea/grbl/wiki/Compiling-Grbl

I have also added the GRBL file for my setup, note the X & Y steps and so on should be the same if you haven't changed the gearing and have the same Microstepping as me set on the motors, otherwise you will need to experiment.

Homing may also be different depending on where your endstops are and motor wiring, again you can change to meet your own needs in the config.h file.

Downloads

Warnings, Cautions and Observations

I control and connect to the Arduino from a MacBook Air and use Lightburn. A couple of things I have to add as a warning that I found but can't find the link to at the moment.

The Laser momentarily arms when the Arduino is plugged in, for this to not be an issue, I make sure the door on my laser is open before plugging in the USB lead to the computer, noting I have a door interlock on my machine.

I have an ammeter, a voltmeter and potentiometer connected to my machine to limit the power from the laser so that the current is less than 14mA. The setting on the voltmeter is about 2.1V. This means that if I tell Lightburn that I want to cut at 100% power, the ammeter will read 14mA. If you go higher than this, you WILL shorten the life of your tube.

If I disconnect the USB without quitting Lightburn first, it locks out the USB port on the Mac so I have to restart it to get the port to release so that it can connect again to Lightburn. Quitting Lightburn first prevents this from happening.

I have set up a USB camera and Lightburn can move the laser head as expected.

Hope this helps someone.

The END