Duet3D 6HC custom pwm output



  • I want to control an LED light board using Out4 on my Duet3D 6HC. I want my cable to carry GND, 24V and a variable pwm 'control' signal for controlling the board. It looks from the wiring diagram like I can do this and I see GND,+24V on my cable now. I used the following G-Code to initialize:

    M950 F4 C"Out4" Q30000
    M106 P4 S0

    Then to enable PWM when I want to turn the lights on I use this:

    M106 P4 S255 - I don't see any change on out4.
    M106 P4 S128 - I see a 0v to -400mV signal on out4

    I guess I expected a 0.0V - 3.3V pwm signal on out4. How is this pwm signal intended to be used? (sorry if this is a dumb question!)

    Thanks!
    Greg


  • Moderator

    The Duet switches the PWM on the negative side. Do your LEDs take a separate PWM signal? What kind of LED light board is it?

    See here for a description of connecting a 4 wire PWM fan. Since the LEDs have no tachometer wire you can ignore that part, but the main difference is that you connect + and - as a steady supply and then use the negative post of the PWM fan port as the PWM signal.

    https://duet3d.dozuki.com/Wiki/Connecting_and_configuring_fans#Section_Connecting_4_wire_fans



  • Its a board I made, the pwm signal goes into the LED controller which is an AL8860WT-7. The duty cycle of the pwm signal controls the current output to the LEDS. Maybe I need a pullup resistor to use this with duet3d's pwm output?



  • @desertgreg said in Duet3D 6HC custom pwm output:

    Maybe I need a pullup resistor to use this with duet3d's pwm output?

    if you need 0-3.3v signal, then a pull up to 3.3v might help indeed; by default the output is open drain.



  • Ah that makes sense. I ran a line with a pullup resistor over to a 3.3V output and now I get a 3.3V pwm signal. The pwm duty cycle was inverted until I found the '!' option on the output pin. So the g-code looks like this (in case anyone else comes across this)

    ; setup out4 as a fan with 30khz pwm, inverted logic since I'm using a pullup resistor
    M950 F4 C"!Out4" Q30000

    ; set pwm duty cycle on out4
    M106 P4 <0-255>

    Thank you for the help.



  • Ah, yeah, should maybe have mentioned that, the nature of the open drain n-channel mosfet means the output get inverted relative to the signal from the microcontroller.

    Glad you figured it out!


Log in to reply