Skip to content
This repository

bed relay switches many times per minute #267

setar opened this Issue October 14, 2012 · 17 comments

6 participants

Sergey Taranenko daid nothinman Bernhard Kubicek ErikZalm Mark Finn
Sergey Taranenko

Heating my bed implemented using relay.
Heat relay switches bed many times per minute after apply "Merge pull request #262 from markfinn/bedpid-clean3".
clicks switching is present even in the process of heating a cold table.

my config :
//#define PIDTEMPBED
#define BED_HYSTERESIS 2 //only disable heating if T>target+BED_HYSTERESIS and enable heating if T>target-BED_HYSTERESIS
#define BED_CHECK_INTERVAL 5000 //ms

How do I less frequently make switching?


Use MOSFET rather than a mechanical relay. "Many times per minute" is considered slow...
You can change BED_CHECK_INTERVAL to a higher value if you don't like the relay sound... ;-) but the accuracy of temperature adjustment will suffer...

Bernhard Kubicek
Sergey Taranenko

Yes, bernhard, you absolutely understood me correctly.



Use a Graetz bridge to get DC and use MOSFET?
If you go relay way you have to be prepared for relay click and there isn't much you can do about that...


setar: can you define many times per minute? how often does it click, and what temperature does it open/close the relay at?
Are you saying that BED_CHECK_INTERVAL doesn't do its job?

Sergey Taranenko

set big parameter BED_CHECK_INTERVAL (50000) do pause to start switching, and do not change frequency

I want to use a mechanical relay.
I do not want to remake the printer ready to work for firmware
before this patch works fine



I removed the soft-pwm for the bed if bed pid is not enabled.
I put it in the Test_BED branch. Can you test this version?

Sergey Taranenko

i do test the branch (bc27d80) with my machine config + #define BED_LIMIT_SWITCHING

clicks continue
interesting observation: if we choose preheating and then cooled - bed remains enabled permanently (without clicking)


Sorry, Something went wrong with github. Not all changed where committed.

Please try again.

Mark Finn

Could you post your entire Configuration.h? Also Configuration_adv.h if you've made any changes.

Do you have a light on your electronics or bed heater that you could include in the video? I can't tell from the clicking which of those are on and off.

Mark Finn

I see the issue. In temperature.cpp, I used this line:

if(soft_pwm_b <= pwm_count) WRITE(HEATER_BED_PIN,0);

because I copied it from the extruders. I also set MAX_BED_POWER to 255 in the configuration, because that's what the extruders use for PID_MAX.

However, the bug is that the "<=" means that 255 is not on all the time, 256 is.

No one has noticed on the extruders (or on the bed since my patch) because no one can see that fast. We can hear that fast however, and the relay makes noise.

Set MAX_BED_POWER in Configuration.h to 256. I think you'll be fine.

Sergey Taranenko

Commit 016800b from branch Test_BED work fine.
Also #define MAX_BED_POWER 256 for current release of Marlin_v1 (7a2f6e3) too work fine.
Thanks :)

Mark Finn

ErikZalm, I think MAX_BED_POWER should be patched to default to 256. What do you think about PID_MAX?


Hello Mark,

I think they should both be increased to 256. The it will work ok.

I made a test branch where the soft_pwm is disabled when PID for the bed is not used. But if this is the problem it is also ok.

Sergey Taranenko

Please note: In this mode, on command M303 bed is not heated is this normal?

Mark Finn

If you are using M303 on the extruder, the bed and other extruders are turned off. This is because the autotune is in a tight loop, and regulation of other functions isn't performed. I didn't change this.

Sergey Taranenko

we know how to solve this problem.
whether the decision was made in the main code?

Sergey Taranenko setar referenced this issue from a commit in setar/Marlin_rf December 14, 2012
Sergey Taranenko fix BED_LIMIT_SWITCHING bug #267 c3ac3a3
daid daid closed this issue from a commit January 08, 2013
daid Fixed #345, Fixed #267. 8b88e3b
daid daid closed this in 8b88e3b January 08, 2013
Nicolas Rossi njprossi referenced this issue from a commit January 09, 2013
Commit has since been removed from the repository and is no longer available.
STB3 STB3 referenced this issue from a commit January 09, 2013
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.