Ender 5 – Duet 2 Upgrade

Duet 2 Ethernet

The stock Creality v1.1.5 silent 8-bit mainboard works fine out of the box. However, if you like hacking and modding then upgrading your mainboard is probably on your mind. When it comes to upgrading going to a 32-bit ARM based board is a no brainer.

Ender 5 w/ Hemera, Duet 2 Eth, Laser Filament Sensor, Soft Power Mod, 7″ Paneldue, NV Camera, Cable Chains, and BL Touch

Ryan Carlyle’s answer is a convincing argument for a 32-bit ARM controller:

From StackExchange:

3D printer controllers have to do a lot of stuff very, very fast. Performing kinematics and dynamics calculations while sending many thousands of precisely-synchronized step pulses per second is really, really hard. The 8bit AVR line of microcontrollers used in older 3D printer controllers is basically a late-1990s era Mr Coffee processor. They are completely, utterly maxed out on processor time just executing basic printing functions in simple (eg Cartesian) printers, and adding additional calculation load will bog them down and cause slowdowns, stuttering, pausing, and so on.

Ryan Carlyle – StackExchange

The advantages of a 32 bit controller summarized by mechlab.cc as follows:

  • Speed – 8-bit controllers slow down the hotend dramatically when calculating curves and arcs.
  • Resolution – slicers will compensate for slow and complex calculations by reducing resolution, so as not to introduce overextrusion and zits.
  • Acceleration – appropriate centripetal/radial acceleration cannot be appropriately calculated, introducing a multitude of issues on curves and small segments, including a “lowest common denominator” default speed of 40mm/s or less on complex perimeters.
  • Print Quality – better motion planning on a higher-speed processor can product better quality prints, faster.
  • Reduced noise – the stepper interrupt on 8 bit processors can bottleneck the processor, so firmware will often compensate with step doubling, which causes louder and rougher motor motion.
  • Avoiding firmware problems – Many software-based hacks have been created to compensate for the lack of hardware floating point in 8 bit processors. Firmware updates can completely bog down an 8 bit processor if they have not been tested under a variety of conditions.

Duet 2 Ethernet 32-bit Controller

My research lead me to the Duet products and specifically the Duet 2 Ethernet board. The Duet 2 comes in two flavors. The WiFi version and the Ethernet version. The Duet 2 Ethernet version is a little more expensive than the WiFi version and it is intended to be hardwired directly to a jack but either board could be used with the instruction in this post.

Duet 2 Wifi
Duet 2 Ethernet Controller

Original or Clone?

Like many products in the 3D printing world you have originals and clones. When it comes to the mainboard you must remember this little chunk of electronics controls your heating elements and sources a decent amount of amperage to do so. Two areas you don’t want to cut corners on are the mainboard and the power supply. Both need to come from reputable sources and I would recommend against lower cost clones with bad reviews or better yet buy an original. That being said, I am not a clone hater. You will see in a future post that when it comes to my touch screen display I do opt for a clone.

Installation

Wiring

When installing the mainboard I decided it was a good time to upgrade my wiring as well and to include chain guides to make the wiring neater. This is not required by any means but you should note on my pictures I have removed all of the stock wiring and replaced it with a combination of twisted pair stranded Ethernet wire to reduce signal noise in the steppers and heavier gauge high temperature for heating elements.

Tools

Having the right tools makes the job go much smoother. Having everything neatly labeled and organized will save you a lot of time in the future with new mods or troubleshooting issues. I had already purchased a label maker that prints directly onto shrink tubing. I use this for all of my wiring projects. This is not a must but if you start using it now and you do a lot of small wiring projects it comes in very handy. This is really a very versatile tool. You can label groups of wires and terminate connections all with the same tool.

You will find that these types of motherboards have a green post and socket connection known as a “Ferrule” for the high current items. Since we are dealing with heating elements I wanted a solid connection and decided it was time to get the correct crimping tool and a set of post ends specifically for these types of connections.

The Duet 2 comes with all of the JST style of connectors needed. If you have decided to remove the stock wiring and upgraded to twisted pair you will need a variety of JST connectors. The Stepper motors are JST-PH6 while the Duet is a combination of 2.0mm JST-PH2/3/4.and 2.54mm JST-SM connectors. The connectors are cheap and I purchased the following variety packs to ensure I had spares on hand for each type.

To mount the board you will not be able to use the Creality board posts. Instead you will use slightly taller mounting posts so you can mount the board above the existing mounts for clearance.

Soft Power Control and Auto Shutdown

The Duet 2 mainboard has two different power input options. Details can be found on their website here. One very interesting feature is the ability to power the processor on the Duet 2 with a separate 5VDC supply and use the primary 24VDC supply to power to the steppers, heated bed, and hot end. This cool feature lets you use the Duet 2 Web Control (DWC) without the need for the larger 24VDC supply to be on. The user can use the DWC to load files, view the webcam, and most importantly control the 24VDC power supply via shutdown scrpts. This means you can log onto the Duet 2 web control and power the primary printer control on/off as well as script the printer to turn itself off AFTER cooling a completed and a job!

Supplies Needed

To use this feature you will need to add a 5VDC supply with a simple inline outlet that all fits inside the enclosure as pictured below. The Ender 5 PSU 115VAC input wall power (mains) is then disconnected from the 24VAC PSU and instead it is spliced to power the 5VDC PSU Brick that in turn powers the processor on the Duet. The Duet then controls the dry contact relay to route 115VC power to the 24VDC supply to power the remaining features.

Duet 2, Relay, and Primary PSU mounted.

It is necessary to reposition the 24VDC PSU to make all this fit. This is a simple effort of removing the decal on the top of the enclosure. Moving the PSU to the desired location, drilling new mounting holes, and replacing the screws. I recommend removing all of the electronics from the enclosure and drilling all of the mounts at once to include mainboard, relay assemble, and the new push button switch. Finally replace the decal and us a punch to punch through the decal into the new mounting holes and begin mounting the new hardware.

Ender 5 Duet 2 Mounting
Duet 2 Ethernet + Raspbery Pi 5vDC PSU brick + PSU Control Relay

Notice the Red & Black 24VDC wires that come from the 24VDC PSU output to the Duet 2 input at the bottom left of the above image. The image also shows the MicroUSB power that controls the Duet 2 processor routed from the raspberry pi PSU to the top left of the image and connected to the Duet 2 5v DC input. Finally, the dry contact 5VDC logic relay can be seen in the bottom middle (two blue boxes). This relay will be controlled by the PSU_ON logic output of the Duet 2 to switch on/off the 115VAC mains power to the 24VDC PSU.

Duet 2 5V Power Connection

The raspberry Pi PSU just plugs straight into the Duet 2 microUSB connector and the 3.5A PSU sources plenty of current to drive even the 7″ PanelDue along with the Duet 2.

  1. Add an inline AC outlet to internally power the 5VDC PSU brick
  2. Add a Dry Contact Relay to control the primary PSU power
Duet 2 5VDC Power Mod + Relay

Make sure to use proper connectors, AWG wire, and color coding to keep your wiring safe and organized.

  • 14 AWG Wire for the AC connections. Black=Hot, White=Neutral
  • 18 AWG Wire for the 5V DC connections. Black=Gnd, Red=+5v
  • 18 AWG Wire for the 5V DC relay Control. (Shown in Purple below)

Power Switch

Ok, So now that we have this all connected how are we going to power the Duet 2 board on/off? We will use the existing rocker switch inline with the internal 115VAC outlet which in turn controls the 5VDC PSU plugged into the outlet.

Duet 2 Power Input Configuration

To configure the Duet2 to use an external 5VDC separate supply we must set the board jumper to the ext 5v setting as seen below.

Set Duet 2 Power Select Jumper to External 5VDC Supply

Relay 5V Power Connections

The relay is powered by the Duet 2 expansion port. The Duet 2 PSU_ON signal controls the #1 relay to switch the 115VAC ON/OFF via the Duet Web Control. The JD-VCC jumper must be in place to set the relay to use 5V logic.

Duet 2 PinRelay PinSignalWire Color
Exp – Pin#1VCC+5VDCRed
Ext Power – PSU_ONIN1Gnd/OpenPurple
Exp – Pin#2GNDGNDBlack
Relay DC Connections
Dray Contact Relay Connections

Full Software Power Control (optional)

If you stop here you will be able to use the web control interface to power the 24VDC supply (hot ends, bed heater, & steppers) but you won’t be able to remotely shutdown the Duet 2. If you would like full soft ATX style power control that will enable full automatic system shutdown then continue with the next “Soft ATX Style Power Control” modification (optional).

Duet Config.g Updates

Assuming you have followed the instructions for installing the Duet 2 from the manufacture’s website you will need some config.g configuration changes.

Here is a copy of my full config.g file. Note that this assumes you have used the same wiring scheme as detailed in this PDF. In addition to the mainboard I have also installed the 24VDC Hemera extruder/hotend combo discussed in this post. Notice the M81 command under custom settings. Without this M81 command initializing the system to OFF, the ON/OFF switch in the web control will not be visible.

; Configuration file for Duet WiFi (firmware version 3)
; executed by the firmware on start-up
;
; generated by RepRapFirmware Configuration Tool v2.1.8 on Sun Feb 09 2020 08:41:29 GMT-0600 (Central Standard Time)

; General preferences
G90                                                    ; send absolute coordinates...
M83                                                    ; ...but relative extruder moves
M550 P"Ender 5 Hemera"                                 ; set printer name
M918 P1 E4 F2000000                                    ; configure direct-connect display

; Network
M552 P0.0.0.0 S1                                       ; enable network and acquire dynamic address via DHCP
M586 P0 S1                                             ; enable HTTP
M586 P1 S1                                             ; enable FTP
M586 P2 S0                                             ; disable Telnet

; Drives
M569 P0 S0                                             ; physical drive 0 goes backwards
M569 P1 S0                                             ; physical drive 1 goes backwards
M569 P2 S0                                             ; physical drive 2 goes backwards
M569 P3 S0                                             ; physical drive 3 goes backwards
M584 X0 Y1 Z2 E3                                       ; set drive mapping
M350 X16 Y16 Z16 E16 I1                                ; configure microstepping with interpolation
M92 X80.00 Y80.00 Z800.00 E392.70                      ; set steps per mm
M566 X1200.00 Y1200.00 Z24.00 E300.00                  ; set maximum instantaneous speed changes (mm/min)
M203 X9000.00 Y9000.00 Z1800.00 E3600.00               ; set maximum speeds (mm/min)
M201 X500.00 Y500.00 Z100.00 E5000.00                  ; set accelerations (mm/s^2)
M906 X800 Y800 Z800 E800 I50                           ; set motor currents (mA) and motor idle factor in per cent
M84 S30                                                ; Set idle timeout

; Axis Limits
M208 X0 Y0 Z0 S1                                       ; set axis minima
M208 X220 Y207 Z300 S0                                 ; set axis maxima

; Endstops
M574 X2 S1 P"xstop"                                    ; configure active-high endstop for high end on X via pin xstop
M574 Y2 S1 P"ystop"                                    ; configure active-high endstop for high end on Y via pin ystop
M574 Z1 S2                                             ; configure Z-probe endstop for low end on Z

; Z-Probe
M950 S0 C"exp.heater4"                                 ; create servo pin 0 for BLTouch
M558 P9 C"zprobe.in+zprobe.mod" H5 F120 T6000          ; set Z probe type to bltouch and the dive height + speeds
G31 P500 X-43 Y3 Z2.06                                 ; set Z probe trigger value, offset and trigger height
M557 X0:180 Y0:195 S40                                 ; define mesh grid

; Heaters
M308 S0 P"bedtemp" Y"thermistor" T100000 B4138         ; configure sensor 0 as thermistor on pin bedtemp
M950 H0 C"bedheat" T0                                  ; create bed heater output on bedheat and map it to sensor 0
M143 H0 S120                                           ; set temperature limit for heater 0 to 120C
M307 H0 B0 S1.00                                       ; disable bang-bang mode for the bed heater and set PWM limit
M140 H0                                                ; map heated bed to heater 0
M308 S1 P"e0temp" Y"thermistor" T100000 B4725 C7.06e-8 ; configure sensor 1 as thermistor on pin e0temp
M950 H1 C"e0heat" T1                                   ; create nozzle heater output on e0heat and map it to sensor 1
M143 H1 S285                                           ; set temperature limit for heater 1 to 285C
M307 H1 B0 S1.00                                       ; disable bang-bang mode for heater  and set PWM limit

; Fans
M950 F0 C"fan0" Q500                                   ; create fan 0 on pin fan0 and set its frequency
M106 P0 C"F0 Part Cooling Fan" S0 H-1                  ; set fan 0 name and value. Thermostatic control is turned off
M950 F1 C"fan1" Q500                                   ; create fan 1 on pin fan1 and set its frequency
M106 P1 C"F1 Hot End Fan" S1 H1 T45                    ; set fan 1 name and value. Thermostatic control is turned on
M950 F2 C"fan2" Q500                                   ; create fan 2 on pin fan2 and set its frequency
M106 P2 C"F2 Case Fan" S1 H1:0 T45                     ; set fan 2 name and value. Thermostatic control is turned on

; Tools
M563 P0 S"Hemera" D0 H1 F0                             ; define tool 0
G10 P0 X0 Y0 Z0                                        ; set tool 0 axis offsets
G10 P0 R0 S0                                           ; set initial tool 0 active and standby temperatures to 0C

; Custom settings
M591 D0 P5 C"e0stop" R40:120 E3.0 S1  ; Duet3D laser sensor for extruder drive 0, connected to endstop input 3 (E0), tolerance 40 to 120%, 3mm, S1=Enabled, S0=Disabled
M81					                                               ; Turn off 24VDC power on start up and enable control in the UI


; Miscellaneous
M501                                                   ; load saved parameters from non-volatile memory
T0                                                     ; select first tool

Leave a Reply

Your email address will not be published. Required fields are marked *