Nelson_Pelson:
Thanks for al the answers so far!
So even solid state relays can't handle that speed?
I would use a 500W and a 1000W element (so i might have to incorporate some coding for that too).
My idea was indeed to use a PID to regulate the heating. (I'm still reading up on it more cause I'm not a 100% up to speed with it yet, so forgive any mistakes regarding PID).
So if I get it the consensus would be to use PID with a Kd that is not zero, and write my own PWM-code to create a 1 second interval or something? (Or would say, 10Hz be too much still?)
Is there any other way you can control the output of a 500W heating element?
(another idea I had was to use a gas heater for my purpose and install a stepper motor and a Hall-effect sensor to control the gasflow... but that's a whole other story)
Thanks you!
As I said before, the PID_RelayOutput example seems to suit your project exactly.
/********************************************************
* PID RelayOutput Example
* Same as basic example, except that this time, the output
* is going to a digital pin which (we presume) is controlling
* a relay. the pid is designed to Output an analog value,
* but the relay can only be On/Off.
*
* to connect them together we use "time proportioning
* control" it's essentially a really slow version of PWM.
* first we decide on a window size (5000mS say.) we then
* set the pid to adjust its output between 0 and that window
* size. lastly, we add some logic that translates the PID
* output into "Relay On Time" with the remainder of the
* window being "Relay Off Time"
********************************************************/
#include <PID_v1.h>
#define RelayPin 6
//Define Variables we'll be connecting to
double Setpoint, Input, Output;
//Specify the links and initial tuning parameters
PID myPID(&Input, &Output, &Setpoint,2,5,1, DIRECT);
int WindowSize = 5000;
unsigned long windowStartTime;
void setup()
{
windowStartTime = millis();
//initialize the variables we're linked to
Setpoint = 100;
//tell the PID to range between 0 and the full window size
myPID.SetOutputLimits(0, WindowSize);
//turn the PID on
myPID.SetMode(AUTOMATIC);
}
void loop()
{
Input = analogRead(0);
myPID.Compute();
/************************************************
* turn the output pin on/off based on pid output
************************************************/
if(millis() - windowStartTime>WindowSize)
{ //time to shift the Relay Window
windowStartTime += WindowSize;
}
if(Output < millis() - windowStartTime) digitalWrite(RelayPin,HIGH);
else digitalWrite(RelayPin,LOW);
}
And something like one of these relays for the element. This one is way over rated for your proposed 1500w but you get the idea.