Controlling vacuum pump with duet - Gcode sample

  • Hi to all.
    We are testing one big rotary based delta robot. Unfortunately duet is missing FW for rotary based designs but i hope that this will be solved soon. I dont know if this is an "issue" in firmware or just my lack of knowlage in g-code programming but am having some problem when i try to activate the pump. In other words, pump is activated but in some random order and not as it should be in this example.

    G0 Z50
    M42 P60 S255
    G0 Z-50
    M42 P60 S0

    Is this correct approach to move head down, start the pump, move the head up, shutdown the pump ?


  • administrators

    Yes, that's the correct approach. Unless you are using very old firmware, the M42 commands should be executed in sync with the G0 commands. Your pump probably needs some time to start up and stop, so you may need a G4 command to insert a delay between the M42 command and the following G0 command.

  • Hi DC and than you for reply !

    PUMP --> when i run this:
    G00 Z25
    M42 P60 S255
    G00 Z-25

    Pump starts almost immediately but when i add M42 P60 S0 after G0 Z-25 pump wont start at all (or it starts / stops very fast ). I test it with and without G4 command. Btw. robot head is moved up and down correctly, each time.
    Btw.2 --> if necessary, N-FET that am using is IRLR2905Z 55V / 42A, 110W.

    I have read your footer several times 🙂 and i really dont wont to disturb you in your vacation time, but can we hear us per PM. Of course, when you find time.

    Thank you in advance for your support !


  • administrators

    Which firmware version are you running? Also:

    • The G4 command takes a parameter to say how long you want to delay for. See the GCode wiki page for details.
    • If you don't have movement working yet then your G1 commands may be failing immediately with an error message; in which case they will execute very quickly, giving no time for the pump to start.

  • FW:
    FIRMWARE_NAME: RepRapFirmware for Duet 2 WiFi/Ethernet FIRMWARE_VERSION: 1.21 ELECTRONICS: Duet Ethernet 1.02 or later FIRMWARE_DATE: 2018-03-21

    G4 command:

    • this worked like a charm !

    When i run this pump is activated and shut down:
    G0 Z30
    G4 P300
    M42 P60 S255
    G0 Z-15
    G4 P200
    M42 P60 S0
    Result ( turn on the sound ) :>&s=9

    I noticed that the robot is shaking more then before, can this be also corrected in software ?
    One strange thing ( for me at least ) is that when i run script several times in row ( like in video ), position of the robot isnt always the same ( hight and movement on X , Y direction ). I was thinking that after homing position position of the robot will be reseted on start position ? Btw. my knowledge of G-Code is equal to zero, so maybe am missing something.

    If you don't have movement working yet then your G1 commands...
    *** I am not sure what you mean under movement but if this has to do with rotary delta design, then i must inform you that till now we didnt write any firmware for this part.
    This is main reason why i want to talk to you ( it considers this and future projects).

    Regards !

  • administrators

    Perhaps you have the speed or acceleration set too high so that your motors are missing steps?

    I don't run Flash player for security reasons, so I can't view your video.

  • Flash -- > OK i understand.
    I would upload it here but it looks like i can not upload movies so i put it on It's free and secure site ( just click on slow download ).

    Btw. how can i loop this gcode commands so that the robot can continuously move up / down.
    Just for test purposes...

    I made some additional tests meanwhile, but it look i have some problems in setup.
    Just one question before i explain in detail...

    As you know, am using linear delta FW at the moment but i have rotary delta design.
    How does your FW "understands " if i send linear or rotary data ? E.g.

    • if i send x50 ( as linear delta) this would be equal to X38 in rotary ?

    In other words if i enter X38 robot should move 5 cm on X position, is this correct ?
    Am asking this because if i run this command:
    G28 X0 Y0
    G1 X38

    Robot is moving up / down and in multiple directions at the same time 🙂
    I can not move it lineary from some point X to some other point, on the same axes.

    Regards !

  • UPDATE to last post.
    I spend whole day testing your suggestion ( reducing acceleration ) and you ware wright ! Now i noticed few problems but the speed is main one.

    updated video of robot moving on X axe :

    This is the code that am using:
    G00 X35
    G4 P100
    G00 Z0
    ;G4 P50
    G00 X0
    ;G4 P50

    G00 X-35
    G4 P100
    G00 Z0
    ;G4 P50
    G00 X0
    ;G4 P50

    --> i have tested bunch of options and it looks like that this is the maximum speed that i can get before robot starts to "loose himself".
    --> i hope that this can be tweaked somehow because if this can not go faster than i must change the motors and add external drivers
    --> i noticed that robot starts to loose himself when head is near or over maximum radius and sometimes it looks that it has not enough power.
    --> speaking of that, could it be that the speed of the robot is reduced just because of lacking some stronger external power supply ?
    --> or maybe this could be because am using rotary delta and the firmware is for linear setup ?

    Btw. weight of arms and head is 100 grams, so this can not be a problem regarding speed....


  • administrators

    Looks good! What motors are you using, and what currents have you set in the M906 command in config.g? Do you have any gearing between the motor shafts and the arms?

    The upper arms are very much shorter than the lower arms. While this will increase the speed of effector movement in the XY plane, it will require more torque from the motors. You might wish to lengthen the upper arms or shorten the lower arms, so that less motor torque is required. I'm not an expert on rotary deltas, but I think this would be roughly equivalent to adding some reduction gearing between the motor shafts and the upper arms.

    EDIT: what I am basically saying is that what your machine does currently is equivalent to trying to set off in your car when it is in 4th or 5th gear. You are demanding high torque from your stepper motors, but you are only using a tiny fraction of their speed range. So you need to make changes to your mechanics so that the motors move much further for the same effector movement. That in turn will reduce the amount of torque needed.

  • Motor : 23HS8630 ( 1,8 degrees, 3A )
    M906 : 2.1 A
    I have set 2.2 but warnings started to jump in web GUI so i lower it down.


    • 10:1 gear system will be ready next week.

    I noticed something that i dont understand at all :-).
    G90 ; Send absolute coordinates...
    M83 ; ...but relative extruder moves
    M555 P1 ; Set firmware compatibility to look like RepRapFirmare
    M665 R500 L1000 B600 H0 ; Set delta radius, diagonal rod length, printable radius and homed height
    M666 X0 Y0 Z10 ; Put your endstop adjustments here, or let auto calibration find them
    ; Drives
    M569 P0 S1 ; Drive 0 goes forwards
    M569 P1 S1 ; Drive 1 goes forwards
    M569 P2 S1 ; Drive 2 goes forwards
    M569 P3 S1 ; Drive 3 goes forwards
    M350 X32 Y32 Z32 I0 ; Configure microstepping without interpolation
    M350 E32 I1 ; Configure microstepping with interpolation
    M92 X16 Y16 Z16 E663 ; Set steps per mm // DEF 80
    M566 X2500 Y2500 Z2500 E ; Set maximum instantaneous speed changes (mm/min) // DEF = 1200
    M203 X14000 Y14000 Z14000 E0 ; Set maximum speeds (mm/min) // DEF == 18000
    M201 X100 Y100 Z100 E0 ; Set accelerations (mm/s^2) // DEF == 1000
    M906 X2100 Y2100 Z2100 E800 I30 ; Set motor currents (mA) and motor idle factor in per cent
    M84 S15 ; Set idle timeout

    1.) the" X " arm is faced to us so imho, head of the robot should move towards us, but it's moving "diagonal".
    In other words, when i enter X35 should head not be moved toward us ?

    1b.) it looks like that after idle time and after extruder "drops down" the system enters some uncalibrated state and after homing with G28, extruder head lands on different position. Not every time but it's in random order.
    When i print again after that, movement is wrong. Basically it looks like he starts from new homing position.

    2.) There are some problems with Z axes setup. Sometimes it does not respond ( when i home it and run it from machine control menu). There is no way to lift the arms let's say, each 2 seconds for 5 cm...
    When i clikc Z+1 head is lifted but when i click again, head is lowered down.

    3.) As test i'm trying to draw a square like :
    G00 X15
    G4 p500
    G00 Y15
    G4 P500
    ;G00 Z2
    G4 p500
    G00 X-15
    G4 p500
    G00 Y-15
    G4 p500
    Extruder draws x line, and it starts to draw the Y line but in the process, it lowers the extruder's head down.
    When i add the Z part, robot starts to move uncontrolled ...

    Maybe this could be also gearing problem ?
    Regards !


  • administrators

    The 10:1 gearing should help a lot. When using motor currents of 2.0A or higher, use a fan to blow cool air across both sides of the Duet along the line of drivers.

  • Gearing:
    --> OK ! Great.

    --> i will add two of those

    Vacuum pump:
    --> tell me, is the car vacuum pump adequate for long time work and such setup ?
    --> as you know robot should work 24/7 and pump that am using now is volvo car pump
    UP28 ....

    Its powered from PC PSU 12v / 10A and it looks like it draws a lot because 2A PSU was not enough for normal work....