Skip to content

Instantly share code, notes, and snippets.

@juanqui
Last active August 26, 2021 16:14
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save juanqui/59dd993682fbca209963854e0ba88cc3 to your computer and use it in GitHub Desktop.
Save juanqui/59dd993682fbca209963854e0ba88cc3 to your computer and use it in GitHub Desktop.
CR-10 S4 Duet2Wifi Config w/ BLTouch and AC Heated Bed
M561 ; clear any bed transform
G29 S2 ; Clear bed height map
; Probe 2-points
M401 ; Deploy probe - deployprobe.g
G30 P0 X20 Y200 Z-9999 ; Center Left
G30 P1 X340 Y200 Z-9999 S2 ; Center Right
M402 ; Retract Probe - retractprobe.g
; Configuration file for Duet WiFi (RepRapFirmware for Duet 2 WiFi/Ethernet 2.05.1 (2020-02-09b1))
; executed by the firmware on start-up
; General preferences
G90 ; Send absolute coordinates...
M83 ; ...but relative extruder moves
M564 H0 ; Allow movement without homing
; Network
M550 CR10S 400 Organic Handmade ; Set machine name
M552 S1 ; Enable network
M587 S"ssid" P"password" ; Configure access point. You can delete this line once connected
M586 P0 S1 ; Enable HTTP
M586 P1 S0 ; Disable FTP
M586 P2 S0 ; Disable Telnet
; Drives
M569 P0 S1 ; Drive 0 goes forwards
M569 P1 S1 ; Drive 1 goes forwards
M569 P2 S0 ; Drive 2 goes backwards
M569 P3 S0 ; Drive 3 goes backwards
M569 P4 S0 ; Drive 4 goes backwards
M584 X0 Y1 Z2:4 E3 ; Two Z motors connected to driver outputs 2 and 4
M671 X-29.9:428.2 Y200.0:200.0 S2 ; Lead screw offsets from home
M350 X16 Y16 Z16 E16 I1 ; Configure micro-stepping with interpolation
M92 X80 Y80 Z400 E415 ; Set steps per mm
M566 X720 Y720 Z18 E600 ; Set maximum instantaneous speed changes (mm/min)
M203 X6000 Y6000 Z180 E3000 ; Set maximum speeds (mm/min)
M201 X750 Y750 Z100 E5000 ; Set accelerations (mm/s^2)
M906 X1000 Y1000 Z800 E800 I30 ; Set motor currents (mA) and motor idle factor in percent
M84 S30 ; Set idle timeout
; Axis Limits
M208 X0 Y0 Z0 S1 ; Set axis minima
M208 X410 Y410 Z400 S0 ; Set axis maxima
; Endstops
M574 Z1 S0 ; Set active low end-stops
M574 X1 Y1 S1 ; Set active high end-stops
; Z-Probe
; https://duet3d.dozuki.com/Wiki/BLTouch_Troubleshooting
M307 H7 A-1 C-1 D-1 ; Disable heater on PWM channel for BLTouch
M558 P9 F100 H5 R0.2 T6000 A5 B1 ; Set Z probe type to bltouch and the dive height + speeds
G31 P25 X-59.9 Y-7.2 Z1.558 ; Set Z probe trigger value/sensitivity, offset and trigger height
M557 X40:340 Y40:340 S50 ; Define mesh grid
M376 H10 ; Taper compensation at Z=10mm
; Heaters
M307 H0 B0 S1.00 ; Disable bang-bang mode for the bed heater and set PWM limit
M305 P0 T100000 B4138 C0 R4700 ; Set thermistor + ADC parameters for heater 0
M143 H0 S120 ; Set temperature limit for heater 0 to 120C
M305 P1 X200 R397.5 ; Set PT100 + ADC parameters for heater 1 (BROKE, USING THERMISTER BELOW)
;M305 P1 T100000 B4388 R4700 ; Set thermistor + ADC parameters for heater 1
M143 H1 S320 ; Set temperature limit for heater 1 to 280C
M570 H0 P5 T15 S10 ; Set heat fault to 5 sec +/- 15C and save state for 10 minutes
; Fans
M106 P0 S1.0 I0 F500 H1 T50 ; Set fan 0 value, PWM signal inversion and frequency. Thermostatic control is turned on
M106 P1 S0.0 I0 F500 H-1 ; Set fan 1 value, PWM signal inversion and frequency. Thermostatic control is turned off
M106 P2 S0.0 I0 F500 H-1 ; Set fan 2 value, PWM signal inversion and frequency. Thermostatic control is turned off
; Tools
M563 P0 D0 H1 F1:2 ; Define tool 0 - use extruder 0, heater 1, fan 1, and fan 2
G10 P0 X0 Y0 Z0 ; Set tool 0 axis offsets
G10 P0 R0 S0 ; Set initial tool 0 active and standby temperatures to 0C
; Automatic power saving
M911 S21 R23 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000" ; Set voltage thresholds and actions to run on power loss
; Default firmware retraction configuration
M207 S3.2 R-0.1 F3600 T1200 Z0 ; Set 3.2mm retraction, -0.1 restart, 3600 mm/min feed rate, 1200 mm/min restart feed rate, no z change
; Other settings
G29 S1 ; Enable automatic bed mesh compensation
M572 D0 S0.16 ; Enable pressure-advance
M915 X Y S10 F1 R1 ; Enable stall detection for X and Y axis with a sensitivity of 10 and report only
M915 Z S0 F1 R1 ; Enable stall detection for Z axis with a sensitivity of 10 and report only
; Miscellaneous
M501 ; Load saved parameters from non-volatile memory
G91 ; relative positioning
G1 Z10 F6000 S2 ; lift Z relative to current position
G1 S1 X-415 Y-415 F1800 ; move quickly to X and Y axis endstops and stop there (first pass)
G1 X5 Y5 F6000 ; go back a few mm
G1 S1 X-415 Y-415 F360 ; move slowly to X and Y axis endstops once more (second pass)
G1 X250 Y200 F6000 ; move X and Y to the bottom left corner of the bed
G30 ; Do a single probe to home our Z axis
G90 ; Make sure we are in absolute mode
G1 X200 Y200 Z5 F6000 ; Move to parked position
G91 ; relative positioning
G1 Z10 F6000 S2 ; lift Z relative to current position
G30 ; Do a single probe to home our Z axis
G90 ; Make sure we are in absolute mode
G1 Z10 F6000 ; Rapidly move the Z axis to Z=10.
@juanqui
Copy link
Author

juanqui commented Sep 18, 2018

Upgraded Creality CR-10 S4 to the Duet2Wifi board

@RBTData
Copy link

RBTData commented Sep 19, 2018

im in the process of doing the same as you, upgrading cr-10s 500x500x500 with duet2 and Diamond head 3 in 1, is there anything i should consider that you came across?
im a noob to 3d printing and g-code.
do i copy and paste the above code, replacing your details with mine? (your user name and password are in the code)

@juanqui
Copy link
Author

juanqui commented Sep 19, 2018

Fake username and password :) That's intentional (changed to "ssid" and "password" to avoid confusion).

Also, like you, I was a total noob when it came to 3D printing and g-codes. I started by ordering a CR-10 S4 from the awesome folks at tinymachines3D and they did all the intial modifications for me (12V meanwell PSU, all metal hotend, etc...). I then started diving deep, reading tons of stuff online, and messing around. I have a background in electronics and firmware development, so that helped a bit when it came time to tinker with the controller and the firmware on my stock controller.

Having said that, I will say that breaking things is the best way to learn (specially when you learn how to fix what you broke). I recommend reading ALL the duet2wifi documentation available, and read it 5 times if possible. There is tons of useful information there!

I do not recommend blindly copying my configuration as there is some stuff there that is very specific for me, but there is some useful stuff there that you can use for sure! For example, I have my fans connected in a way you might not. I also have an AC bed heater that you might not have. Also, I have a BLTocuh z-probe and I have it configured specifically for that.

Check out: https://configurator.reprapfirmware.org/

You can create a configuration package (all the *.g files) for your printer by following that wizard. I got 80% of what I wanted that way, then I tweaked the rest manually. I recommend you do the same thing!

Good luck!

@juanqui
Copy link
Author

juanqui commented Sep 20, 2018

Update:

  • Instead of driving both Z-axis motors using a single driver (connected in series by default), I am now using two drives to drive both Z-axis independently! I am using Drive 2 (default Z axis) and Drive 4 (default extruder 2, but now Z2).
  • Configured my bed.g g-code script to probe left and right sides of the bed to figure out the skew so that the firmware can adjust the Z-axis motors independently to correct as much of the skew as possible. (Confirmed with a physical level and it appears to make it better).
  • Configured to use Pressure Advance and my prints looks better for sure! Still tweaking the right value for my bowden setup.
  • Enabled Stall Detection for all Axis. Currently configured to report for now as I have done minimal testing.

I am not SUPER thrilled with my BLTouch. It's been beat up a bit in the past and the reliability has dropped quite a bit. Currently exploring a Piezzo approach.

@RBTData
Copy link

RBTData commented Sep 21, 2018

Thanks for the advice and info. finally got the X, Y, Z (x2) steppers connected to the duet2, got the 3 extruders connected(2 on the duet wifi and 1 on the Duex5), haven't connected the hot end or heat bed yet (wanted to get steppers working first).
ive read that the new firmware(2.0) needs the S2 parameter to the z axes or add the M564 H0 to config.g. i tried to edit the homex.g homey.g homeall.g by adding " ; " without the exclamation marks to the lines relating to the Z axes. how can i add the M564 H0 to config.g? been reading a fair bit regarding the wiring and connecting to the boards and getting the correct pins connected, im guessing its connected correctly because the axes lights on the mobo turn red when i plug the usb cable in to power, and turn off when i press the end stop switch.

@juanqui
Copy link
Author

juanqui commented Sep 21, 2018

Are you powering the board just from USB? Or are you powering it via a 12-24V PSU? Remember that the stepper drivers, bed, and hotends only operate with 12-24V PSU (and the fans as well, but those can be made to run from 5V with jumpers).

With regards to M564, I am not sure why you would need that. If you set that then you are telling the Duet to allow any G0/G1 move commands on axis that have not been homed. I do not recommend that since you should be homing the axis first. The default homing script generated by the online configurer should be adequate at least for the X and Y axis. I would try to home one axis at a time with G28 X for example.

Make sure you test your endstops manually. You can do this by tapping them and watching the LED on the board corresponding to the endstop flash. Also, when you trigger homing of one axis for the first time, be ready to hit the emergency stop button or unplug the power in case the motor moves in the wrong direction (away from the endstop) or something weird happens.

Hope that helps!

@RBTData
Copy link

RBTData commented Sep 22, 2018

thanks for getting back to me, there's my problem, on the schematics for the Duet2 wifi it says the external PSU is optional, i knew the heat bed and hot end needed external power, i though the usb would power the steppers as it said optional. if i use the PSU that came with the cr-10s, would i need to connect the mosfet(i think its called in the cr-10 box) that goes to input voltage(green connectors) and to mobo(green connector), or can i connect the heat bed directly to the mobo?

@juanqui
Copy link
Author

juanqui commented Sep 24, 2018

The PSU that comes with the CR10S is a 12V PSU, which is compatible with the Duet2Wifi board. Also, the Duet2Wifi board already has a built-in MOSFET on the board used to switch the heater bed on and off. All you need to do is connect the PSU to the Duet2Wifi (make sure the polarity is right! also, confirm voltage with volt meter before connecting... just in case). Then you can connect the heat bed to the Duet2Wifi (also keeping polarity correct!). The CR10S heat bed (300, 400, or 500) is compatible with the power that the Duet2Wifi MOSFET can handle. Make sure you are careful when working with electronics btw! The PSU needs 110/220V AC main power (which is very dangerous if you don't take proper precautions).

@juanqui
Copy link
Author

juanqui commented Apr 12, 2020

A few updates since this all started :)

  • Changed my extruder to a Bondtech BMG (Bowden configuration)
  • Configured retractions with firmware (using PrusaSlicer mostly with firmware retractions enabled)
  • Updated for latest v2 Duet2 firmware (will upgrade to v3 soon -- lots of config changes with this one!)

@WhiskeyTang0F0xtr0t
Copy link

This is great. I'm considering the Duet 2 WiFi for my S5 with a Bondtech DDS and BLTouch. Did you have to use the adapter board for your hot end temp sensor?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment