Help to config Servo MG995 for Duet3 6HC
-
Hello folks,
I have a problem with a servo M995. I just can't get it to work. I've already searched the forum for the problem:Wiki Using servos and controlling unused IO pins
-> duet-2-on-rrf3-servos-not-working
-> servos-not-working-correctly
->help-configuring-rc-servo-for-spindleUnfortunately I didn't get any further.
I have the firmware version: 3.2.2, electronics: Duet 3 MB6HC 1.0 + raspberry pi 3, firmware_date: 2021-02-11 and the Duet Control Server v3.2.2
Here is my M112
M122: === Diagnostics === RepRapFirmware for Duet 3 MB6HC version 3.2.2 running on Duet 3 MB6HC v0.6 or 1.0 (SBC mode) Board ID: XXXXX-956L2-G43S4-6J9D4-3SJ6S-TA66H Used output buffers: 1 of 40 (10 max) === RTOS === Static ram: 149788 Dynamic ram: 62876 of which 24 recycled Never used RAM 146144, free system stack 180 words Tasks: Linux(ready,85) HEAT(blocked,281) CanReceiv(blocked,927) CanSender(blocked,371) CanClock(blocked,352) TMC(blocked,53) MAIN(running,1165) IDLE(ready,19) Owned mutexes: HTTP(MAIN) === Platform === Last reset 00:02:06 ago, cause: power up Last software reset at 2021-05-16 15:41, reason: User, none spinning, available RAM 146144, slot 1 Software reset code 0x0012 HFSR 0x00000000 CFSR 0x00000000 ICSR 0x0044a000 BFAR 0x00000000 SP 0x00000000 Task Linu Freestk 0 n/a Error status: 0x00 Aux0 errors 0,0,0 Aux1 errors 0,0,0 MCU temperature: min 14.0, current 27.5, max 27.6 Supply voltage: min 24.5, current 24.5, max 24.6, under voltage events: 0, over voltage events: 0, power good: yes 12V rail voltage: min 12.2, current 12.2, max 12.3, under voltage events: 0 Driver 0: position 0, standstill, reads 58965, writes 14 timeouts 0, SG min/max 0/0 Driver 1: position 0, standstill, reads 58965, writes 14 timeouts 0, SG min/max 0/0 Driver 2: position 0, standstill, reads 58965, writes 14 timeouts 0, SG min/max 0/0 Driver 3: position 0, standstill, reads 58968, writes 11 timeouts 0, SG min/max 0/0 Driver 4: position 0, standstill, reads 58969, writes 11 timeouts 0, SG min/max 0/0 Driver 5: position 0, standstill, reads 58966, writes 14 timeouts 0, SG min/max 0/0 Date/time: - Slowest loop: 0.46ms; fastest: 0.05ms === Storage === Free file entries: 10 SD card 0 not detected, interface speed: 37.5MBytes/sec SD card longest read time 0.0ms, write time 0.0ms, max retries 0 === Move === DMs created 125, maxWait 0ms, bed compensation in use: none, comp offset 0.000 === MainDDARing === Scheduled moves 0, completed moves 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1 === AuxDDARing === Scheduled moves 0, completed moves 0, hiccups 0, stepErrors 0, LaErrors 0, Underruns [0, 0, 0], CDDA state -1 === Heat === Bed heaters = 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1, chamberHeaters = -1 -1 -1 -1 === GCodes === Segments left: 0 Movement lock held by null HTTP* is doing "M122" in state(s) 0 Telnet is idle in state(s) 0 File is idle in state(s) 0 USB is idle in state(s) 0 Aux is idle in state(s) 0 Trigger* is idle in state(s) 0 Queue is idle in state(s) 0 LCD is idle in state(s) 0 SBC is idle in state(s) 0 Daemon is idle in state(s) 0 Aux2 is idle in state(s) 0 Autopause is idle in state(s) 0 Code queue is empty. === Filament sensors === Extruder 0: pos 0.00, errs: frame 0 parity 0 ovrun 0 pol 0 ovdue 0 === CAN === Messages queued 408, send timeouts 1039, received 0, lost 0, longest wait 0ms for reply type 0, free buffers 48 === SBC interface === State: 4, failed transfers: 0 Last transfer: 1ms ago RX/TX seq numbers: 3754/3754 SPI underruns 0, overruns 0 Number of disconnects: 0, IAP RAM available 0x2c8a8 Buffer RX/TX: 0/0-0 === Duet Control Server === Duet Control Server v3.2.2 Code buffer space: 4096 Configured SPI speed: 8000000 Hz Full transfers per second: 0.04 Maximum length of RX/TX data transfers: 2696/468
My config:
; Configuration file for Duet 3 (firmware version 3) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool v3.2.3 on Sat Mar 27 2021 21:56:24 GMT+0100 (Mitteleuropäische Normalzeit) ; General preferences G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"□□□" ; set printer name ; Drives M569 P0.0 S1 ; physical drive 0.0 goes S1 forwards M569 P0.1 S0 ; physical drive 0.1 goes S1 forwards S0 backwards M569 P0.2 S0 ; physical drive 0.2 goes S1 forwards S0 backwards M569 P0.5 S0 ; physical drive 0.5 goes S1 forwards S0 backwards M584 X0.0 Y0.1 Z0.2 E0.5 ; set drive mapping M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation M92 X53.33 Y53.33 Z1636.66 E492.40 ; set steps per mm M566 X900.00 Y900.00 Z60.00 E120.00 ; set maximum instantaneous speed changes (mm/min) M203 X6000.00 Y6000.00 Z120.00 E1200.00 ; set maximum speeds (mm/min) M201 X500.00 Y500.00 Z20.00 E250.00 ; set accelerations (mm/s^2) M906 X2800 Y2800 Z1600 E1200 I30 ; set motor currents (mA) and motor idle factor in per cent M84 S60 ; Set idle timeout ; Axis Limits M208 X0 Y0 Z0 S1 ; set axis minima M208 X□□□Y□□□ Z□□□ S0 ; set axis maxima ; Endstops M574 X1 S1 P"io0.in" ; configure active-high endstop for low end on X via pin io0.in M574 Y1 S1 P"io1.in" ; configure active-high endstop for low end on Y via pin io1.in M574 Z1 S2 ; added later ; Z-Probe M950 S0 C"io7.out" ; create servo pin 0 for BLTouch M558 P9 C"io7.in" H5 F120 R0.5 T3000 ; set Z probe type to bltouch and the dive height + speeds ; Note: Try adding a small delay after deploying the probe. The simplest way is to use the R parameter in the M558 command. 0.1 sec should be sufficient. ;Remove the ^ in front of the pin name in the M558 command. It's only needed on Duet 2 G31 P500 X0 Y0 Z5 ; set Z probe trigger value, offset and trigger height, orgnial G31 P500 X0 Y0 Z2.5 M557 X0:530 Y0:300 S75:60 ; define mesh grid ; Temp Heatbed M308 S0 P"temp0" Y"thermistor" T100000 B4092 ; configure sensor 0 as thermistor (RS-Comp 769-1931, EPCOS NTC Thermistor, 100kΩ = 100000Ω) on pin temp0, orginal T100000 B4138 M950 H0 C"out0" T0 ; create bed heater output on out0 and map it to sensor 0 M307 H0 B1 S1.00 R0.5 D30.0 ; enable bang-bang mode for the bed heater and set PWM limit, orginal heating rate 2.429, dead time 5.50 ; Zeitkonstante R mindestens doppelt so lang ist wie die Totzeit D M140 H0 ; map heated bed to heater 0 M143 H0 S120 ; set temperature limit for heater 0 to 120C ; Temp Heater Hotend M308 S1 P"temp1" Y"thermistor" T100000 B4138 ; configure sensor 1 as thermistor (ed3 Thermistor Cartridge with Semitec 104NT thermistor) on pin temp1 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 M307 H1 R2.664 C256.6 D8.87 V24.4 ; PID tune parameters for heater 1 M143 H1 S280 ; set temperature limit for heater 1 to 280C ; Fans M950 F0 C"out7" Q500 ; create fan 0 on pin out7 and set its frequency, orninal M950 F0 C"out7" Q500 M106 P0 S1 H-1 ; set fan 1 value. Thermostatic control is turned off M950 F1 C"out8" Q500 ; create fan 1 on pin out8 and set its frequency M106 P1 S1 H1 T35 ; set fan 1 value. Thermostatic control is turned on ; Rotating Magnet Filament Monitor M591 D0 P3 C"io2.in" S1 ; Duet3D rotating magnet sensor (P3) for extruder drive 5 (D0) is connected to io_2 ; Note: Sn 0 = disable filament monitoring (default), 1 = enable filament monitoring ; Servo 1 M950 S1 C"io6.out" Q50 ;Enabling Pin6 as GPIO Port 1 on the Expansion Slot for PWM @ 50Hz ;M42 P1 S0 ;Switching GPIO Port 0 Off ;M42 S1 S0.5 ; set 50% PWM on GPIO Port 1 ; 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 ; Miscellaneous M501 ; load saved parameters from non-volatile memory
wiring :
I have a 230V AC to 24V DC /15A power supply for the board and a separate supply, 230V AC to 5V DC Mean Well IRM-30-5ST with 6 amps, for the servo. The servo is connected as follows:RED, PLUS SERVO -> +V0 Meean Well
BLACK, MINUS SERVO -> -V0 Mean Well and GND on io.6
ORANGE, SIGNAL -> io6.outI have also tried:
BLACK, MINUS SERVO -> -V0 Mean Well and Duet 3 Mainboard, Power In GNDNothing happens with g-code command M280 P1 S50
But if I take the servo with a tester and a separate laboratory power supply it moves as it should. It was also tested whether 5v come out of the meanwell power supply. It is ok.Datasheet Servo - MG995 Tower-Pro.pdf
Can someone help me, please?
-
https://forum.duet3d.com/topic/13016/rrf3-and-servo/9?_=1621456861076
Edit:
As your board is a 6HC i think you can set the pullup in the config. -
@snt the signal level on io6.out is 3.3V and that might not be enough for your servo. Try using the LASER/VFD output instead, which has 5V signal level.
I suggest you remove the Q50 parameter from the M950 S1 command. the s1 parameter will cause RRF to set up the frequency correctly.
-
@dc42 said in Help to config Servero MG995 for Duet3 6HC:
I suggest you remove the Q50 parameter from the M950 S1 command.
He's not the only user, who confuses frequency with duty cycle. Maybe the wiki could mention that.
I'd suggest adding a 'start value' for servos or linear actuators in M950.
What's the current duty cycle of new defined servos? 50% = 1500 us? -
Thank you guys, I will try the solution on the weekend.
-
Hello folks,
what if I want to control 2 servos independently? Do I need a level converter? Can you recommend a level converter to me, please?P.S. How can I correct the heading? Servero ->Servo
-
@snt, did using the Laser/VFD output work?
PS - I have changed the title.
-
I tried out9 (LASER / VFD) and it worked.
; Configuration file for Duet 3 (firmware version 3) ; executed by the firmware on start-up ; ; generated by RepRapFirmware Configuration Tool v3.2.3 on Sat Mar 27 2021 21:56:24 GMT+0100 (Mitteleuropäische Normalzeit) ; General preferences G90 ; send absolute coordinates... M83 ; ...but relative extruder moves M550 P"□□□" ; set printer name ; Drives M569 P0.0 S1 ; physical drive 0.0 goes S1 forwards M569 P0.1 S0 ; physical drive 0.1 goes S1 forwards S0 backwards M569 P0.2 S0 ; physical drive 0.2 goes S1 forwards S0 backwards M569 P0.5 S0 ; physical drive 0.5 goes S1 forwards S0 backwards M584 X0.0 Y0.1 Z0.2 E0.5 ; set drive mapping M350 X16 Y16 Z16 E16 I1 ; configure microstepping with interpolation M92 X53.33 Y53.33 Z1636.66 E492.40 ; set steps per mm, orginal X80.00 Y80.00 Z400.00 E492.40 M566 X900.00 Y900.00 Z60.00 E120.00 ; set maximum instantaneous speed changes (mm/min) M203 X6000.00 Y6000.00 Z120.00 E1200.00 ; set maximum speeds (mm/min) M201 X500.00 Y500.00 Z20.00 E250.00 ; set accelerations (mm/s^2) M906 X2800 Y2800 Z1600 E1200 I30 ; set motor currents (mA) and motor idle factor in per cent M84 S60 ; Set idle timeout ; Axis Limits M208 X0 Y0 Z0 S1 ; set axis minima M208 X□□□ Y□□□ Z□□□ S0 ; set axis maxima ; Endstops M574 X1 S1 P"io0.in" ; configure active-high endstop for low end on X via pin io0.in M574 Y1 S1 P"io1.in" ; configure active-high endstop for low end on Y via pin io1.in M574 Z1 S2 ; nachträglich eingefügt ; Z-Probe M950 S0 C"io7.out" ; create servo pin 0 for BLTouch M558 P9 C"io7.in" H5 F120 R0.5 T3000 ; set Z probe type to bltouch and the dive height + speeds, orninal M558 P9 C"^io7.in" H5 F120 T3000 ; Try adding a small delay after deploying the probe. The simplest way is to use the R parameter in the M558 command. 0.1 sec should be sufficient. ;Remove the ^ in front of the pin name in the M558 command. It's only needed on Duet 2 G31 P500 X0 Y0 Z5 ; set Z probe trigger value, offset and trigger height, orgnial G31 P500 X0 Y0 Z2.5 M557 X0:530 Y0:300 S75:60 ; define mesh grid, orinal X10:190 Y10:190 S20 ; Temp Heatbed M308 S0 P"temp0" Y"thermistor" T100000 B4092 ; configure sensor 0 as thermistor (RS-Comp 769-1931, EPCOS NTC Thermistor, 100kΩ = 100000Ω) on pin temp0, orginal T100000 B4138 M950 H0 C"out0" T0 ; create bed heater output on out0 and map it to sensor 0 M307 H0 B1 S1.00 R0.5 D30.0 ; enable bang-bang mode for the bed heater and set PWM limit, orginal heating rate 2.429, dead time 5.50 ; Zeitkonstante R mindestens doppelt so lang ist wie die Totzeit D M140 H0 ; map heated bed to heater 0 M143 H0 S120 ; set temperature limit for heater 0 to 120C ; Temp Heater Hotend M308 S1 P"temp1" Y"thermistor" T100000 B4138 ; configure sensor 1 as thermistor (ed3 Thermistor Cartridge with Semitec 104NT thermistor) on pin temp1 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 M307 H1 R2.664 C256.6 D8.87 V24.4 ; PID tune parameters for heater 1 M143 H1 S280 ; set temperature limit for heater 1 to 280C ; Fans M950 F0 C"out7" Q500 ; create fan 0 on pin out7 and set its frequency, orninal M950 F0 C"out7" Q500 M106 P0 S1 H-1 ; set fan 1 value. Thermostatic control is turned off M950 F1 C"out8" Q500 ; create fan 1 on pin out8 and set its frequency M106 P1 S1 H1 T35 ; set fan 1 value. Thermostatic control is turned on ; Rotating Magnet Filament Monitor M591 D0 P3 C"io2.in" S1 ; Duet3D rotating magnet sensor (P3) for extruder drive 5 (D0) is connected to io_2 ; Sn 0 = disable filament monitoring (default), 1 = enable filament monitoring ; Servo 1 M950 S1 C"out9" ;Enabling Pin6 as GPIO Port 0 on the Expansion Slot for PWM @ 50Hz ;M42 P1 S0 ;Switching GPIO Port 0 Off ;M42 S0.8 S0.5 ; set 50% PWM on GPIO port 10 ; 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 ; Miscellaneous M501 ; load saved parameters from non-volatile memory
How can I connect a second servo MG995?
-
@snt if the Duet3 has an heater3 on gpio, you can use:
M950 S1 C"exp.heater3" ; assign GPIO port 1 to heater3 on expansion connector, servo mode