From c6a228d62ed7f42eb2a019801d9fa4316b45bdb7 Mon Sep 17 00:00:00 2001 From: Keegi Date: Tue, 9 Aug 2011 10:56:34 +0300 Subject: PID fixes --- Sprinter/Configuration.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Sprinter/Configuration.h') diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h index bc00ce1..df55c7d 100644 --- a/Sprinter/Configuration.h +++ b/Sprinter/Configuration.h @@ -120,10 +120,14 @@ char uuid[] = "00000000-0000-0000-0000-000000000000"; // Uncomment the following line to enable PID support. This is untested and could be disastrous. Be careful. //#define PIDTEMP #ifdef PIDTEMP -#define PID_INTEGRAL_DRIVE_MAX 220 -#define PID_PGAIN 180 //100 is 1.0 -#define PID_IGAIN 2 //100 is 1.0 -#define PID_DGAIN 100 //100 is 1.0 +#define PID_INTEGRAL_DRIVE_MAX 80 // too big, and heater will lag after changing temperature, too small and it might not compensate enough for long-term errors +#define PID_PGAIN 1280 //256 is 1.0 // value of 5.0 means that error of 20C is changing it almost halfway of the PWM range +#define PID_IGAIN 64 //256 is 1.0 // value of 0.25 means that each degree error over 1 sec (2 measurements) changes duty cycle by 0.5 units (verify?) +#define PID_DGAIN 2048 //256 is 1.0 // value of 8.0 means that each degree change over one measurement (half second) adjusts PWM by 8 units to compensate +// magic formula 1, to get approximate "zero error" PWM duty. It is most likely linear formula +#define HEATER_DUTY_FOR_SETPOINT(setpoint) (22+1*setpoint) +// magic formula 2, to make led brightness approximately linear +#define LED_PWM_FOR_BRIGTHNESS(brightness) ((64*brightness-1384)/(300-brightness)) #endif // Change this value (range 1-255) to limit the current to the nozzle -- cgit v1.2.1 From 116eefa1d78339a705390eb14db9eb4f09a6ae1a Mon Sep 17 00:00:00 2001 From: Keegi Date: Wed, 10 Aug 2011 16:09:23 +0300 Subject: fixed typo, added even more PID improvements (these settings work out of box for my old hotend, but overshoot badly on MG hotend) --- Sprinter/Configuration.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Sprinter/Configuration.h') diff --git a/Sprinter/Configuration.h b/Sprinter/Configuration.h index df55c7d..e246e65 100644 --- a/Sprinter/Configuration.h +++ b/Sprinter/Configuration.h @@ -118,7 +118,7 @@ char uuid[] = "00000000-0000-0000-0000-000000000000"; //// PID settings: // Uncomment the following line to enable PID support. This is untested and could be disastrous. Be careful. -//#define PIDTEMP +//#define PIDTEMP 1 #ifdef PIDTEMP #define PID_INTEGRAL_DRIVE_MAX 80 // too big, and heater will lag after changing temperature, too small and it might not compensate enough for long-term errors #define PID_PGAIN 1280 //256 is 1.0 // value of 5.0 means that error of 20C is changing it almost halfway of the PWM range @@ -127,7 +127,7 @@ char uuid[] = "00000000-0000-0000-0000-000000000000"; // magic formula 1, to get approximate "zero error" PWM duty. It is most likely linear formula #define HEATER_DUTY_FOR_SETPOINT(setpoint) (22+1*setpoint) // magic formula 2, to make led brightness approximately linear -#define LED_PWM_FOR_BRIGTHNESS(brightness) ((64*brightness-1384)/(300-brightness)) +#define LED_PWM_FOR_BRIGHTNESS(brightness) ((64*brightness-1384)/(300-brightness)) #endif // Change this value (range 1-255) to limit the current to the nozzle -- cgit v1.2.1