Welcome! Log In Create A New Profile

Advanced

4 heated bed zones PID control

Posted by feynman137 
4 heated bed zones PID control
June 16, 2021 10:21PM
Hello

I am new to RepRap, and am setting up my coreXY. The printer I am working on has a bed that is about 24in x 24in There are 4 heated zones which use 220/240Vs and 4 SSRs for temperature control. Each section should have its own thermistor and PID control.

Is this possible to configure in RepRap? I have a Duet3 6HC mainboard with an expansion board as well, so a fair amount of I/Os. Also wanted to ask if the signal to the SSR is a PWM?
Re: 4 heated bed zones PID control
June 17, 2021 03:27AM
Yes, RepRapFirmware for the Duet 3 6HC supports up to 12 bed heaters. You can connect your SSR inputs to any of the OUT ports. If the SSRs will work on 3V input (as most do) then you can also drive them from the IOx.OUT ports.

To set this up:

- Create 4 heaters using your chosen outputs with the M950 command. When driving SSRs, we recommend that you use parameter Q10 in the M950 commands to set the PWM frequency to 10Hz. For example, to create heaters 10 thru 13 you could use:

M950 H10 C"out0" Q10
M950 H11 C"out7" Q10
M950 H12 C"out8" Q10
M950 H13 C"out9" Q10

- Use M140 to assign those heaters to the bed. For example:

M140 H10:11:12:13

- Prior to printing (e.g. in your slicer start script), use the M140 command with the P parameter to set the temperatures for the individual bed heaters. P will go from 0 to 3 regardless of the heater numbers you used. For example:

M140 P0 S65
M140 P1 S65
M140 P2 S65
M140 P3 S65

- Use M116 to wait for all temperatures to be reached.

Edited 1 time(s). Last edit at 06/17/2021 03:29AM by dc42.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: 4 heated bed zones PID control
June 18, 2021 12:19AM
Thank you for the detailed answer, exactly what I was looking for...

Can I ask why the PWM frequency of 10Hz is this the maximum frequency of the ON/OFF switching of the relay? This isn't as important but are you aware of the rate that the firmware is reading the thermistor/temperature PV?
Re: 4 heated bed zones PID control
June 18, 2021 03:13AM
The reason for the low PWM frequency is that if the SSR is DC-AC then it is normally of the zero-crossing type, which means that it can only pass whole cycles of 50Hz or 60Hz mains; and if it is DC-DC then high switching frequencies are likely to significantly increase power dissipation in the relay, because these devices are not normally designed for rapid switching. The temperature is measured at intervals of 250ms and the dead time of a bed heaters is usually over 10 seconds, so from a control point of view there is no disadvantage to using a PWM frequency as low as 10Hz.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: 4 heated bed zones PID control
July 18, 2021 06:19PM
Hey guys

So I finally am getting around to wiring this thing up and programming. I wanted to confirm how one would wire this up though. For example for



which pin will I connect to the SSR Input+ and Input-. It isn't obvious to me which one to connect. And for the thermistor I am assuming it doesn't matter how I hook it up...
Re: 4 heated bed zones PID control
July 19, 2021 03:09AM
Connect the - input of the SSR to e.g. out7 and connect the + input to VOUTLC on the same connector.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: 4 heated bed zones PID control
August 26, 2021 12:20AM
Hey DC42, I apologize for resurrecting this thread after a month, but I am wondering shouldn't there have been some code to configure the 4 thermistors and then tie them to their respective heater? In the code you posted above we are creating the heaters and then assigning to the bed. But I imagine there is a M305 command or similar, the code below uses M308. I am using the temp1-4 slots on the mainboard 6HC.

My hotend configuration that looks like:
; Heaters
M308 S0 P"temp1" Y"thermistor" T100000 B4138    ; configure sensor 0 as thermistor on pin temp1
M950 H0 C"out1" T0                              ; create nozzle heater output on out1 and map it to sensor 0
M307 H0 B0 S1.00                                ; disable bang-bang mode for heater  and set PWM limit
M143 H0 S280                                    ; set temperature limit for heater 0 to 280C
Re: 4 heated bed zones PID control
August 26, 2021 01:57AM
Yes you need to have four of each of those commands to define four temperature sensors and four heaters. Then one M140 command to allocate those four heaters to the bed.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: 4 heated bed zones PID control
August 26, 2021 09:01PM
Thanks man.spinning smiley sticking its tongue out

I used the config tool and it gave me these lines for a bed heater:

M308 S0 P"bedtemp" Y"thermistor" T100000 B4138  ; configure sensor 0 as thermistor on pin bedtemp
M950 H0 C"bedheat" T0                           ; create bed heater output on bedheat and map it to sensor 0
M307 H0 B0 S1.00                                ; disable bang-bang mode for the bed heater and set PWM limit
M140 H0                                         ; map heated bed to heater 0


Adjusting this for what you have mentioned regarding my specific case:

M308 S0 P"bedtemp0" Y"thermistor" T100000 B4138; configure sensor 0 as thermistor on pin bedtemp0
M308 S1 P"bedtemp1" Y"thermistor" T100000 B4138; configure sensor 1 as thermistor on pin bedtemp1
M308 S2 P"bedtemp2" Y"thermistor" T100000 B4138; configure sensor 2 as thermistor on pin bedtemp2
M308 S3 P"bedtemp3" Y"thermistor" T100000 B4138; configure sensor 3 as thermistor on pin bedtemp3

M950 H10 C"bedheat0" T0 Q10; create bed heater output on bedheat0 and map it's relay pin to 0 and set pwm freq to 10
M950 H11 C"bedheat1" T1 Q10; create bed heater output on bedheat1 and map it to sensor 1 and set pwm freq to 10
M950 H12 C"bedheat2" T2 Q10; create bed heater output on bedheat2 and map it to sensor 2 and set pwm freq to 10
M950 H13 C"bedheat3" T3 Q10; create bed heater output on bedheat3 and map it to sensor 3 and set pwm freq to 10

M307 H10 B0; disable bang-bang mode for heater 10
M307 H11 B0; disable bang-bang mode for heater 11
M307 H12 B0; disable bang-bang mode for heater 12
M307 H13 B0; disable bang-bang mode for heater 13

M143 H10 S120; set temperature limit for heater 10 to 120C
M143 H11 S120; set temperature limit for heater 11 to 120C
M143 H12 S120; set temperature limit for heater 12 to 120C
M143 H13 S120; set temperature limit for heater 13 to 120C

M140 H10:11:12:13; map heated bed to heater 10,11,12,13

The actual physical connections for my hardware are as follows, not sure how to put this into code.
Bed heater 0 relay is out9 and thermistor temp0
Bed heater 1 relay is out6 and thermistor temp1
Bed heater 2 relay is out5 and thermistor temp2
Bed heater 3 relay is out4 and thermistor temp3

I don't know whether the code above is fully correct, I have my doubts. Because I am not understanding how the physical connections between the duet board, relays, thermistors are being represented in the code. Can you enlighten me on whether the code is correct and how the physical connections are being represented in the code?
Re: 4 heated bed zones PID control
August 30, 2021 02:35PM
I see that you have also posted on the Duet3D forum, which is good because you will get more replies to questions about RepRapFirmware there. If I have anything to add, I will add my response there.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: 4 heated bed zones PID control
August 30, 2021 06:24PM
Yes I did this afternoon. link to thread

Here is the config file of the printer but the sections under bed heater have the code relevant to this discussion:
; Configuration file for Duet 3 (firmware version 3)
; executed by the firmware on start-up
;
; generated by RepRapFirmware Configuration Tool v3.2.3 on Wed Jun 23 2021 23:47:21 GMT-0400 (Eastern Daylight Time)

; General preferences
G90                                             ; send absolute coordinates...
M83                                             ; ...but relative extruder moves
M550 P"Duet 3"                                  ; set printer name
M669 K1                                         ; select CoreXY mode

; Drives
M569 P0.0 S1                                    ; physical drive 0.0 goes forwards
M569 P0.1 S1                                    ; physical drive 0.1 goes forwards
M569 P0.2 S1									; physical drive 0.2 goes forwards
M569 P0.3 S1									; physical drive 0.3 goes forwards
M569 P0.4 S1									; physical drive 0.4 goes forwards
M569 P0.5 S1									; physical drive 0.5 goes forwards                                			
M569 P1.1 S1                                    ; physical drive 1.1 goes forwards
M569 P1.2 S1                                    ; physical drive 1.2 goes forwards
M584 X0.0 Y0.1 Z0.2:0.3:0.4:0.5 E1.1:1.2        ; set drive mapping
M350 X16 Y16 Z16 E16:16 I1                      ; configure microstepping with interpolation
M92 X40.00 Y40.00 Z400.00 E420.00:420.00        ; set steps per mm
M566 X900.00 Y900.00 Z60.00 E120.00:120.00      ; set maximum instantaneous speed changes (mm/min)
M203 X6000.00 Y6000.00 Z120.00 E1200.00:1200.00 ; set maximum speeds (mm/min)
M201 X500.00 Y500.00 Z10.00 E250.00:250.00      ; set accelerations (mm/s^2)
M906 X1500 Y1500 Z1500 E800:800 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 X600 Y540 Z496 S0                          ; set axis maxima

; Endstops
M574 X1 S1 P"!io4.in"                           ; configure active-low endstop for low end on X via pin !io1.in
M574 Y1 S1 P"!io5.in"                           ; configure active-low endstop for low end on Y via pin !io5.in
M574 Z2 S1 P"!io3.in"                           ; configure active-low endstop for low end on Z via pin !io3.in

; Z-Probe
M950 S0 C"io7.out"                              ; create servo pin 0 for BLTouch
M558 P9 C"^io7.in" H7 F120 T6000                ; set Z probe type to bltouch and the dive height + speeds
G31 P500 X0 Y0 Z1.67                            ; set Z probe trigger value, offset and trigger height
M557 X10:600 Y10:540 S100                        ; define mesh grid

; Heaters

M308 S0 P"1.temp0" Y"thermistor" T100000 B4138  ; configure sensor 0 as thermistor on expansion board pin 1.temp0
M950 H0 C"1.out0" T0                            ; create nozzle heater output on 1.out0 and map it to sensor 0
M307 H0 B0 S1.00                                ; disable bang-bang mode for heater  and set PWM limit
M143 H0 S280                                    ; set temperature limit for heater 0 to 280C
M308 S1 P"1.temp1" Y"thermistor" T100000 B4138  ; configure sensor 2 as thermistor on expansion board pin 1.temp1
M950 H1 C"1.out1" T1                            ; create nozzle heater output on 1.out2 and map it to sensor 1
M307 H1 B0 S1.00                                ; disable bang-bang mode for heater  and set PWM limit
M143 H1 S280                                    ; set temperature limit for heater 1 to 280C

; bed heater0
M308 S2 P"0.temp0" Y"thermistor" T100000 B4138    ; configure sensor 2 as thermistor on mainboard pin temp0
M950 H2 C"0.out9" T2                            ; create bed heater output on 1.out0 and map it to sensor 2
M140 P0 H2                                         ;assign H2 to bed heater0
M307 H2 B0 S10.00                                ; disable bang-bang mode for the bed heater and set PWM limit
M143 H2 S120                                     ;set temperature limit for heater 0 to 120C 

; bed heater1
M308 S3 P"0.temp1" Y"thermistor" T100000 B4138    ; configure sensor 3 as thermistor on mainboard pin temp1
M950 H3 C"0.out6" T3                             ; create bed heater output on 1.out0 and map it to sensor 3
M140 P1 H3                                         ;assign H2 to bed heater0
M307 H3 B0 S10.00                                ; disable bang-bang mode for the bed heater and set PWM limit
M143 H3 S120                                     ;set temperature limit for heater 0 to 120C

; bed heater2
M308 S4 P"0.temp2" Y"thermistor" T100000 B4138    ; configure sensor 4 as thermistor on mainboard pin temp2
M950 H4 C"0.out5" T4                             ; create bed heater output on 1.out0 and map it to sensor 4
M140 P2 H4                                          ;assign H2 to bed heater0
M307 H4 B0 S10.00                                ; disable bang-bang mode for the bed heater and set PWM limit
M143 H4 S120                                     ;set temperature limit for heater 0 to 120C

; bed heater3
M308 S5 P"0.temp3" Y"thermistor" T100000 B4138    ; configure sensor 5 as thermistor on mainboard pin temp3
M950 H5 C"0.out4" T5                             ; create bed heater output on 1.out0 and map it to sensor 5
M140 P3 H5                                      ;assign H2 to bed heater0
M307 H5 B0 S10.00                                ; disable bang-bang mode for the bed heater and set PWM limit
M143 H5 S120                                     ;set temperature limit for heater 0 to 120C



; Fans
M950 F0 C"1.out7" Q500                          ; create fan 0 on pin 1.out7 and set its frequency
M106 P0 S0 H-1                                  ; set fan 0 value. Thermostatic control is turned off
M950 F1 C"1.out8" Q500                          ; create fan 1 on pin 1.out8 and set its frequency
M106 P1 S1 H-1                                  ; set fan 1 value. Thermostatic control is turned off

; Tools
M563 P0 D0 H0 F0                                ; define tool 0
G10 P0 X23.9 Y-28.21 Z0                          ; set tool 0 axis offsets
G10 P0 R0 S0                                    ; set initial tool 0 active and standby temperatures to 0C
M563 P1 D1 H1 F1                                ; define tool 1
G10 P1 X-23.9 Y-28.21 Z0                         ; set tool 1 axis offsets
G10 P1 R0 S0                                    ; set initial tool 0 active and standby temperatures to 0C

; Custom settings are not defined

; Miscellaneous
M575 P1 S1 B57600                               ; enable support for PanelDue

Edited 1 time(s). Last edit at 08/30/2021 06:28PM by feynman137.
Sorry, only registered users may post in this forum.

Click here to login