The MPG (Manual Pulse Generator) module allows you to use rotary encoders (hand wheels) to manually jog machine axes. This provides precise manual control similar to professional CNC machines, making it ideal for:
An MPG typically consists of:
Each encoder pulse translates to a small step movement on the configured axis, allowing very precise positioning control.
| Specification | Typical Value |
|---|---|
| Type | Incremental quadrature encoder |
| Resolution | 100 PPR (common for hand wheels) |
| Output | A, B quadrature channels |
| Voltage | 5V or 3.3V |
Connect the encoder to the Smoothieboard:
| Encoder Wire | Connection |
|---|---|
| A channel | Interrupt-capable GPIO pin |
| B channel | Interrupt-capable GPIO pin (different EXTI line) |
| VCC | 3.3V or 5V (depending on encoder) |
| GND | Ground |
If using 5V encoders, level shifting may be required for the signal pins.
Multiple MPG encoders can be configured, one per axis. Each MPG instance is defined as a sub-section under [mpg].
[mpg]
xaxis.enable = true
xaxis.enca_pin = PF10^ # Encoder A channel (^ enables pull-up)
xaxis.encb_pin = PF6^ # Encoder B channel
xaxis.axis = 0 # X axis (0=X, 1=Y, 2=Z, 3=A, 4=B, 5=C)
[mpg]
# X-axis MPG
xaxis.enable = true
xaxis.enca_pin = PF10^
xaxis.encb_pin = PF6^
xaxis.axis = 0
# Y-axis MPG
yaxis.enable = true
yaxis.enca_pin = PA3^
yaxis.encb_pin = PA4^
yaxis.axis = 1
# Z-axis MPG
zaxis.enable = true
zaxis.enca_pin = PB7^
zaxis.encb_pin = PB8^
zaxis.axis = 2
| Option | Description | Values |
|---|---|---|
name.enable |
Enable this MPG instance | true / false |
name.enca_pin |
Encoder A channel pin | Pin specification |
name.encb_pin |
Encoder B channel pin | Pin specification |
name.axis |
Axis to control | 0-5 (X=0, Y=1, Z=2, A=3, B=4, C=5) |
^ suffix for internal pull-up (recommended for open-collector outputs)! suffix for inverted logic if neededWith typical configurations:
| Steps/mm | Step Distance |
|---|---|
| 80 | 0.0125mm (12.5µm) |
| 100 | 0.01mm (10µm) |
| 200 | 0.005mm (5µm) |
| 400 | 0.0025mm (2.5µm) |
For single-MPG setups that can control multiple axes, you can use a Button Box or rotary selector switch to change which axis the MPG controls. This requires custom integration but allows a single hand wheel to control X, Y, or Z axis.
! suffix), or[actuator] sectionThe pins you specified don’t support interrupts or share the same EXTI line:
Here’s a complete configuration for a 3-axis CNC mill with MPG hand wheels:
[mpg]
# X-axis hand wheel
x.enable = true
x.enca_pin = PF10^
x.encb_pin = PF6^
x.axis = 0
# Y-axis hand wheel
y.enable = true
y.enca_pin = PA3^
y.encb_pin = PA4^
y.axis = 1
# Z-axis hand wheel
z.enable = true
z.enca_pin = PB7^
z.encb_pin = PD2^
z.axis = 2