This is a DIY project to interface a popular style of CNC pendant to the PanelDue port of a Duet 3 or Duet 2 WiFi/Ethernet/Maestro.
Install Arduino IDE 1.8.1 on your PC and create a new sketch called CNC-pendant. Then download all the files from the /src folder of https://github.com/Duet3D/CNC-Pendant-Firmware and put them in your sketch folder, overwriting the file CNC-pendant.ino file already there. Select board type Arduino Micro, connect the Arduino to your PC via USB, and program the sketch in it.
For wiring differences and hardware changes needed if using an Arduino Micro or Nano, see the comments at the start of the CNC-pendant.ino file.
Note: If you experience issues with skipped steps when using the encoder, a possible fix has been posted on the Duet forum by user morgoth90 here: https://forum.duet3d.com/topic/36798/cnc-pendant-encoder-skipping-step.
They wrote: "After a few fast encoder rotations the detected pulses disalign resulting in two stray pulses after each detected movement. This behaviour is probably caused by some missed pulse but as result will ignore the first movement in the opposite direction. After some tests I fixed the issue rewriting the encoder code using the arduino Encoder library."
Replace the RotaryEncoder.cpp
and RotaryEncoder.h
files in the CNC-pendant sketch with those from the forum thread. Feedback welcome.
Click for larger version
Thanks to forum user jeffouille for the diagram.
If you are replacing the 18-or 20-core cable supplied with the pendant by 3- or 4-core cable, cut the 3- or 4-core cable to length and curl it if desired using the heat gun and a wooden dowel. Remove the back of the pendant and cut the 18- or 20-core cable close to the body of the pendant, making sure that you leave enough length for the individual wires to reach the Arduino, which will be installed in the top of the pendant. Remove the cut cable from the cable gland and feed the 4-core cable though it instead. Use tape or heatshrink on the outside of the 4-core cable to make it big enough for the cable gland to grip.
The cut ends of the original 18- or 20-core cable, and the cores of the 4-core cable, must be connected to the Arduino Pro Micro as listed below.
Pro Micro | Pendant | Wire colours |
---|---|---|
VCC | +5V | red |
GND | 0V | black |
COM | orange/black | |
CN | blue/black | |
LED- | white/black | |
D2 | A | green |
D3 | B | white |
D4 | X | yellow |
D5 | Y | yellow/black |
D6 | Z | brown |
D7 | 4 | brown/black |
D8 | 5 | pink (if present) |
D9 | 6 | pink/black (if present) |
D10 | LED+ | green/black |
A0 | STOP | blue |
A1 | X1 | grey |
A2 | X10 | grey/black |
A3 | X100 | orange |
NC | /A | violet |
/B | violet/black |
As there are several wires that need to be connected to ground, it's easiest if you connect them together at the ground terminal of the rotary encoder, then run a single ground wire from there to the Arduino. That way you don't need to connect more than one wire to each pad of the Arduino, except that you need to connect both +5V from the 4-core cable and +5V for the encoder to the VCC terminal.
Wire the Arduino Pro Micro to the Duet 3 IO_0 connector or Duet 2 PanelDue connector. You can use a 3-core cable if you don't plan on connecting a PanelDue, or 4-core cable if you do.
Pro Micro | Duet | Wire colour |
---|---|---|
VCC | +5V | red |
GND | GND | yellow |
TXO | Through 6K8 resistor to IO_0_IN (Duet 3) or URXD0 (Duet 2) | blue, from resistor junction to Duet |
GND | Through 10K resistor to IO_0_IN (Duet 3) or URXD0 (Duet 2) |
If you do not intend to use a PanelDue at the same time as the pendant, it's best to leave the green wire of the 4-core cable (the one that would be connected to DOUT on the PanelDue) not connected to the Arduino RX0 pin, otherwise it might pick up noise.
The Arduino can then be tucked inside the top of the pendant as shown above.
Before refitting the back of the pendant, put some Kapton tape or insulating tape over the top two magnets, to prevent them from possibly shorting out connections on the Arduino.
To connect a PanelDue as well, the Arduino Pro Micro passes the PanelDue commands through to the Duet. The PanelDue can be connected at either end of the cable, i.e. close to the Arduino Pro Micro if you wanted to have a combined Pendant with PanelDue display, or at the Duet end if the PanelDue is mounted to the machine, and the Pendant is used remotely.
PanelDue | Pro Micro / Duet | Wire colour |
---|---|---|
+5V | +5V/VCC on Ardiuno or Duet | red |
GND | GND on Ardiuno or Duet | yellow |
DIN | Duet IO_0_OUT (Duet 3) or UTXD0 (Duet 2) | green |
DOUT | Pro Micro RXI | blue wire of PanelDue cable to green wire of pendant cable |
The DOUT signal from the PanelDue (which is usually the blue wire in a 4-core cable) must be connected to the RXI pin of the Arduino in the pendant (the green wire in the 4-core pendant cable is used in the wiring list). Connect the blue wire from PanelDue to the green wire of the pendant. Connect the DIN (green) PanelDue wire to the IO_0_OUT pin of the IO_0 connector (Duet 3), or the UTXD0 pin of the PanelDue connector (Duet 2). The +5V pin on the Duet connector goes to the +5V (red) wire of both the pendant and the PanelDue, likewise the ground connection goes to the yellow wires of both.
I used solder sleeves to connect the PanelDue and pendant cables to a short length of 4-core cable that plugs into the Duet, as shown here before I shrunk the heatshrink over the joints.
Please use the forum for support requests.