controlling a mains-powered oven

Yeah, that's a pretty huge difference. Seems like you have it working pretty well. What are the units on the X axis, seconds?
The algorithm seems to work rather well. I'm curious though why it doesn't cycle on a more regular basis. It looks like it may actually be the characteristics of the oven. I can find a number of spots where the power is on for a longer period and the temperature actually drops for the first half of it, then finally rises, but to more than the set temperature. I suppose the heat circulation is chaotic. Or is there a level of noise in the temperature measurement? I see in the periods when the heater is on for an extended time there is a lot of noise.
Given that your control is only on/off, why do you feel the need for a PID controller? I would think just a simple measurement of the temperature compared to the set point would do a good job. The only thing I can think of that might improve the temperature profile would be to anticipate how much heat is in the heating element to limit overshoot. With your current PID controller, I expect the overshoot is due to the I term in the controller. If you eliminate that the only remaining overshoot will be from the thermal mass of the heating element. So an I term could be used to anticipate the heat in the element and added to the measured temperature (or subtracted from the set point) to allow for the ultimate rise in temperature. But all this would likely be icing on the cake (pun intended).
Clearly you have reached a point that optimizes the temperature control as much as will have an impact on the baking. I'm just curious about what is limiting the accuracy of control.
--

Rick
Reply to
rickman
Loading thread data ...
Mostly.
I'm only sampling the data every second - the PID control loop is running 10 times/sec.
It may also be that the stats. output is missing a lot of oven on/off cycles - they can be for as short a duration as 1/10 second while the stats. sampling is per second.
I've measured a few other things in there too - the lag from turning the heater on to seeing it on the thermocouples is 5 seconds - when the oven is empty. Stick a few kilos of water in it (in the form of bread, cakes, etc.) and things really slow down. You can also see in the graphs when I open & close the door - when closing, there is a spike then it falls again - I'm assuming the spike is take up by the fabric of the oven giving a boost to the heater before it runs out of capacity. My other ovens have a much greater storage heater effect, so when I get round to putting thermocouples in them, it'll be interesting to see how they actually cope when I throw 12Kg of dough into them...
When the oven is in a steady state - ie. with the power on, fan on, but heater off, the readings from the thermocouples are more or less constant. There is the possibility of electrical noise when the heater is on - but its just a resistive element, so hard to see how that could generate any - however it might be worth while sticking a scope on a thermocouple to see.
Running my monitor program now -
gordon @ beaky-pi$ sudo ./monitor 249, 252, 257, 0, 252, 0 249, 252, 257, 0, 252, 0 249, 252, 257, 0, 252, 0 249, 252, 257, 0, 252, 0 248, 252, 257, 0, 252, 0 248, 252, 257, 0, 252, 0 248, 252, 257, 0, 252, 0 247, 252, 257, 0, 252, 0 248, 252, 257, 0, 252, 0 248, 252, 257, 0, 252, 0 248, 252, 257, 0, 252, 0 248, 252, 257, 0, 252, 0 249, 252, 257, 0, 252, 0 248, 252, 257, 0, 252, 0 248, 252, 257, 0, 252, 0 249, 252, 257, 0, 252, 0 249, 252, 258, 0, 253, 0 249, 252, 258, 0, 253, 0 249, 252, 258, 0, 253, 0 249, 252, 258, 0, 253, 0 249, 252, 258, 0, 253, 0 250, 252, 258, 0, 253, 0 250, 252, 258, 0, 253, 0 250, 252, 257, 0, 253, 0 250, 252, 257, 0, 253, 0 250, 252, 257, 0, 253, 0 250, 252, 257, 0, 253, 0 249, 252, 257, 0, 252, 0 249, 252, 257, 0, 252, 0 249, 252, 257, 0, 252, 0
That's running at 10/sec. the first 3 columns are the thermocouples - the column of mostly 252's is the average of the 3 thermocouples. (All temp * 10°C)
Because I can.
I could treat the heater as a very slow PWM though - currently the minimum on period is 10th second, but I do wonder if the electrickery people would whinge about that..
It's also a test-bed for some other stuff I want to do. Next on the bakehouse front is a retarder/proofer... This is an insulated box that can be cooled down to about 4°C kept at a relatively high level of humidity and then at a set time heated up to about 28°C. This is to control bread dough development. I have the bits, just need to make the box.... And stick another Pi on it.
I have this vision of a Pi on every device in the bakehouse - including the mixers, but there's a limit to just how lazy you really want to be :-)
Which is what the mechanical one does. (although with more hysteresis than I think is good for it)
Indeed - I've run through some "quick & dirty" tuning, but proper tuning takes time. I'll do it one day, but its good enough for now.
I think its simply that its a cheap oven. The fan sucks air in from the cavity and sends it back into the cavity via a slit at the top and 4 vents that point downwards. (The bottom shelf is actually hotter than the top!) My suspicion is that this was just made up at the time without any air flow analysis - which would cost more money. This oven was £195. The ones they use in Bake-Off cost £1200 more and do have digital controllers...
Gordon
Reply to
Gordon Henderson
I'm not sure why you would run the two at different rates. Do you know why?
I seriously doubt your controller will have many cycles much faster than your temperature sample rate.
I think you are confusing lag time with rate of temperature change. The amount of thermal mass (the bread) will affect the rate of change of the oven temperature, but not much the lag time. I expect the lag time is mostly the few seconds it takes for the heating element to warm up once power is turned on. Even though electrical power is applied to the burner, it won't make significant heat in the oven until the element temperature has risen significantly above the oven temperature.
The temperature spikes you see on opening the oven door is because of the inrush of cool air cooling the thermocouple. Once the door is closed the air is heated quickly to the oven temperature.
I've never been convinced the oven temperature in the first few minutes matters so much. If the dough is cool, the delta temperature won't be so much different if the oven cools some trying to heat the bread. There is still a couple of hundred degrees difference. If the oven recovers in 5 or 10 minutes I expect it to have little impact on the bread while it is coming up to temperature itself. If your oven can't return to temperature after a few minutes, that's a different matter.
They seem pretty noise free.
Yes, this shows a keen insight to the nature of the PID algorithm... or maybe not. ;)
If you want to treat it as a PWM, then you need to PWM your output, not turning it on an off at relatively random periods. I am sure you can get better control of the temperature without the PID controller. The integral term of the PID controller creates overshoot and results in a ripple in the temperature.
As I said before, a simple on/off control based on temperature will give you great control. Overshoot from the thermal mass of the heating element can be reduced by using an anticipater term. Controlling the on/off burner state directly from the temperature will in effect give you PWM control of the burner much like the ADC in a sigma-delta converter.
Clearly the mechanical thermostat has more hysteresis than you want. Otherwise it is all you need to get optimal temperature control. PID is for controlling devices that have a range of settings, not so much for on/off devices like heaters. If you want to learn more about this aspect, try discussing this in sci.electronics.design. There are a lot of folks there with lots of controller experience including heaters.
Tuning the PID won't help much. It is just the wrong algorithm, or I should say, not the optimal algorithm. At least that is my experience.
--

Rick
Reply to
rickman
Yes. I wrote the program, so I know exactly why.
Gordon
Reply to
Gordon Henderson
Can you explain?
--

Rick
Reply to
rickman
Yes.
Gordon
Reply to
Gordon Henderson
Ok, if you decide you'd like to learn rather than obfuscate, I gave you the group where you can learn things.
--

Rick
Reply to
rickman
I suggest if you'd had less of the "aggressive know-all" attitude, he might have done so ...
Reply to
Andy Burns
Asking questions is "aggressive"?
--

Rick
Reply to
rickman
I got fed up with his aggressive know-all attitude a while back and plonked him.
Reply to
mm0fmf
That's how the tone felt, to me at least ...
Reply to
Andy Burns
I'm sorry about the tone. I'm trying to understand what the OP was trying to do, or more specifically what he though the PID controller would do for him. Not trying to be rude or ruffle anyone's feathers.
Printed words can come across very differently than when spoken. I don't always perceive the tone others do. Sorry.
--

Rick
Reply to
rickman
Yeah, that can happen, hopefully Gordon will return and give us some details after all ...
Reply to
Andy Burns
I've already told you why I'm using PID. It's because I can. Because it's there, and why not. Also consider this: Because it's fun. I do this for fun - I've spent over 30 years doing it for money and now I want some fun.
I also want good cakes and bread. Which I sell. For money.
Sourdough honey spelt, anyone?
formatting link

Gordon
Reply to
Gordon Henderson
Ok, so the PID is for fun. I get that I suppose. But you talk about trying to improve it and I don't get that when I expect it would work better with a simpler thermostat type controller. If you don't believe that is the case I would be interested in discussing it. If you just want to improve the PID controller for the fun of it, I guess I get that too. I'm thinking of building a high accuracy clock and not because I want to know what time it is.
--

Rick
Reply to
rickman
Details, details, details... It's all in the detail...
Now where were we... The program is multi-threaded. One thread reads the thermistors and provides a single temperature reading to the rest of the system. It also provides a means to get te 'raw' temperatures. This happens to be sampling the thermistors some 50 times/sec. There's a low-pass filter in there and code to check if any thermistor gets too far from the others. There is also optional "voting logic" code in there (to use 2 out of 3 thermistors), but it's not that good in this application. Just because I can more than anything else.
Another thread is the PID controller. This happens to run at 10Hz - mostly because I don't want to cycle the power more than 10 times/sec and the power control comes from the PID loop. I /could/ use a crude PWM on the power by running another thread to do that, but I don't feel its worth it. For now.
Yet another thread logs the data to a file. This thread only runs once a second. I have enough data as it is without looking for more. Hobby project and all that, you know?
Right now it's a small C program, command-line driven. I want to re-code it in my BASIC so I can have a nice display and control widgets on a little 5" HDMI display and touchscreen thingy I have, but hobby project and all that... Besides, RTB doesn't support threads yet, but co-routines are on the horizon...
So all in all, to go back to the original author of this thread; Yes, controling a domestic oven with a Pi is fesable. Relatively economical too - well. FSVO... Under £100 will get you a Pi, one thermistor + amp breakout board, an SSR, PSU and Wi-Fi dongle. (I recall the OP was looking at £200 for a new controller - more than the cost of my oven!)
Gordon
Reply to
Gordon Henderson
I have a Pi connected to a radioclock:
gordon @ pi0: ntpq ntpq> rl associd=0 status=0415 leap_none, sync_uhf_radio, 1 event, clock_sync, version="ntpd 4.2.6p5@1.2349-o Fri May 18 20:30:57 UTC 2012 (1)", processor="armv6l", system="Linux/3.12.29+", leap=00, stratum=1, precision=-20, rootdelay=0.000, rootdisp=4.322, refid=MSF, reftime=d9fcaa51.307ec454 Sun, Nov 22 2015 20:55:45.189, clock=d9fcaa6f.640c49cc Sun, Nov 22 2015 20:56:15.390, peer=3803, tc=6, mintc=3, offset=-0.437, frequency=-47.665, sys_jitter=2.646, clk_jitter=0.570, clk_wander=0.029
Good enough for me.
Gordon
Reply to
Gordon Henderson
I mean a mechanical clock. There are mechanical clocks that run more accurately than the typical digital watch.
--

Rick
Reply to
rickman
That has a mechanical crystal inside it.
--
the biggest threat to humanity comes from socialism, which has utterly  
diverted our attention away from what really matters to our existential  
 Click to see the full signature
Reply to
The Natural Philosopher
Gordon Henderson wrote on 22 Nov:
That was me. Thanks for all that experience. Current state of play here is: (a) wife wants an oven she can depend on for Christmas; her campaign to scrap the oven and buy a new one is heating up (b) I'm looking at existing oven's relays and thermo-probes, considering what components I can retain to be controlled by a Pi. Managed to get a wiring diagram today from the manufacturer (which is De Dietrich, whose UK affiliate went bust a year or two ago; I learned today that a new UK distributor stepped in only recently).
--
Jim Nagel                        www.archivemag.co.uk 
>> "from" address is genuine but will change.  website has current one.
Reply to
Jim Nagel

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.