Measuring PWM output and duty cycle
-
I'm trying to configure a PWM controlled spindle but not having any luck. I guess the simplest question would be - shouldnt I be able to see the PWM signal with my oscope by connecting the probe to ground and the chosen pwm pin? Spindle becomes "active" after sending m3 command but flat lined on the scope
p.s.
having an oscope should not be construed as knowing what the hell I'm doing haha
my config, incase there's something obviously wrongBoard: Duet 2 Ethernet (2Ethernet) Firmware: RepRapFirmware for Duet 2 WiFi/Ethernet 3.4.2 (2022-09-13) Duet Web Control 3.4.2 ; Configuration file for Duet Ethernet (firmware version 1.20 or newer) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool on Thu May 10 2018 21:56:20 GMT-0400 (Eastern Daylight Time) ; General preferences M453 ; Put the machine into CNC Modes G90 ; Send absolute coordinates... ;M83 ...but relative extruder moves ; Network M550 Micro Mill 1 ; Set machine name M552 P192.168.1.69 S1 ; Enable network and set IP address M553 P255.255.255.0 ; Set netmask M554 P192.168.1.254 ; Set gateway M586 P0 S1 ; Enable HTTP M586 P1 S0 ; Disable FTP M586 P2 S0 ; Disable Telnet ; Drive mapping M584 X0 Y1 Z2 A3 ; Drives M569 P0 S0 ; Drive 0 goes forwards M569 P1 S0 ; Drive 1 goes FORWARD M569 P2 S1 ; Drive 2 goes forwards M569 P3 S1 ; Drive 3 goes forwards M350 X8 Y8 Z8 A16 I1 ; Configure microstepping M92 X1600 Y1600 Z1600 ;Set steps per mm M92 A17.778 ;Set steps per degree M566 X17 Y17 Z17 A17 ; Set maximum instantaneous speed changes (mm/min) M203 X1000 Y1000 Z800 A1000 ; Set maximum speeds (mm/min) 800 = 31.5 in/min 100=3.937 10 mm/sec = 23.622 in/min M201 X600 Y600 Z600 A600 ; Set accelerations (mm/s^2) M906 X800 Y800 Z1600 A1300 I50 ; Set motor currents (mA) and motor idle factor in per cent M84 S120 ; Set idle timeout ; Axis Limits M208 X-90 Y-41.5 Z-90 A0 S1 ; w/ end stop y=40 Set axis minima M208 X90 Y40 Z90 A360 S0 ; Set axis maxima ; Endstops ; OLD RRF2 M574 X2 Y2 Z2 A0 S0 ; Set active low endstops, endstops high ;NEW RRF3 M574 X2 S1 P"!xstop" M574 Y2 S1 P"!ystop" M574 Z2 S1 P"!zstop" ; 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 ;M106 P0 S0.3 I0 F500 H-1 ; Set fan 0 value, PWM signal inversion and frequency. Thermostatic control is turned off ;M106 P1 S1 I0 F500 H T45 ; Set fan 1 value, PWM signal inversion and frequency. Thermostatic control is turned on ;M106 P2 S1 I0 F500 H T45 ; Set fan 2 value, PWM signal inversion and frequency. Thermostatic control is turned on ; Tools ;SPINDLE M950 R0 C"exp.heater3" Q250 M563 P0 R0 M42 P0 S0.5 ;also tried ; Tools ;SPINDLE ;M950 R0 C"exp.heater3" Q1000 ;M563 P0 R0 S"Spindle" ;M568 P0 F0 ; Automatic saving after power loss is not enabled ; Custom settings M501 ; Load Stored Parameters
-
@3DPMicro The Duet MOSFETS usually switch the gnd side not the V+ side. So I'd guess your scope would see something if you connect it to the gnd on the connector that you use for the spindle rather than some other gnd.
-
@deckingman thank you. Ignorance is painful. I screwed with this thing for hours and it was simple as that
-
I have my spindle working but it's not reaching the 10k rpm as advertised. I have tried 100-2000 for the frequency with no noticeable effect. Im consistently seeing a range of approximately 50% duty cycle at about 4500rpm to a maximum of 90-93% at 7450rpm (ballpark numbers). The oscope is bouncing around when in the 90+% range so im not sure if it's not seeing 100% duty cycle or if the Duet isn't actually producing it. 100% duty cycle should show as flat lined on the oscope or possibley a consistant waveform? It looks pretty rough.
Basically I'm trying to determine if the Duet is producing the highest possible duty cycle or the spindle is not capable of the advertised 10k rpm. Any input would be appreciated -
@3DPMicro You are right about the flatline @100% duty cycle.
I see you are using 250 Hz or 1000 Hz as base frequency in the spindle config. Do you know, what's the max frequency for the spindle controller?
I suspect, the controller uses an PWM input which expects 50% duty cycle all_the_time, but changes speed based on the frequency. (seen on laser-controller board)
This is something RRF can't do for now and a workaround is:- using an external DC-AC converter or
- faking an analog signal by using a much higher PWM frequency.
The latter is easy to check. The external ac-converters are also available, but they often come with a 10V output level. Double check your spindles manual...
-
@o_lampe I haven't tried it yet but if I put 5 Volts to the pwm lead to the spindle that should essentially be 100% duty or is the pwm from Duet pulsing the ground?
I tried much higher frequencies but it didn't have any effect. Im waiting to hear what the spindle manufacturer has to say
Can you give me an example of the converter you mentioned? Is it an A/D converter? -