Tag Archives: G0704

Custom Keyboard for G0704 CNC Mill, controlled by PlanetCNC software

I recently updated my G0704 CNC mill to add an external keyboard for commonly used functions. My reason for doing this was that some of the functions I use most are really buried in the menu structure of the Planet-CNC.com control software I use on the mill.

For example, I use the Zero X Offset and Zero Y Offset all the time, yet these are in a menu 3 levels deep in the software. Also, I find that having dedicated buttons is a bit safer for functions like Start, Stop, and Measure Z Offset. In particular, the Measure Z Offset button on screen is right beside the Measure Tool Offset – which does really long tool measurement sequence, involving a fixed tool location measurement – really easy to select this by mistake.

My solution was to create an external box, with the 7 buttons I use most, and connect this box to the Control PC using USB.

CNC Custom Keyboard

Here’s a video about this project:

More Details:

The Planet-CNC.com control software has keyboard codes for each menu item. You can simply type the keyboard code when the program is running, and that menu item will be executed. For example, the keyboard code for Zero X Offset is “/45211” These keyboard codes are visible when you drop down a menu in the software.

I used a Teensy 2.0 Arduino controller, which is perfect for this application as it can be configured to emulate a USB keyboard. I connected the 7 buttons to pins 0-6 on the Teensy, and connected the other side of all the buttons to the Ground pin.

  • Pin 0 – Zero X Offset (Sends keycode /45211)
  • Pin 1 – Home (Sends keycode /470)
  • Pin 2 – Zero Y Offset (Sends keycode /45212)
  • Pin 3 – Zero Z Offset (Sends keycode /45213)
  • Pin 4 – Measure Z Offset (Sends keycode /459)
  • Pin 5 – RUN (Sends keycode /401)
  • Pin 6 – STOP (Sends keycode /406)

Here’s the Arduino Sketch (the program) that I used for this project.

The software scans the pins, looking for a pin to be “Zero”, which means a key is pressed. When it finds a pressed key, it uses the println function to send the Planet-CNC keycode to the software.

Note: The keypad sends the keycode to whatever program is running in the foreground on the PC. You shouldn’t rely on this for critical keypresses like ESTOP. The ESTOP key should be hard-wired to the appropriate pin on the Planet CNC control board.