Video instructions for Mini Gerbil hardware installation

You’ll be disconnecting connectors from your K40’s existing controller, and reconnecting them to the Mini 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 e.g. Digital Control vs Analogue):

  • 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 PSU’s (Power Supplies):

  • * All screw Terminals
  • * Micro plugs for LP(2pins),WP(2pins),PWM(3pins)

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

Assemble you Mini Gerbil case first if you have a Mini Gerbil Case. Click here for a new Page.

Assembly of the Case

Tools and materials:

  • Small screw driver
  • Small nose pliers


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


STEP 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:

PSU Type I
PSU Type I
PSU Type II (Lid or Test button)

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.

STEP 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: www.igorkromin.net)

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

STEP 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.

STEP 6  Now take a look at the Mini Gerbil.  It has headers with a lock mechanism to help you avoid plugging connectors in the wrong way around.

Even though the Mini Gerbil has an Acrylic case, it’s good practice to keep it secure, so mount it fixed in front of the K40 power supply.

Disconnecting the old controller and connecting the Mini Gerbil

STEP 7  Unplug the small 4 wire Y axis motor connector from the old controller and plug into the Mini 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 90 degrees or configure the firmware to revert the Y direction (via command $30=0)

Old Basic Gerbil
Mini Gerbil

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

Labels on Basic Gerbil
Labels on Mini Gerbil

The photo above shows labels on the Mini Gerbil 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)

STEP 9  Unplug the ribbon cable from the old controller, and plug into the long thin slot in the Mini Gerbil.  The metal lips of the ribbon cable must face the edge of the Gerbil, as shown below. If your version hasn’t got a ribbon cable then read awesome.tech/k40-forum/?view=thread&id=31 . This post provides details and photographs.

Basic Gerbil Ribbon connector
Insert the ribbon connector

Alternative Non-ribbon connector versions do use a plug connector (see next section below)

STEP 9 (Alternative): Most K40s have the ribbon cable, others have a connector that fits the broken out limit switch connections inclusive of 5V for opto switches or your K40 is slightly different and has just mechanical limit switches so it does not use the 5V supply from the Mini Gerbil.
The broken out limit switch connections are available on the connector behind the ribbon connector. Looking from the edge of the Mini Gerbil PCB towards the ribbon connector, the pins are GND, Y-Limit, X-Limit, GND and 5V. You only need the 5V supply when you have electronic (opto) limit switches.

Orientation of the non ribbon limit switch header. Note 5V dc is only required for electronic limit switches (optical switch).
Some limit connectors have mechanical limit switches (3 or 4 wires). The plug Catch facing the ribbon receptacle. Others have electronic limits and use the 5V wire to orient the plug.

Locate the limit connector plug and not the labels on the NanoM2 board Y, X, GND and 5V.

Orientation of the limit plug on the NanoM2, note this version has 3 wires (4 or 5 wires are common too). The NanoM2 here has no 5V DC available for electronic limits but other versions do. Note the catch of the plug facing downwards (edge of board)

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

Mini Gerbil Wiring diagram (Ribbon version)
Non Ribbon Wiring diagram
Basic Gerbil Connections

PWM Connection lead (supplied wire)

The existing wire (coming from the middle of the current control potentiometer or digital control panel) needs to be disconnected from the terminal strip and be replaced with the provided single wire with the Female/Male Dupont connectors (or Female/Female depending on your K40 power supply).

The supplied wire connects the Mini 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. Optionally, it can be connected by a three way switch (see wiring diagram) so you can select between Mini Gerbil pwm control or Digital/manual Pot control of the laser current via the existing control.

Note: If you still want to use the test push button then you need to include a three way switch so the IN has a reference voltage when firing the test switch. This can be handy for mirror alignment. When doing mirror alignment you need to set the Mini Gerbil in CNC mode ($32=0) to allow the laser to fire while not in motion. Don’t forget to switch back to Laser mode ($32=1) !

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

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 output followed by ground and LO (Laser On) terminals. (see https://awesome.tech/installing-gerbil-pro-pack/)

This page will be updated with a link on how to connect the optional Door-Pause-Resume-Abort connections.

11  Disconnect the existing K40 USB lead from the old controller and plug into the Mini 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 the Mini Gerbil with Inkscape see Using Gerbil

(LightBurn/LaserWeb instructions see here)


you can use any G-code sender to manually test the conversion: moving x and y axis, homing direction and laser function. CNCjs and UGS a good g-code senders  (Click here to goto cncjs dowload page) but any other will do too. The default behavior of Mini Gerbil when powered up is to energise the motors in hold position (lock up). When the Door switch is used you need to clear the controller alarm via a command “$X”. The Inkscape plugins 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). Command “S100” turns the laser on where the number stands for the power e.g. 100 equals 1mA. (Depending how you set the power range e.g. $30=2000 equals 20mA).


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.

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 called console in the G-code sender) provides status information back so you can see if they work when you push the gantry in the zero position. (Top left corner, set $1=100 so motors don’t lock while in rest. Later on revert back to 255 to keep the Gantry aligned and into the correct position). 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 <Idle|MPOS:0.000,0.000|Bf:0,255|Fs:0,0|Pn:X,Y>

Mirror Alignment

Set Mini Gerbil in CNC mode via ‘$32=0’, than you can switch-on the laser at rest via the G-code commands: ‘M3’/’M4’ and off via ‘M5’. Use the ‘Sxxx’ command to set the output power e.g ‘S200’ for 2mA output. Don’t forget to set ‘$32’ back to ‘1’ (Laser mode) for safety.

  • $32=0
  • M4 S200
  • M5
  • $32=1

For all commands see Configuring Mini Gerbil wiki