Site Navigation

Your Account

Choose Language

Introduction ¶ 

The Gcodes M42 Switch I/O pin and M280 set servo position allow direct control of some pins, or re-purposing of those pins to control PWM hobby servos

Important note on connecting servos ¶ 

When a servo stops moving, it can pump a large amount of energy into the +5v rail due to regenerative braking. If unchecked, this may increase the voltage of the +5V rail above the safe limit. The 1.04 revision of the Duet 2 WiFi/Ethernet has an extra 220uF capacitor on the 5v rail to help absorb this, so does the Duet 2 Maestro. Older Duets don't. So when using servos with them it is advisable to add your own 220uF capacitor between the +5V and ground servo wires.

Logical pin numbers ¶ 

Starting with firmware version 1.16, pin numbers in the M42 command are logical pin numbers as listed below, not Arduino-like pin numbers. The M280 servo control command uses a subset of the same pin numbers.

Note that these logical pin numbers are not the physical pin numbers on the expansion header, or the internal pin numbering within the firmware.

To see where these pins are on the 2nd Generation Duets, see the Duet wiring diagrams

Pin numbersUsual functionPWM capable?Usable for servos?Notes
0-7Heaters 0-7yesyesDisable the heater using M307 H# A-1 C-1 D-1 to make the pin available, where # is the heater number, and make sure that no tool is configured to use that heater. The outputs on the expansion connector are active low with 3.3V signal level. On the Duex 5 expansion board, heater channels 3-7 are available as 5V active-high signals on the PWM1 - PWM5 connectors respectively. On the DueX2 from version 0.8a onwards, heater channels 3-7 are available on PWM1 - PWM5, prior to that heater channels 3-5 only are available on PWM1 - PWM3 . Caution: the heater output terminals will also be driven by the PWM signal or servo pulses.
20-27Fans 0-7yes20-22 onlyDisable the fan using M106 P# I-1 to make the pin available, where # is the fan number. Fans 3-7 are on the Duex 5 and Duex 2 expansion boards.
40-49Endstop connectors 0-9nono40-44 are input-only. On the Duet 2 WiFi and Duet 2 Ethernet, if a Duex 2 or Duex 5 expansion board is connected then 45-49 are the endstop connectors on the expansion board and are input-only; else they are additional endstop connections in the expansion connector. On the Duet 0.6 and 0.8.5, 45-48 are the endstop inputs on the expansion connector.
60-Miscellaneous pinsvariesvariesThe pins available depend on which Duet you have - see below
100-Pins on expansion devicesvariesvariesThe pins available depend on which Duet you have - see below

Board dependencies ¶ 

Duet 2 WiFi and Duet 2 Ethernet ¶ 

The miscellaneous pin numbers 60-63 correspond to the CS5-CS8 pins on the expansion connector. These were originally allocated for use as the E2-E6 endstop pins and are labelled as such on the expansion connector, but they are now used to address thermocouple and PT100 daughter boards on a Duex 2 or Duex 5 instead. Because most users don't need more than the four thermocouple and PT100 channels supported on the Duet 2, we make CS5-8 available as general purpose I/O if you do not have any daughter boards fitted to the Duex 2 or 5. Here is the mapping between pin numbers, signal names, and the labels on the expansion connector:

Logical pinSignal nameExpansion connector labelExpansion connector pin numberPWM capable?Servo capable?Notes
60CS5CS550nono
61CS6E3_STOP9nono
62CS7E4_STOP14nono
63CS8E5_STOP19nono
64ENC_SWENC_SW on CONN_SD connector7 on CONN_SD connectornono
65Z_PROBE_MODMOD on Z-probe connector3 on Z-probe connectornono
100-103GPIO pins 1-4yesnoThese are on the Duex 2 and Duex 5 expansion boards
120-135SX1509B expansion I/O pinsyesnoThese are on an SX1509B-based expander board at I2C address 0x71 connected to a Duet 2 Wifi/Ethernet

Logical pins 64 and 65 are supported in firmware 2.01 and later only. Note that the Z_PROB_MOD pin is driven automatically when some Z probe modes are selected.

Duet 2 Maestro ¶ 

Logical pinSignal nameExpansion connector labelExpansion connector pin numberPWM capable?Servo capable?Notes
60PA21/RXD1/AD8EXP04nono
61PA22/TXD1/AD9EXP15nono
62PA3/TWDTWD09nono
63PA4/TWCTWCK08nono
64Z_PROBE_MODMOD on Z_PROBE connector3 on Z_PROBE connectoryesyes

Duet 0.6 and 0.8.5 ¶ 

The mapping between logical pin numbers for miscellaneous pins and the corresponding signal names on the expansion connector is as follows.

Logical pin numberExpansion connector signal name
60PA10/RXD0
61PA11/TXD0
62PA12/RXD1
63PA13/TXD1
64PA14/RTS1
65PB12/TWD1
66PB13/TWCK1
67PB16/DAC1 (also used as CS signal on external SD card socket)
68PB21/AD14
69PC4

Image from wikipedia

2 Comments

Dear David,

is there any information available for RADDS pin assignments.

There are three Servo pins available on a RADDS board, labeled as PWM1-3. But I can not really make out on how to call them in RRF notation.

Thanks for your help,

Andreas

Andreas Melzer - Reply

Hello,

I am looking to directly control the unused pins with C/C++ code (like an arduino). Is there a way to do this in the firmware or is there separate firmware I can load onto the Duet Wifi?

Thank You,

Caleb

caleb young - Reply

View Statistics:

Past 24 Hours: 25

Past 7 Days: 138

Past 30 Days: 565

All Time: 3,568