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

    Duet 2: Trying to output PWM on heater pin

    Scheduled Pinned Locked Moved
    General Discussion
    3
    11
    553
    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.
    • ara1123undefined
      ara1123
      last edited by

      Hi everyone,

      I want to output a PWM on the "E0 Heater" pin, but I can't seem to get it to work, heres what I've been trying:

      M307 H1 A-1 C-1 D-1 (disable heater)
      M571 P1 F500 S1 (500hz PWM to heater pin, as I understand)

      I'm new to Duet3D so I expect that I'm missing some simple information or misunderstanding something. I'm using the Duet 2 wifi board w/ firmware 2.03 and I'm trying to use the Web Controller for this, can someone tell me what I'm doing wrong or point me in the right direction?

      1 Reply Last reply Reply Quote 0
      • Phaedruxundefined
        Phaedrux Moderator
        last edited by

        What are you trying to control?

        2.03 is nearly 2 years old. Perhaps a good time to update to RRF3? It's much easier to use pins in different ways in V3 firmware. It's much more generalized.

        If you still have access to DWC. Upload these 3 zip files, one at a time in the system tab. Don't extract them. Reboot after each. Use M115 to verify the firmware has been applied.
        https://github.com/Duet3D/RepRapFirmware/releases/download/2.05.1/Duet2Firmware-2.05.1.zip
        https://github.com/Duet3D/RepRapFirmware/releases/download/3.0/Duet2and3Firmware-3.0.zip
        https://github.com/Duet3D/RepRapFirmware/releases/download/3.2.2/Duet2and3Firmware-3.2.2.zip
        That will get your firmware and DWC up to date.

        You can see the change logs here:
        https://github.com/Duet3D/RepRapFirmware/wiki/Changelog-RRF-3.x

        For your config, might be a good idea to run through the configurator tool and generate a fresh set for RRF3.
        https://configtool.reprapfirmware.org/Start

        Backup your existing config files in the sys folder in case you want to switch back to RRF3. IT’s easy to switch back and forth, just upload the zip file for the version you want and then upload your config files.

        These documents will come in handy during the conversion.
        https://duet3d.dozuki.com/Wiki/RepRapFirmware_3_overview
        https://duet3d.dozuki.com/Wiki/Gcode

        Z-Bot CoreXY Build | Thingiverse Profile

        1 Reply Last reply Reply Quote 0
        • ara1123undefined
          ara1123
          last edited by

          I have a DC motor that I am using as an extruder (for a concrete 3d printer), I wanted to control the speed of the motor by adjusting the voltage coming out of the battery, using a solid state relay. The PWM would just toggle the relay.

          This is an inherited project so the previous team already had a bunch of stuff setup, and I didn't want to change anything because as it stands everything but the PWM works. I didn't realize the firmware was so old though, I will update it + update config later today

          Is the firmware being finnicky the issue?

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

            @ara1123
            Using a SSR with PWM is unusual to say the least.
            I always heard to use bang-bang mode for SSR driven heaters. But that's not an option for a DC motor.
            I don't know the motor data, but if possible consider to use a hobby-RC motorcontroller.
            BTW: There is no need to repurpose the heater channel, just for sending a PWM signal. Any PWM capable pin (fan or external GPIO) will do.
            The only exception would be, when the SSR requires a 12V or 24V enable signal. Then you can use the fan headers but no GPIO pins.

            1 Reply Last reply Reply Quote 0
            • Phaedruxundefined
              Phaedrux Moderator
              last edited by

              In that case maybe hold off on updating the firmware, or at least ensure you have everything backed up first. You'll want to be very familiar with any customizations made before attempting to update the firmware for RRF3.

              Using PWM and an SSR shouldn't be a problem. It's used for bed heaters all the time.

              Are you sure you've identified the correct logical pin number you wish to use? P1?

              https://duet3d.dozuki.com/Wiki/Using_servos_and_controlling_unused_IO_pins#Section_RepRapFirmware_2_x_and_earlier

              https://duet3d.dozuki.com/Wiki/Gcode#Section_M571_Set_output_on_extrude

              Also check your config-override.g file for any M307 H1 commands that may undo your disable command.

              Z-Bot CoreXY Build | Thingiverse Profile

              1 Reply Last reply Reply Quote 0
              • ara1123undefined
                ara1123
                last edited by

                I will look into hobby-RC motorcontrollers, I didn't want to overcomplicate the system by introducing another major component but if this doesn't pan out then I will have to

                Also, yea there are several customizations specific to our printer- the config file is fairly short and doesn't have any M307 commands or any commands relating to heater/fan functions. I've been putting in those commands in the console and I have it wired up to a little LED on a breadboard with some resistors just to verify functionality.

                What's weird is that both the VIN and PWM pin on the E0 screw terminals are reading 24V? No matter what command I send to P1, there isnt any change coming out of those terminals.

                1 Reply Last reply Reply Quote 0
                • Phaedruxundefined
                  Phaedrux Moderator
                  last edited by

                  To be of much more help I'd need to see the config.g and a diagram or photo of how you have it wired.

                  Z-Bot CoreXY Build | Thingiverse Profile

                  1 Reply Last reply Reply Quote 0
                  • ara1123undefined
                    ara1123
                    last edited by

                    Of course- I'll attach an image and the config is below. Three 100ohm resistors in series with the LED, we originally tried PWM pin and ground but nothing was happening, so our current wiring is going into both E0 terminals:duet_wiring_test.jpg

                    ; Configuration file for Duet WiFi (firmware version 2.03)
                    ; executed by the firmware on start-up
                    ;
                    ; generated by RepRapFirmware Configuration Tool v2.1.8 on Sun Jan 19 2020 10:21:10 GMT-0500 (Eastern Standard Time)

                    ; General preferences
                    G90 ; send absolute coordinates...
                    M83 ; ...but relative extruder moves
                    M550 P"My Printer" ; set printer name

                    ; Network
                    ;M551 P"MSDP21652" ; set password
                    ;M552 S1 ; enable network
                    ;M586 P0 S1 ; enable HTTP
                    ;M586 P1 S0 ; disable FTP
                    ;M586 P2 S0 ; disable Telnet
                    M552 S0 ; Turn network on
                    M552 S-1
                    M589 S"P21652" P"MSDP21652" I192.168.1.1
                    M552 S2

                    ; Drives
                    M569 P0 S1 ; physical drive 0 goes forwards
                    ; When Geared Nema17 is on X axis need to change direction
                    ;M569 P0 S0
                    M569 P1 S0 ; physical drive 1 goes forwards
                    M569 P2 S1 ; physical drive 2 goes forwards
                    M569 P3 S0 ; physical drive 3 goes forwards
                    M584 X0 Y1:3 U1 V3 Z2 E4 ; set drive mapping
                    M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation
                    ;M350 X2 Y16 Z16 E16 I1 ; configure microstepping with interpolation GEARED NEMA17
                    M92 X645.00 Y645.00 Z4000.00 E420.00 ; set steps per mm NOTE: This is specifically calibrated for the NEMA 17 ungeared.
                    ;M92 X256.00 Y420.00 Z4000.00 E420.00 ; set steps per mm NOTE: This is specifically calibrated for the NEMA 17 geared.
                    M566 X450.00 Y450.00 Z12.00 E120.00 ; set maximum instantaneous speed changes (mm/min)
                    M203 X10000.00 Y3000.00 Z180.00 E3001.00 ; set maximum speeds (mm/min)
                    M201 X500.00 Y500.00 Z20.00 E150.00 ; set accelerations (mm/s^2)
                    M906 X1800 Y2000 Z800 E2400 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 X900 Y10000 Z10000 S0 ; set axis maxima

                    ; Endstops
                    M574 X1 Y0 Z0 S0 ; set active low and disabled endstops

                    ; 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
                    ; M140 H-1 ; disable heated bed

                    ; Fans

                    ; Tools
                    M563 P0 D0 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

                    ; Miscellaneous
                    T0 ; select first tool

                    1 Reply Last reply Reply Quote 0
                    • Phaedruxundefined
                      Phaedrux Moderator
                      last edited by Phaedrux

                      @ara1123 said in Duet 2: Trying to output PWM on heater pin:

                      M307 H1 A-1 C-1 D-1 (disable heater)
                      M571 P1 F500 S1 (500hz PWM to heater pin, as I understand)

                      I assume this is being sent outside of the config.g?

                      How are you executing the extrusion move?

                      And you're trying to use logical pin 1, but are wired to E0.

                      Did you consult the table here?
                      https://duet3d.dozuki.com/Wiki/Using_servos_and_controlling_unused_IO_pins#Section_RepRapFirmware_2_x_and_earlier

                      Z-Bot CoreXY Build | Thingiverse Profile

                      1 Reply Last reply Reply Quote 0
                      • ara1123undefined
                        ara1123
                        last edited by

                        Yes, those commands are sent outside of it. As for pin 1, I thought E0_heater = Heater 1 = Pin 1 based on the link you sent and this one: https://duet3d.dozuki.com/Wiki/Heaters

                        I finally realized that M571 required an extrusion move in order to work, I feel really dumb for not realizing that sooner but it is what it is. I am using the extrude/retract feature on DWC for that and I finally got the LED to blink but it doesn't seem to reflect the PWM frequency I send through the console. I sent in:

                        M307 H1 A-1 C-1 D-1
                        M571 P1 F1 S1

                        And every time I extruded the LED would toggle for the duration of the extrusion, then would go back to normal (on/off depending on wiring). Its one step better than it was before as I can see some kind of response now, but no matter what frequency I pass in there is no reflection in the LED. Perhaps theres something wrong with the circuit so my next step is to throw it into an oscilloscope and see if its outputting the frequency Im requesting

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

                          @ara1123
                          A scope is a good idea.
                          Our eyes are betraying us too much.
                          You can't see a LED flicker above 20Hz or so....

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