SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
#200454
Hello guys,



I need to write a code for Arduino that controls the temperature of an oven by a certain way.The idea is that the temperature must increase for every 1 minute with 3 degrees and all of that by using a thermocouple, zero-cross detector and the MAX31855 sensor. The temperature increase begins from 20 degrees and when it reaches 200 degrees it must stop.
I will be very thankful if you can help me. I have wrote some code already by searching in the internet but
i'm struggling with the 3 degree part. Thanks one more time in advance.
#200509
Hi,

It's not that difficult, you just need to place a check in multiples of 3 , and after 3 hours you can increment a variable 1 time. If you could share your code then I can better help you out.

Thanks.
By lyndon
#200520
Assuming you already have code for basic temperature control, what you need to do is maintain a timer, and every 60 seconds, increase the setpoint by 3 degrees.
e.g.,
Code: Select all
int time = 0;
int setpoint = 20;

// Update loop every 0.1 seconds
const int TIME_INCREMENT = 100;
const int TIME_LIMIT = 20 * 60 * 10;
const int TEMP_LIMIT = 200;

while (time < TIME_LIMIT && setpoint <= TEMP_LIMIT)
{
  time += TIME_INCREMENT;
  if (timer % (60 * 1000) == 0)
  {
    setpoint += 3;
    // Assume your temperature control routine returns current temperature
    temp = controlTemperature(setpoint);
  }
}
...

At this point you can resume calling your temperature control routine periodically.
This should work. Untested, of course. If you want known good, working code, I write Arduino code as a service, in addition to on-demand assistance here: http://www.cedarlakeinstruments.com/blog/