Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    Hobbyservo controlled part cooling fan (compressor+valve)

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    5
    26
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Visionaryundefined
      Visionary
      last edited by

      I have a small compressor meant for aqvariums which I want to use as part cooling fan. The problem is that the compressor is always on type AC-powered compressor, which can't be directly wired to anything on Duet to achieve 0-100% air blowing. I was thinking of using hobbyservo to adjust flow with a valve. Is this posibble (and easy to do)?

      My printer uses 6HC-main board.
      IMG20221108192458.jpg

      Main printer: 3-5 Axis, 400x400x450 Duet 6HC || https://grabcad.com/eetu-4/models

      o_lampeundefined 1 Reply Last reply Reply Quote 0
      • o_lampeundefined
        o_lampe @Visionary
        last edited by o_lampe

        @Visionary I'm afraid, there is no easy way.
        My roadmap, if I wanted to do this:

        • check slicer for post processing abilities
        • rename M106 commands to M106.1 (using search&replace in a text editor, if slicer can't do it)
        • write macro M106.1 which calculates fan values to servo angles

        The outcome won't be linear, unless you calculate angles and both armlengths.
        If it's a ball-valve you have even more fun calculating.

        If you only want on/off function, you're better of with a magnetic switch valve.

        Visionaryundefined 1 Reply Last reply Reply Quote 1
        • Visionaryundefined
          Visionary @o_lampe
          last edited by

          @o_lampe

          Using text editor or simple post processor seems good option though it adds some extra work if it has to be done everytime seperately. I think I can write a program that does that aswell.

          Linearity of air flow likely won't be that important because I usually use the same fan values for the entire print (and all same material prints). One option for valve is just to have two elastic tubing and pinch each of them accordingly with servo to achieve desired flow. Many off the shelf ball valves tend to be quite stiff but they probably would work great too.

          Main printer: 3-5 Axis, 400x400x450 Duet 6HC || https://grabcad.com/eetu-4/models

          o_lampeundefined 1 Reply Last reply Reply Quote 1
          • o_lampeundefined
            o_lampe @Visionary
            last edited by

            @Visionary I like the pragmatic approach of pinching the tube!
            *writes mental note

            1 Reply Last reply Reply Quote 0
            • Visionaryundefined
              Visionary
              last edited by

              IMG20221217120051.jpg

              I made servo+ball valve, but I can't get it to work. The wire colors on the servo are not the same as on its product page, so I'm only assuming that red is +, black is GND and white is PWM. I tried sending M280 P0 S80 with different values but nothing happens. I also could use some advice on how to use SSR to switch compressor on and off by sending G-code.

              ; Configuration file for Duet 3 MB 6HC (firmware version 3.3)
              ; executed by the firmware on start-up
              ;
              ; generated by RepRapFirmware Configuration Tool v3.3.15 on Tue Dec 20 2022 09:34:36 GMT+0200 (Itä-Euroopan normaaliaika)
              
              ; General preferences
              M575 P1 S1 B57600                            ; enable support for PanelDue
              G90                                          ; send absolute coordinates...
              M83                                          ; ...but relative extruder moves
              M550 P"My Printer"                           ; set printer name
              M669 K1                                      ; select CoreXY mode
              
              ; Network
              M551 P""                                ; set password
              M552 P0.0.0.0 S1                             ; enable network and acquire dynamic address via DHCP
              M586 P0 S1                                   ; enable HTTP
              M586 P1 S0                                   ; disable FTP
              M586 P2 S0                                   ; disable Telnet
              
              ; Drives
              M569 P0.0 S0                                 ; physical drive 0.0 goes
              M569 P0.1 S0                                 ; physical drive 0.1 goes 
              M569 P0.2 S0                                 	; Z1 motor (Left from user on printer)
              M569 P0.3 S1									; Z2 motor (back motor)
              M569 P0.4 S0									; Z3 motor (right from user on printer)
              M569 P0.5 S1                                 ; physical drive 0.5 goes forwards
              M584 X0.1 Y0.0 Z0.2:0.3:0.4 E0.5                     ; set drive mapping
              M350 X16 Y16 Z16 E16 I1                      ; configure microstepping with interpolation
              M92 X80.00 Y80.00 Z640.00 E420.00            ; set steps per mm
              M566 X700.00 Y700.00 Z60.00 E120.00          ; set maximum instantaneous speed changes (mm/min)
              M203 X9000.00 Y9000.00 Z1000.00 E1800.00      ; set maximum speeds (mm/min)
              M201 X1800.00 Y1800.00 Z20.00 E250.00          ; set accelerations (mm/s^2)
              M906 X1000 Y1000 Z1200:2600:1200 E800 I30               ; 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 X400 Y400 Z400 S0                       ; set axis maxima
              
              ; Endstops
              M574 X1 S1 P"io1.in"                        ; low end
              M574 Y1 S1 P"io2.in"                        ; low end
              M574 Z2 S1 P"io3.in+io4.in+io5.in"                        ; Z1, Z2, Z3 High end, Three ball scews
              
              
              M671 X-80.0:200.0:480.0 Y400.0:-40.0:400.0 ; Z leadscrews are at (-80,400), (200,-40) and (480,400)
              
              
              ; Z-Probe
              M558 P0 H5 F120 T6000                        ; disable Z probe but set dive height, probe speed and travel speed
              M557 X15:215 Y15:195 S20                     ; define mesh grid
              
              ; Heaters
              ; BED
              M308 S0 P"temp1" Y"thermistor" T100000 B3974 ; configure sensor 0 as thermistor on pin temp1
              M950 H0 C"out3" T0                           ; create bed heater output on out3 and map it to sensor 0
              M307 H0 B1 S1.00                             ; enable bang-bang mode for the bed heater and set PWM limit
              M140 H0                                      ; map heated bed to heater 0
              M143 H0 S120                                 ; set temperature limit for heater 0 to 120C
              ; HOTEND
              M308 S1 P"temp0" Y"pt1000" 
              ;M308 S1 P"temp0" Y"thermistor" T100000 B4725 C7.06e-8 ; configure sensor 1 as thermistor on pin temp0
              M950 H1 C"out1" T1                           ; create nozzle heater output on out1 and map it to sensor 1
              M307 H1 B0 S1.00                             ; disable bang-bang mode for heater  and set PWM limit
              M143 H1 S320                                 ; set temperature limit for heater 1 to 320C
              
              ; Fans
              M950 F0 C"out9" Q500                         ; create fan 0 on pin out9 and set its frequency
              M106 P0 S0 H-1                               ; set fan 0 value. Thermostatic control is turned off
              M950 F1 C"out8" Q500                         ; create fan 1 on pin out8 and set its frequency
              M106 P1 S1 H-1                               ; set fan 1 value. Thermostatic control is turned off
              
              ; Tools
              M563 P0 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 are not defined
              
              M950 S1 C"out7" 	; assign GPIO port 1 to out9 (Servo header), servo mode
              M280 P0 S80		; Move servo with
              

              Main printer: 3-5 Axis, 400x400x450 Duet 6HC || https://grabcad.com/eetu-4/models

              OwenDundefined o_lampeundefined 2 Replies Last reply Reply Quote 0
              • OwenDundefined
                OwenD @Visionary
                last edited by

                @Visionary said in Hobbyservo controlled part cooling fan (compressor+valve):

                M950 S1 C"out7" ; assign GPIO port 1 to out9 (Servo header), servo mode
                M280 P0 S80 ; Move servo with

                Try

                M950 S1 C"out7" 	; assign GPIO port 1 to out9 (Servo header), servo mode
                M280 P1 S80		; Move servo with
                
                Visionaryundefined 1 Reply Last reply Reply Quote 1
                • o_lampeundefined
                  o_lampe @Visionary
                  last edited by

                  @Visionary
                  Just in case you didn't know:
                  The servo is pretty big. You can't use the 5V onboard regulator for this monster.
                  I use such a servo with a separate 5 cell NiMH battery. Just make sure the negative connection goes to servo and Duetboard.

                  Visionaryundefined 1 Reply Last reply Reply Quote 0
                  • Visionaryundefined
                    Visionary @OwenD
                    last edited by

                    @OwenD said in Hobbyservo controlled part cooling fan (compressor+valve):

                    @Visionary said in Hobbyservo controlled part cooling fan (compressor+valve):

                    M950 S1 C"out7" ; assign GPIO port 1 to out9 (Servo header), servo mode
                    M280 P0 S80 ; Move servo with

                    Try

                    M950 S1 C"out7" 	; assign GPIO port 1 to out9 (Servo header), servo mode
                    M280 P1 S80		; Move servo with
                    

                    I tried this, but it didn't work

                    Main printer: 3-5 Axis, 400x400x450 Duet 6HC || https://grabcad.com/eetu-4/models

                    1 Reply Last reply Reply Quote 0
                    • Visionaryundefined
                      Visionary @o_lampe
                      last edited by Visionary

                      @o_lampe
                      I have seperate 5V PSU (DC-DC converter). Does it have to be connected to negative of Duet? If so can I use power in negative on 6HC board?

                      Main printer: 3-5 Axis, 400x400x450 Duet 6HC || https://grabcad.com/eetu-4/models

                      achrnundefined 1 Reply Last reply Reply Quote 0
                      • achrnundefined
                        achrn @Visionary
                        last edited by

                        @Visionary Yes - if you have multiple power supplies they need the 0V (negative) all at the same level, so must be connected together somewhere.

                        Visionaryundefined 1 Reply Last reply Reply Quote 0
                        • Visionaryundefined
                          Visionary @achrn
                          last edited by

                          @achrn
                          I still can't get it to work. btw what I meant by 5V PSU it is actually DC-DC converter.

                          Main printer: 3-5 Axis, 400x400x450 Duet 6HC || https://grabcad.com/eetu-4/models

                          o_lampeundefined 1 Reply Last reply Reply Quote 0
                          • o_lampeundefined
                            o_lampe @Visionary
                            last edited by

                            @Visionary
                            DC-DC shouldn't work, if it's strong enough. Those digital servos are power hungry, they can consume 2A or more when blocked.
                            Does the Duet board supply 3.3V or 5V level on the servo PWM port?

                            Visionaryundefined 1 Reply Last reply Reply Quote 0
                            • Visionaryundefined
                              Visionary @o_lampe
                              last edited by

                              @o_lampe

                              The converter can supply 5A and is rated at 25W. From what I read on documentation Duet ports probably cannot supply enough amps safely to this large servo.

                              Main printer: 3-5 Axis, 400x400x450 Duet 6HC || https://grabcad.com/eetu-4/models

                              achrnundefined droftartsundefined 2 Replies Last reply Reply Quote 0
                              • achrnundefined
                                achrn @Visionary
                                last edited by

                                @Visionary Servos can demand lots of current, so it's best to have a seperate supply, yes (though actually I use one without, but it does have a hefty capacitor across the supply). If it's DC-DC convertor they normally have the input and output -ve connected together internally, so that shouldn't be a problem.

                                My configuration is:

                                ; Servo
                                ; servo 1 on io7.out (note, needs to be 4, 5 or 7 as these are only PWM capable outputs)
                                M950 S1 C"io7.out"                            ; create servo 1
                                M280 P1 S10                                   ; set to 10 degree position, which is blades closed
                                

                                I have the servo on one of the io connectors, and it seems happy getting 3.3V signals, but there's no guarantee any other servo will respnd to 3.3V.

                                I note that your config is repeatedly referring to 'out7' but the comment says out9 - where do you actually have the servo connected?

                                Have you checked the servo itself is happy on a 5V supply? You can use something like this: https://www.ebay.co.uk/itm/133527343417 (but I'm not endorsing that seller - that's just the first hit I got on ebay). This will confirm the servo is happy with the voltage and with 'ordinary' PWM signals (I'd specifically buy a cheap basic tester, so you know it's doing ordinary cheap basic signals to the servo).

                                Visionaryundefined 1 Reply Last reply Reply Quote 0
                                • droftartsundefined
                                  droftarts administrators @Visionary
                                  last edited by droftarts

                                  @Visionary as @achrn says, for 5V PWM on a 6HC, you should connect the servo to the LASER/VFD pin, and configure for io9. See https://docs.duet3d.com/en/User_manual/Connecting_hardware/Motors_servos

                                  Ian

                                  Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                                  1 Reply Last reply Reply Quote 0
                                  • Visionaryundefined
                                    Visionary @achrn
                                    last edited by Visionary

                                    @achrn

                                    I initially copied code for the servo from documentation and the comment is from there. The servo is connected to correct pin on the board. I tested another servo (ms-1.3-9) and it didn't work either. I'm assuming that with servo (MS-1.3-9) brown is negative, Red is positive and orange is PWM. Both servos should be able to handle 5V PWM.

                                    I then switched to using 5V PWM pin "out9" on 6HC and that didnt work either.

                                    The commands I'm sending to test the servo are:

                                    • M280 P1 S0
                                    • M280 P1 S35

                                    Main printer: 3-5 Axis, 400x400x450 Duet 6HC || https://grabcad.com/eetu-4/models

                                    achrnundefined droftartsundefined 2 Replies Last reply Reply Quote 0
                                    • achrnundefined
                                      achrn @Visionary
                                      last edited by

                                      @Visionary said in Hobbyservo controlled part cooling fan (compressor+valve):

                                      @achrn

                                      I initially copied code for the servo from documentation and the comment is from there. The servo is connected to correct pin on the board. I tested another servo (ms-1.3-9) and it didn't work either. I'm assuming that with servo (MS-1.3-9) brown is negative, Red is positive and orange is PWM. Both servos should be able to handle 5V PWM.

                                      Sorry, for avoidance of confusion, can you explicitly set out again what servo wires are connected where on the board and what is in the config.g.

                                      Basically, when you say 'is connected to correct pin on the board' I don't know what that means in the context of someone saying it should be connected to the LASER/VFD pin, but the config.g referring to 'out7' - does that mean you've connected to out7 (which would be correct for the stated config, but wrong electrically, probably) or does it mean you've connected to the LASER pin (which would be correct electrically, but wrong for the stated config).

                                      I also note that according to the posted config.g you've got fan 0 out out9. You can't have both a fan and a servo on that output.

                                      1 Reply Last reply Reply Quote 0
                                      • droftartsundefined
                                        droftarts administrators @Visionary
                                        last edited by

                                        @Visionary also, send

                                        M98 P”config.g”
                                        

                                        And see if reports any errors.

                                        Ian

                                        Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                                        Visionaryundefined 1 Reply Last reply Reply Quote 0
                                        • Visionaryundefined
                                          Visionary @droftarts
                                          last edited by Visionary

                                          @droftarts said in Hobbyservo controlled part cooling fan (compressor+valve):

                                          @Visionary also, send

                                          M98 P”config.g”
                                          

                                          And see if reports any errors.

                                          Ian

                                          This gives message : "Warning: Macro file ”config.g” not found"

                                          @achrn

                                          I switched to attempting to get working the smaller (MS-1.3-9) servo.
                                          I've connected it following way on 6HC:

                                          • Orange wire || Out9 (5V PWM)
                                          • Red wire || +5V (external DC-DC converter)
                                          • Brown wire || GND (external DC-DC converter, which is not directly connected atm to main 24V PSU GND)

                                          I've also noticed that at start up the servo moves (after I removed fan assigments), but I still can't move it with G-code commands like M280 P5 S50. Instead the servo makes noise that indicates its trying to hold its position. The servo also makes random twiches and overheats the servo.

                                          Note that I tried to switch number of the (P1) servo to different one (P5).

                                          Current config:

                                          ; Configuration file for Duet 3 MB 6HC (firmware version 3.3)
                                          ; executed by the firmware on start-up
                                          ;
                                          ; generated by RepRapFirmware Configuration Tool v3.3.15 on Tue Dec 20 2022 09:34:36 GMT+0200 (Itä-Euroopan normaaliaika)
                                          
                                          ; General preferences
                                          M575 P1 S1 B57600                            ; enable support for PanelDue
                                          G90                                          ; send absolute coordinates...
                                          M83                                          ; ...but relative extruder moves
                                          M550 P"My Printer"                           ; set printer name
                                          M669 K1                                      ; select CoreXY mode
                                          
                                          ; Network
                                          M551 P""                                ; set password. This is redacted.
                                          M552 P0.0.0.0 S1                             ; enable network and acquire dynamic address via DHCP
                                          M586 P0 S1                                   ; enable HTTP
                                          M586 P1 S0                                   ; disable FTP
                                          M586 P2 S0                                   ; disable Telnet
                                          
                                          ; Drives
                                          M569 P0.0 S0                                 ; physical drive 0.0 goes
                                          M569 P0.1 S0                                 ; physical drive 0.1 goes 
                                          M569 P0.2 S0                                 	; Z1 motor (Left from user on printer)
                                          M569 P0.3 S1									; Z2 motor (back motor)
                                          M569 P0.4 S0									; Z3 motor (right from user on printer)
                                          M569 P0.5 S1                                 ; physical drive 0.5 goes forwards
                                          M584 X0.1 Y0.0 Z0.2:0.3:0.4 E0.5                     ; set drive mapping
                                          M350 X16 Y16 Z16 E16 I1                      ; configure microstepping with interpolation
                                          M92 X80.00 Y80.00 Z640.00 E420.00            ; set steps per mm
                                          M566 X700.00 Y700.00 Z60.00 E120.00          ; set maximum instantaneous speed changes (mm/min)
                                          M203 X9000.00 Y9000.00 Z600.00 E1800.00      ; set maximum speeds (mm/min)
                                          M201 X1800.00 Y1800.00 Z30.00 E250.00          ; set accelerations (mm/s^2)
                                          M906 X1000 Y1000 Z1200:2600:1200 E800 I30               ; set motor currents (mA) and motor idle factor in per cent
                                          M84 S30                                      ; Set idle timeout
                                          
                                          ; Axis Limits
                                          M208 X-25.8 Y-10 Z0 S1                             ; set axis minima
                                          M208 X400 Y400 Z490 S0                       ; set axis maxima
                                          
                                          ; Endstops
                                          M574 X1 S1 P"io1.in"                        ; low end
                                          M574 Y1 S1 P"io2.in"                        ; low end
                                          M574 Z2 S1 P"io3.in+io4.in+io5.in"                        ; Z1, Z2, Z3 High end, Three ball scews
                                          
                                          
                                          M671 X-80.0:200.0:480.0 Y400.0:-40.0:400.0 ; Z leadscrews are at (-80,400), (200,-40) and (480,400)
                                          
                                          
                                          ; Z-Probe
                                          M558 P0 H5 F120 T6000                        ; disable Z probe but set dive height, probe speed and travel speed
                                          M557 X50:350 Y50:350 S300                     ; define mesh grid
                                          
                                          ; Heaters
                                          ; BED
                                          M308 S0 P"temp1" Y"thermistor" T100000 B3974 ; configure sensor 0 as thermistor on pin temp1
                                          M950 H0 C"out3" T0                           ; create bed heater output on out3 and map it to sensor 0
                                          M307 H0 B1 R0.25 S1.00                             ; enable bang-bang mode for the bed heater and set PWM limit
                                          M140 H0                                      ; map heated bed to heater 0
                                          M143 H0 S120                                 ; set temperature limit for heater 0 to 120C
                                          ; HOTEND
                                          M308 S1 P"temp0" Y"pt1000" 
                                          ;M308 S1 P"temp0" Y"thermistor" T100000 B4725 C7.06e-8 ; configure sensor 1 as thermistor on pin temp0
                                          M950 H1 C"out1" T1                           ; create nozzle heater output on out1 and map it to sensor 1
                                          M307 H1 B0 S1.00                             ; disable bang-bang mode for heater  and set PWM limit
                                          M143 H1 S320                                 ; set temperature limit for heater 1 to 320C
                                          
                                          ; Fans
                                          ;M950 F0 C"out9" Q500                         ; create fan 0 on pin out9 and set its frequency
                                          ;M106 P0 S0 H-1                               ; set fan 0 value. Thermostatic control is turned off
                                          ;M950 F1 C"out8" Q500                         ; create fan 1 on pin out8 and set its frequency
                                          ;M106 P1 S1 H-1                               ; set fan 1 value. Thermostatic control is turned off
                                          
                                          ; Tools
                                          M563 P0 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
                                          
                                          ;Accelerometer
                                          M955 P0 I56 C"spi.cs3+spi.cs2"	
                                          
                                          ; Servo for compressor fan valve
                                          M950 S5 C"out9" 	; assign GPIO port 1 to out9 (Servo header), servo mode
                                          M280 P5 S30			; Move servo with
                                          
                                          ; Compressor 
                                          M950 P2 C"out2" Q0								 ; Compressor ON/OFF SSR
                                          
                                          
                                          
                                          
                                          

                                          Main printer: 3-5 Axis, 400x400x450 Duet 6HC || https://grabcad.com/eetu-4/models

                                          droftartsundefined achrnundefined 2 Replies Last reply Reply Quote 0
                                          • droftartsundefined
                                            droftarts administrators @Visionary
                                            last edited by

                                            @Visionary try

                                            M98 P”/sys/config.g”
                                            

                                            Regarding the M280 S parameter, see this note in the Gcode dictionary for M280: https://docs.duet3d.com/en/User_manual/Reference/Gcodes#m280-set-servo-position

                                            Almost all servos accept a pulse width range of at least 1us to 2us, which corresponds to an S parameter range of 44.2 to 141.2 degrees. So for many servos, values in the range 44.2 to 141.2 or alternatively 1000 to 2000 will cover the full operating range of the servo.

                                            It could be your initial S30 is causing problems. Try higher values in the range suggested above.

                                            Ian

                                            Bed-slinger - Mini5+ WiFi/1LC | RRP Fisher v1 - D2 WiFi | Polargraph - D2 WiFi | TronXY X5S - 6HC/Roto | CNC router - 6HC | Tractus3D T1250 - D2 Eth

                                            Visionaryundefined 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA