Diamond hotend firmware installation

  • Hi, Good day,

    I installed firmware for Diamond full-color hotend on Duetwifi & DUEX5. My printer is very big so I use 4motors for z-axis and 2 motors for y-axis and wired 2 of y-motors to E0(P3) and E1(P4) separately and 2 z-motors in series to P1 and other two z-motors to P2. All 5 extruder motors are wired to DUEX5 drives.

    But regretfully 3 of z-motors are not working and I checked "machine properties" on DWC and found drives are 11 as described bottom which seems to be wrong. It would be appreciate if you correct my G-code below. And DWC comment M568 is no needed any more. Then what code should I use instead to mix colors.

    /// G CODE ///

    ; General preferences
    M111 S0 ; Debugging off
    G21 ; Work in millimetres
    G90 ; Send absolute coordinates…
    M83 ; ...but relative extruder moves
    M555 P1 ; Set firmware compatibility to look like RepRapFirmare
    ; Automatic saving after power loss is not enabled
    M208 X0 Y0 Z0 S1 ; Set axis minima
    M208 X500 Y500 Z300 S0 ; Set axis maxima

    ; Endstops
    M574 X1 Y1 Z1 S0 ; Set active low endstops
    ;M558 P0 H5 F120 T6000 ; Set Z probe type to switch and the dive height + speeds
    ;G31 P600 X0 Y0 Z2.5 ; Set Z probe trigger value, offset and trigger height
    ;M557 X15:485 Y15:485 S20 ; Define mesh grid

    ; Drives
    M569 P0 S0 ; Drive 0 goes backwards
    M569 P1 S1 ; Drive 1 goes forwards
    M569 P2 S1 ; Drive 2 goes forwards
    M569 P3 S1 ; Drive 3 goes forwards
    M569 P4 S1 ; Drive 4 goes forwards
    M569 P5 S0 ; Drive 5 goes backwards
    M569 P6 S0 ; Drive 6 goes backwards
    M569 P7 S0 ; Drive 7 goes backwards
    M569 P8 S0 ; Drive 8 goes backwards
    M569 P9 S0 ; Drive 9 goes backwards

    M584 X0 Y3:4 Z1:2 E5:6:7:8:9 ; Apply custom drive mapping
    M350 X16 Y16 Z16 E16:16:16:16:16 I1 ; Configure microstepping with interpolation
    M92 X80 Y80 Z320 E420:420:420:420:420 ; Set steps per mm
    M566 X900 Y900 Z12 E120:120:120:120:120 ; Set maximum instantaneous speed changes (mm/min)
    M203 X6000 Y6000 Z180 E1200:1200:1200:1200:1200 ; Set maximum speeds (mm/min)
    M201 X500 Y20 Z250 E250:250:250:250:250 ; Set accelerations (mm/s^2)
    M906 X800 Y800 Z800 E800:800:800:800:800 I30 ; Set motor currents (mA) and motor idle factor in per cent
    M84 S30 ; Set idle timeout

    ; Heaters
    M140 H-1 ; Disable heated bed
    M305 P1 T100000 B4138 C0 R4700 ; Set thermistor + ADC parameters for heater 1
    M143 H1 S280 ; Set temperature limit for heater 1 to 280C

    ; tools
    M563 P0 D0:1:2:3:4 H1 ; 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
    M568 P0 S1 ; Enable mixing for tool 0
    M567 P0 E0.92:0.02:0.02:0.02:0.02 ; Set mixing ratios for tool 0 (92%, 2%, 2%, 2%, 2%)
    M563 P1 D0:1:2:3:4 H1 ; Define tool 1
    G10 P1 X0 Y0 Z0 ; Set tool 1 axis offsets
    G10 P1 R0 S0 ; Set initial tool 1 active and standby temperatures to 0C
    M568 P1 S1 ; Enable mixing for tool 0
    M567 P1 E0.02:0.92:0.02:0.02:0.02 ; Set mixing ratios for tool 0 (92%, 2%, 2%, 2%, 2%)
    M563 P2 D0:1:2:3:4 H1 ; Define tool 2
    G10 P2 X0 Y0 Z0 ; Set tool 2 axis offsets
    G10 P2 R0 S0 ; Set initial tool 2 active and standby temperatures to 0C
    M568 P2 S1 ; Enable mixing for tool 0
    M567 P2 E0.02:0.02:0.92:0.02:0.02 ; Set mixing ratios for tool 0 (92%, 2%, 2%, 2%, 2%)
    M563 P3 D0:1:2:3:4 H1 ; Define tool 3
    G10 P3 X0 Y0 Z0 ; Set tool 3 axis offsets
    G10 P3 R0 S0 ; Set initial tool 3 active and standby temperatures to 0C
    M568 P3 S1 ; Enable mixing for tool 0
    M567 P3 E0.02:0.02:0.02:0.92:0.02 ; Set mixing ratios for tool 0 (92%, 2%, 2%, 2%, 2%)
    M563 P4 D0:1:2:3:4 H1 ; Define tool 4
    G10 P4 X0 Y0 Z0 ; Set tool 4 axis offsets
    G10 P4 R0 S0 ; Set initial tool 4 active and standby temperatures to 0C
    M568 P4 S1 ; Enable mixing for tool 0
    M567 P4 E0.02:0.02:0.02:0.02:0.92 ; Set mixing ratios for tool 0 (92%, 2%, 2%, 2%, 2%)
    M563 P5 D0:1:2:3:4 H1 ; Define tool 5
    G10 P5 X0 Y0 Z0 ; Set tool 5 axis offsets
    G10 P5 R0 S0 ; Set initial tool 5 active and standby temperatures to 0C
    M568 P5 S1 ; Enable mixing for tool 5
    M567 P5 E0.2:0.2:0.2:0.2:0.2 ; Set mixing ratios for tool 5

    /// Machine properties on DWC ///

    Drive Endstop hit Minimum Maximum InstantDv Max Speed Acceleration Motor Current
    0 Yes 0 mm 500 mm 15 mm/s 100 mm/s 500 mm/s² 800 mA
    1 Yes 0 mm 500 mm 15 mm/s 100 mm/s 20 mm/s² 800 mA
    2 Yes 0 mm 300 mm 0.2 mm/s 3 mm/s 250 mm/s² 800 mA
    3 Yes n/a n/a 2 mm/s 20 mm/s 250 mm/s² 800 mA
    4 Yes n/a n/a 2 mm/s 20 mm/s 250 mm/s² 800 mA
    5 Yes n/a n/a 2 mm/s 20 mm/s 250 mm/s² 800 mA
    6 Yes n/a n/a 2 mm/s 20 mm/s 250 mm/s² 800 mA
    7 Yes n/a n/a 2 mm/s 20 mm/s 250 mm/s² 800 mA
    8 Yes n/a n/a 2 mm/s 20 mm/s 250 mm/s² 800 mA
    9 Yes n/a n/a 2 mm/s 20 mm/s 250 mm/s² 800 mA
    10 Yes n/a n/a 2 mm/s 20 mm/s 250 mm/s² 0 mA
    11 No n/a n/a 2 mm/s 20 mm/s 250 mm/s² 0 mA

    Thanks & Best regards / JR OH

  • Can't help with your config at the mo but why 4 motors for Z 3 is good 4 is very bad and can cause lots of twisting of the Bed.

    sure Ian or David will be along soon enough to help with the config.


  • administrators

    Drives 10 and 11 are on the LCD header and not used in your design I think.

    What is not working with your 3 Z drives

  • Thanks for the advises.

    Firstly I used 4 motors as my printer is very big(1600x1000x1000mm) and frame is very heavy. So I thought it should need lots of motors to lift frame.

    And only one z-motor wired to Z2 is working. other 3 z-motors wired to P1 in series and Z1(out of P2) are not working. For reference, motors are all NEMA17 47mm ldomotors.

    Thanks and waiting for reply.

  • administrators

    If you have wired 2 Z motors in series to one of the outputs but only one of them is working, it sounds like a wiring issue or a stuck motor. Does the motor shaft turn freely? How have you wired them?

  • I changed Z1 and Z2 and tried to move and now Z1 is working. It seems other 3 motors are dead.
    Could you advise what kind of case motors are dead?
    Checked the shaft and shaft are moving freely. I wired it as per instruction of motor company and other motors at X and Y are working well.

  • Tried connecting one motor to P1 for one of z-motor instead of in series and found motor was moving slightly not perfect. Now I'm very sure motor has no sufficient power and will try to change motor current and come back with result.


  • administrators

    What is the specification of the motors?

  • motors are all NEMA17 LDO42STH47-1684AC
    I just changed motor current to 1600 instead 800 and found all motors are now working. So it's current mistake.

    Thanks for helps to all.

  • just one more question please.

    Can I set max current, such as 2500 for z-drive current as 4 motors are dividing 2 motor drives. I still feel 2 motors wired in series are not working perfect.

    Rated current for NEMA 17 LDO42 motor is 1.68A.

  • administrators

    If you are sure that you have wired the 2 motors in series (not in parallel), then the current isn't being divided. It's the voltage that is being divided, but that won't matter unless you are trying to spin the motors too fast. See the link to the spreadsheet at the end of https://duet3d.com/wiki/Choosing_stepper_motors#How_to_work_out_the_power_supply_voltage_you_need to work out the maximum Z speed you can get before the motors start to lose torque.

  • I suspect you have your steps per mm for the Z axis set incorrectly which is why the motors are struggling. Either that or you have screws with a very course 10mm lead, which is still going to make the motors struggle. The reason I say that is that my screws are 1mm lead and the steps per mm are 3200 (at 16 x micro stepping) but your are set to 320. What are the screws and are they directly driven?

    One thing that leapt out at me about your config.g is that you have acceleration for Y set to 20 but Z is set to 250 so I'd hazzard a guess that these should be swapped around.

  • Dear David,

    You were right. I had wired the motors in parallel and rectified to in series and all working well.
    And for reference, pitch of ball screw for z-axis is 10mm as my printer is so big.

    Thanks so much.

  • @jroh:

    Dear David,

    And for reference, pitch of ball screw for z-axis is 10mm as my printer is so big.

    Thanks so much.

    I hope you don't mind me pointing this out but you are likely to run into other problems in the near future.

    Firstly, by selecting course lead screws, you have actually compounded the problem of the mass you are trying to move. I revolution of your screws will move the bed 10mm but if you had selected 1mm lead screws, then it would take 10 revolutions of the screws to move the same distance. Effectively you have only 1 tenth of the leverage so therefore you need 10 times the torque which is why you need so many motors running at high current. For info, my bed isn't all that much smaller than yours at 400x400 and has 10mm thick aluminium plus 6mm glass and I run it at 10mm/sec with acceleration of 100mm/sec^2 using a single Nema 17 at 1.8 Amps.

    Secondly, one full step of the motors will lead to 0.2mm of movement so any layer height resolution of less than 0.2 mm will require micro-stepping for positional accuracy which isn't likely to work well with the torque requirements.

    Thirdly, along the same lines as above, typically stepper motors have a positional accuracy of +/- 5% so for any given layer height, each motor could be out of position by 0.01mm. This means that, your layer height resolution will vary between 0.19 and 0.21mm. Because you have a motor in each corner then you will have +/- 0.01mm difference at each corner which will twist the bed. Each corner could potentially vary by 0.01mm every time you move the bed so grid based compensation may actually make matters worse if you choose to use it.

    Finally, due to the steep helix angle of those screws, and the fact that you have chosen ball screws which are for applications requiring low friction, you may find that the bed will fall under it's own weight as soon as power is removed from the steppers. This may or may not be an issue though.

    This is meant as helpful advice rather than criticism.

  • Dear Deckingman,

    Much appreciate for your advise. I now fully understand steep helix possibly becomes problem and will be careful next time when choose screw. It's so regretful but no choice but to pray to work well as I already spilt water.


  • @jroh,

    I'm glad that you perceive my post as advice rather than criticism. I understand that you have already spent quite of lot of money on these ball screws so would be reluctant to change them. There are a couple of things you can do.

    As it's a big machine, I guess you intend to print big parts. If that is the case, consider using a large nozzle. Something like 1.0 mm would mean that you could use a layer height of around 0.8mm. This would help to mask the resolution problem.

    Of course, that will mean that you won't be able to print highly detailed parts, so another option would be to use gearing. Something like a 20 tooth pulley on the motor coupled via short belt to an 80 tooth pulley on the screw would help. If you choose try this, just be careful with your selection of pulley sizes and ensure that your chosen layer height can be achieved with multiples of full steps.


  • administrators

    I agree with Ian's points. However, 320 steps/mm @ x16 microstepping is 20 full steps/mm, so any layer height that is a multiple of 0.05mm would be an integral number of full steps. On delta printers we routinely use between 80 and 200 steps/mm @ x16 microstepping, without apparent problems with Z resolution - although there is some averaging going on, which may mitigate the effect of the size of steps being up to 5% out. If you choose a layer height of 0.2mm, that's 4 full steps, and I think it should work quite well. Or use 0.4 or 0.8mm with a larger nozzle.

    If you do need to increase Z resolution and the coarse pitch ballscrews are not causing any other problems (e.g. the bed dropping when you power down), you could consider switching to 0.9deg Z motors if that is significantly less expensive than changing the ballscrews.

  • Dear Mr. Ian and David,

    Firstly Merry X-mas and wish you and your family's much good health next year!

    Thanks for your advises and I'm testing and testing of movement. Luckily It works well without twisting upto max Z-axis and microsteps also works well though needed more test. But unluckily bed drops when power down. So It will be quite hard job watching power always. HAHAHA.

    Let me report further problems if happens.


  • Apologies. David is of course correct. I divided the thread lead of 10mm by 200 steps for 1 revolution and for reason came up with the answer of 0.2mm per step when in fact it is 0.05mm, so resolution should be fine. Sorry to hear that my prediction about the bed dropping when power is removed proved to be true. Maybe you could fit a brake to one or all of the motors? Something along these lines https://www.applied-motion.com/news/2016/10/holding-brakes-nema-23-step-motors

  • Dear Ian,

    Thanks for the suggestion of brake motor. M'time I just realized that you are the person who gave me idea of multiple colour print with Diamond hotend and Duetwifi and I'm now carefully reading your articles on your website with much thanks but something difficult to understand for me as I'm new at multiple colour and python.

    I guess it needed 3 gcode files of ("test.gcode" for source file, "output.gcode" for destination file, "temp.gcode" for temp file) in order to print Julia vase etc. But It's hard for me to divide the code on your articles of your website to 3files above and not sure where to set those 3 files on Slic3r.

    I just guess these 3files save on my desktop and set the path(s) on "Print setting - Output options - Post-processing scripts" but not sure what to put on "Print setting - Output options - Output file - Output filename format".

    I feel it's quite genius idea using script but it's hard for me to setting, so I'd like to ask something about that as follows.

    1. Could you e-mail for those 3 files, or advise divisions of 3 files on your article?
    my e-mail : jroh09@gmail.com

    2. Could you advise correct setting of Slic3r to apply those 3 gcode files?


    Thanks a lot.

  • @jroh,

    You don't need any files from me. To help you understand, I take the original gcode file and modify it on my PC to move the tool change points to a position earlier in the file which corresponds to the amount filament needed to purge the hot end. The work flow is as follows:

    Load the stl files into Slic3R. There will be one for each colour. Then slice the file which will generate a gcode file with the tool changes embedded in it. Then post process that file to move the tool changes.

    You should know that I am not a programmer so the way I do it is just a guide. I chose to use Python as it seemed the easiest for me to learn but I've only taught myself enough to get the job done, and that's mostly from searching the internet.

    I wanted to keep the original gcode file intact so I decided to copy it to another location and rename it "Python test file.gcode". So that's the first file you need - it's just a copy of your original gcode file. When you run the Python script on that file, it generates another gcode file which has the tool changes moved. This file is generated by the Python script and is called "Python output.gcode". That's the second file. Note that every time you run the script, it will create a new "Python output.gcode" file which will overwrite any file with the same name that already exists, so it's best to rename the "Python output.gcode" file to something like your original gcode file name but add "shifted" or something to the name so that you can distinguish it from the original (unshifted) file. The Python temp.gcode file is also generated by the Python script but gets overridden every time the script is run. You don't need worry about it.

    There is an article on my blog which explains what to do with Slic3R.

    Please note that there are a couple of bugs in the script as it exists on my blog and also note that it isn't a perfect technique. I'll maybe do an update on my blog in the new the new year.

    That's all I have time for right now. Merry Xmas and a happy new year to you.

  • @jroh:

    Anything did I mis-set or missed? Should I set volumetric extrude?

    No, don't use volumetric extrusion. SLic3R setting look OK. Do you have a "T" command in the Slic3R start gcode to select the correct tool? Can you also post you config.g, and I'll take a look at that to see if I can spot anything obvious.

    Edit. Strange - the post I was replying too isn't here any more. Has the OP deleted it?

  • @Ian

    Thanks your reply and I just put "T" command in the start gcode asf.
    G0 E8 F100
    G0 E8 F100
    G0 E8 F100
    G0 E8 F100
    G0 E8 F100

    And my config.g is at top of this thread. Frankly say, I was so hard today due to needle was broken inside the diamond nozzle while I was picking up the needle inside the nozzle. It was very difficult to take it off from the nozzle finally succeeded by using magnetic and hexa-rod. But after then, fan was broken and just now waiting for coming fan which I ordered. I will revise a result after setting/testing.

    I just assume the reason that, I did not put "T" command initially or the Geared extruders which I ordered together with Diamond hotend set was not tightened well. I rectified both already but not tested yet.

    Thanks a lot sharing your precious time.

  • Sorry to hear of your problems. What I meant about putting a "T" command in the start code was basically just to make sure that Slic3R had selected the correct tool for the object you want to print. If you don't assign a tool (extruder) to the object then Slic3r will default to not putting a "T" command in the gcode so you can get the situation where you try to extrude with no tool selected.

    I find it's easier to enable skirts in Slic3R (not brim), to purge the hot end at the start, rather than using all those manual extrusion commands.

Log in to reply