Linear PID max output scaling based on temperature
i'm thinking about switching from my 2014 Rambo Board on a Rostock Max V2 to a Duet 2 Wifi. RIght now i'm using nearly stock Marlin Firmware 1.1.X but i've a minor edit that i need to know if is already present in RRF.
My printer is born with 12V power supply but i've switched to 24V (25V actually) for getting the heated bed to reach stable 110/120°C in about 10 minutes. The problem i've faced is that my onyx heated bed was not correctly designed and its resistency is lower than it should be to work at reasonable current at 24VDC. If i run it directly connected to the PS at 25VDC i get around 22Amps but, as you all know, resistance is greater at higher temperature, ending with a current of 11/12 Amps at 100°C. What i did in marlin is an horrible hack that allows me to run the heated bed at 25VDC limiting the max PID output based on the current bed temperature. I attach the edit here for better comprension:
int min_temp = 20; int max_temp = 80; int min_output = 190; int max_output = 255; if (current_temperature_bed >= min_temp && current_temperature_bed <=max_temp) SCALED_MAX_BED_POWER = map(current_temperature_bed,min_temp,max_temp,min_output,max_output); else if (current_temperature_bed < min_temp) SCALED_MAX_BED_POWER = min_output; else if (current_temperature_bed > max_temp) SCALED_MAX_BED_POWER = max_output;
SCALED_MAX_BED_POWER will replace MAX_BED_POWER variable on the PID calculations.
Don't blame me for the rough code, i'm not a professional developer!
With this "trick" i can get nearly costant 14Amps on my heated bed at every temperature (15A max power from my board).
Duet2 can hold up to 18A that is not enough for a cold start for my setup. Within RRF does already exist this type of feature or is something i can easily add my own like i did in Marlin?
Also noticed that a " Firmware developers " section exists. If a mod could move that topic there would be nice! Sorry!
RRF doesn't have that facility built-in. However, I think you could implement it in the daemon.g file supported by RepRapFirmware 3.01, by writing a simple loop that watches the bed temperature and adjusts the maximum PWM accordingly.
So basically i can write code that runs on a different thread that updates the value right? This would be great and allow me to not replace my old bad made bed!