Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Power limitation #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions Maiskolben_TFT/Maiskolben_TFT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -872,10 +872,19 @@ void compute(void) {
last_measured = cur_t;

heaterPID.Compute();
if (error != NO_ERROR || off)

// Power limitation.
// Tips are rated for 40W, do not exceed that.
// note t-hat we have inherently only 50% PWM, as we have it on 10ms and then wait with pwm off for another 10ms.
// Formula: P = 0.5 * ( U^2 / ( R )) * (pwm)
float pwm_max = 2 * PMAX / ((v*v) / 2.4);
if (pwm_max > pid_val) pwm_max = pid_val;

if (error != NO_ERROR || off) {
pwm = 0;
else
pwm = min(255,pid_val*255);
} else {
pwm = min(255, pwm_max * 255);
}
analogWrite(HEATER_PWM, pwm);
}

Expand Down
2 changes: 2 additions & 0 deletions Maiskolben_TFT/definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#define TEMP_STBY 150
#define TEMP_COLD (adc_offset + 15)

#define PMAX (40) // max watts to pump into the tip. (note: Weller specifies the tips as 40W; the big RT-11 has 55W)

#define SHUTOFF_ACTIVE
#define BOOTHEAT_ACTIVE

Expand Down