This page details the hardware installation side of Setting Up the Gerbil

Video with instructions

Photo: Plugging large connectors into the Gerbil


You’ll be disconnecting connectors from your K40’s existing controller, and reconnecting them to the Gerbil.  It’s a great idea to read all the instructions below before starting.  Basic familiarity with connectors/electronics is helpful, but the forum is a great place to ask questions if you’re unsure about anything.  Typically takes 10-20 minutes.

There are two K40 versions (plus sub versions):

  • ribbon cable version (X axis motor plus the limit switches)
  • non-ribbon version – individually wired x/y axis and limit switches (more info is provided in the forum, see click to thread on k40 forum page)

There are two types of limit switches (or end stops):

    • mechanical limit switches which has just two leads: signal and ground
  • electronic limit switches which has three leads: signal, ground and 5 Volt to power it

Tools and materials:

  • small square of cardboard, around 10cm x 10cm


Turn your K40 power off at the wall (powerpoint).


2  Open up the main panel on the right hand side of your K40.  Inside you’ll see an electronics enclosure which is the K40 power supply:

The leftmost connector in the above diagram is the mains voltage power connector – no need to touch this.  The Gerbil installation only uses the leads associated with the centre and rightmost connectors.

3  Follow the the wires from the front of the power supply to the circuit board on the back of the K40’s front panel, and you’ve found the K40’s old controller, which looks like this:

(photo courtesy of:

4  Temporarily attach a label to any similarly coloured wires on the old controller so you can identify them later on if necessary

5  Take a close up photo of the wires coming into the old controller (like the above photo), ensuring you can clearly see which wires and labels attach to the various connectors.

6  Now take a look at the Gerbil… beautiful, isn’t it ?  It has headers with a lock mechanism to help you avoid plugging connectors in the wrong way around.

Even though the Gerbil has 4 rubber feet, it’s good practice to keep it away from the K40 metal frame, so lay it on the small square of cardboard down in front of the K40 power supply.

Disconnecting the old controller and connecting the Gerbil

7  Unplug the small 4 wire Y axis motor connector from the old controller and plug into the Gerbil headers, as shown in the picture below.  The header lock mechanism prevents incorrect orientation. Note: if the machine does “home” away from zero during testing then you need to turn the connector 180 degrees or configure the firmware to revert the Y direction (via command $23=0 ). See

8  Unplug the large 4 wire Low Voltage connector from the old controller, and plug into the large header on the Gerbil labelled ‘Lo/5V/Gnd/24V’.  The header lock mechanism prevents incorrect orientation.

The photo above shows labels on the Gerbil shield to aid orientation of the large low voltage power connector.  (In some older versions of the K40, the connector has 6 positions with 4 wires. You can extract carefully the metal connector inserts and re-seat them in the right positions/sequence in the 6 pin socket connector and slide the 6 pin connector over  the 4 male pins. Alternatively you can buy a standard 4 pin (MTA-156 – 4 Position 3.96 mm pitch) PC connector and use this to connect the Gerbil controller to the Laser power supply. See Digikey MTA connectors)

9  Unplug the ribbon cable from the old controller, and plug into the long thin slot in the Gerbil.  The metal lips of the ribbon cable must face the edge of the Gerbil, as shown below. If your version has not a ribbon cable then read about it in this it describes it in details with many photo’s.

10  Confirm your Y axis, Low Voltage and Ribbon connectors are now plugged into the Gerbil like this:

Or like this…

Two versions of K40 power supplies which are identical but they just have different connectors e.g. screw terminals vs connectors…

The middle of the current control (potentiometer or digital control panel) needs to be disconnected from the terminal strip (or the three pin connector) and be replaced with the provided single wire with the Female/Male Dupont connectors. The wire connects the gerbil pwm output to the current control input of the power supply as depicted above (labelled ‘IN’ terminal). The old current control wire can be left disconnected or connected by a three way switch so you can select gerbil pwm control or manual control of the laser current via the existing control (stock k40 current control potmeter or digital control unit).

Note: If you still want to use the test push button then you need to use a macro in LightBurn (see . This can be handy for mirror alignment.

Note: Some people get confused that the PWM is just 1 wire and not 3. You don’t need 5V and Gnd since they are already supplied on the Mini Gerbil via the 4 pin power connection.

Air assist option: If you have a 24v pcb fan as air assist (ProPack)

The mini pcb fan has a positive red lead and a negative black lead that you need to extend with the supplied extension cord. The extension cord needs to be fed through the drag chain (included in the Pro pack). Use the stripped lead in the extension cord as the negative ground. You wire this up to the 24V and ground screw terminals on the laser psu. This is the most right connector/terminal that has 4 screw terminals. The first (starting from left) is the 24 volts followed by ground. (see

The optional Pause-Resume-Abort and door/lid connections are depicted below. The safety lid is a NC micro switch which is open when the lid of the k40 is closed. When opened the controller stops. Closing the lid and pressing resume will continue the cutting or engraving process.

11  Disconnect the existing K40 USB lead from the old controller and plug into the Gerbil.  Plug the other end into your PC/MAC as usual.

Questions ?  Please check our forum and refer to the instruction numbers above if posting a question

Great, now you’re ready to go onto Using Gerbil;


you can use any G-code sender to manually test the conversion: moving x and y axis, homing direction and laser function. CNCjs is a good g-code sender  (Click here to goto cncjs dowload page) but any other will do too.  LightBurn has a free trial version that you can use as well. This makes testing way easier than a G-code sender. The default behavior of Gerbil when powered up is the alarm status (motor axis Lockup as per cnc standard, this prevents the Gantry to move a loose its bearings or location). You need to clear the controller alarm via a command “$X” if you want to move the gantry by hand. The Inkscape plugins and laser application software do that clear command by default when streaming the g-code files. After issuing a “$X” you can issue a g-code command like “G0 X1 Y1” t’o move the gantry or issue a “$H” to home the machine to its zero coordinates (Left Top corner same a stock K40). Homing is essential when doing multiple passes or repetition jobs so you have a good zero location as reference point. Without a proper homing working, you can work with the laser for testing and debugging purposes.

Command “S100” turns the laser on where the number stands for the power e.g. 100 equals 1mA.


G1 X1 Y1 S100 F800


stands for: M4 laser on, Goto coordinates X,Y (1,1) at 800mm/min with the tool (laser beam) powered at 1mA and switch it off (M5). G0 is a move without any tools enabled.

(Note for nerds: difference between M3 and M4 is that M4 turns off the laser at corners when the controller is in laser mode ($32=1). However some programs uses M3 and adjust the S parm when cornering)

You can also home the machine via the $H command. If the machine does not home correctly then it can be that the axis motor connector needs to be swapped around (180 degrees, when homing away from zero) or the end stops don’t work.

Note: You can test the limit switches via CNCJS. The status command ? (yes, just type a question mark in the black box area) provides status information back so you can see if they work when you push the gantry in the zero position. (Top left corner). Some of the status line information might be hidden so expand the status message box. The limit switch information is at the end of the status line. If the limit switch is not triggered then there is no information. If triggered then you see something like X,Y.

Testing the Laser PWM output

Set the laser in ‘CNC’ mode ($32=0) since that allows you to test the laser without any motion. The laser mode is a safety feature to prevent accidental ‘laser’-ing at idle state. However when adjusting the mirrors and tweaking the alignment you temporary need to set it in cnc mode. Don’t forget to turn laser mode on again!

Switch off laser mode $32=0

Switch on laser mode $32=1 

Once in ‘CNC’ mode you can issue a ‘M3′ or ‘M4′ which turns the laser ON. M5 turns it off. The S parm will set the laser power. For example ‘M3 S200′ will turn on the laser beam at 2mA (if you have set the range ‘$30=2000′ or around that mark usually it is closer to 2048. It stands for 20mA full range. (Note the higher you set the range value $30, the lower the power output is for an S gcode setting. $30=4000 makes $100 just 0.5mA while $30=1000 makes S100 – 2mA hence darker burns. If you happen to have installed a 60Watt tube then you need to adjust $30=3000 which means 30mA at full power. ).

These commands can be easily send manually via a G-code sender (UGS, CNCjs see our downloads menu). It normally requires you to connect via USB, Grbl type connection at 115200 baud. All electable via drop down menus.

Alignment of Mirrors: use CNC mode and use M3 S100, since that is a low power beam. At a S70, the beam is not generating enough power to burn the sticky notes paper targets that you temporary put on the mirrors for alignment. Alignment iterates over all four corners of the machine and it’s very likely that some areas don’t align well because of a skewed K40 frame. In such a case you need to go a bit back within the work area (which causes some lost work space but it is what it is… it is not a $20k epilogue or trotec laser).

Happy lasering! and if you still encounter issues, we have the K40 forum.

For all commands see

Note V1.1f is just to make G-code senders and other programs happy so they can communicate with the Controller. Many changes are incorporates that justifies it’s own version and designation.