PTHAT Jog Control of a CNC Machine using Instant Commands

With this example, we show how to use the PTHAT as a simple Jog Controller.

We have connected the PTHAT to our CNC machine at work as a test.

Within the software you can alter the settings to suit your own CNC machine, such as Pulses per mm on each Axis and speeds.


Within the application you first connect to your Raspberry Pi serial port by clicking the Connect button.

Also we have interfaced an external Jog controller to show how easy it is to use with the combination of the Raspberry Pi and the PTHAT.

The External Jog Controller is made using simple push buttons that connect to the Raspberry Pi GPIO pins. Within the software we monitor these pins to see if they go high or low and call the routines within the software to send out the movement commands.

Commands used in this example are:

Set Axis Command

Set Auto Count Pulse Out Command

Start Axis Command

Stop Axis Command

Request Current Pulse Count Command

Toggle Motor Enable Line

Request Firmware Version


In this video we give an overview of the example software we supply enable jogging on your CNC machine.

The end developer has easily modify this example to build their own application.

The example application was developed in Visual Studio 2015 that can be used with Windows 10 IOT on the Raspberry Pi or compiled to x86/x64 for use on a PC.
The example has been written in C# as a Universal Windows Platform (UWP).

Please use the following link to download the full source code.

Closer look at the PCB's