Bang-banging your way to a perfect cake

bang-bang-oven-control

[Rob Spanton’s] house is equipped with a rather cheap oven, which was discovered while his roommate tried using it to bake part of a wedding cake. If someone took a shower during the baking process, a large portion of unit’s gas pressure was diverted to the boiler, causing the oven to shut off completely. This is obviously not a good situation for baking cakes, so the housemates decided to construct a makeshift controller to keep temperatures in line.

They started by installing a pulley on the oven’s knob, which is connected to a small motor via a long rubber belt. The other end of the belt connects to a small motor, which is controlled by a Pololu 18v7 motor controller. A K-type thermocouple monitors the oven’s temp, feeding the data through a MAX6675 converter to (presumably) [Rob's] computer.

Since they were in a bit of a time crunch, [Rob] and his roommate [Johannes] decided the best way to keep the oven at a steady temperature was via bang-bang control. While you might imagine that cranking the gas knob between its minimum and maximum settings repeatedly wouldn’t be the ideal way to go about things, their solution worked pretty well. The cake came out perfectly, and the maximum temperature swing throughout the entire baking process was only 11.5°C – which is pretty reasonable considering the setup.

Comments

  1. Ben says:

    Cranking the gas knob between minimum and maximum is exactly how oven thermostats do it, and that amount of swing is pretty much the best you could hope for without a much more complicated control strategy. Well done!

  2. signal7 says:

    Innovative, yes. The right solution? Probably not.

    After having had a plumber work on the gas piping in my own house, I learned a few things. Sometimes home owners elect to do their own gas plumbing and they don’t always know the correct size of pipe to use to feed multiple appliances. I had to have a section of pipe replaced because it wasn’t sized correctly to run both the stove and my clothes dryer. I’d bet that the oven isn’t to blame here – you likely need to fix your gas plumbing instead.

    • Chris says:

      Agreed, there’s a gas line issue.

      But great job on a temporary solution!

    • Right... says:

      Agreed. Fixing the gas line is the way to go. After working on my own gas lines I can attest that it is a relatively easy fix. For me the hardest part was getting the gas line shut off which required chiseling away at several layers of paint.

      Once the gas is off you just vent the line at the stove and burn off the gas, unthread everything, make your repair, apply pipe dope, and thread everything back together. After turning the gas back on be sure to check for leaks with soapy water. There’s really nothing to it.

      I like to wrap my pipe wrenches with electrical tape to help prevent them from scarring up my pipes.

    • Brad says:

      The article doesn’t mention specifically, but if this house is a rental, then fixing the gas lines may not be an option for the tenant or an option the owner is interested in. If that is the case, I would say this is a wholly appropriate solution. One concern might be wear on the valve (depending on how often the system is moving/adjusting), but it’s probably a cheaper replacement than getting the gas lines properly sized.

  3. Andee says:

    Slightly pointless comment, but I have the same oven!

  4. Hackerspacer says:

    The cake came out perfectly, and the maximum temperature swing throughout the entire baking process was only 11.5°C.

    Unfortunately, the maximum swing in the internal and external temperature of their house was 500°C.

  5. Ren says:

    Soooo….

    How does this compensate for the hot water heater shutting the oven off?

    I mean, it’s great that it controls the oven temp so well (50 degree swings are common), but if the water heater causes a dip in the pressure, why would turning the oven up higher or lower compensate and STILL maintain temperature?

    • Chris says:

      @ren
      On gas-only stoves (IE no electronic controls), the “temperature” control is actually a valve with variable restriction. This helps overcome the problem of another device taking all the gas pressure from the line by removing all restriction to the flow of gas in the oven. On a gas stove with electronic controls, this hack is basically built in, as they either are cranked up to full heat, and overshoot their setpoint, or the burner is either turned off or down to just the pilot light (depending on if it uses an electronic igniter) to allow the oven to cool to below the setpoint.

    • dan says:

      ummm, well that’s actually quite simple/

      oven temp ranges from 60 – 220 degrees C
      cakes generally cook at 180 or lower.

      So when they shower is on, gas pressure reduces and less flows, hence the temperature drops, this is compensated by opening the valve more, (e.g setting the over to 220 degrees, which due to reduced pressure in the main line is now actually still only 180.)

      it won’t help achieve temperatures higher than the maximum setting on the oven

  6. swighton says:

    That big knob to vary the gas flow is begging for something with a bit more finesse. I see they’re using python to implement the ON-OFF control system. A PID (or even just P or PI or PD etc) could be implemented with just a few lines of code in python.

    1. Take the temperature delta (setpoint – current)
    2. Use 5 point stencil or the like to get the derivative.
    3. Use a cumulative Riemann sum to approximate the integral.
    4. Sum the delta, the derivative, and the integral together (with scaling coefficients) to get your control signal.

    http://en.wikipedia.org/wiki/PID_controller

    Thought it probably wouldn’t work in a pinch because you would have to do testing to dial in the PI & D coefficients.

    • cmholm says:

      Damn, you beat me to it. The subsequent HAD OpenPID post led me to the designer’s “What is PID” page, which provides a couple of nice plots demonstrating the practical difference between what Mr. Spanton did v. what was possible with a PID controller.

    • Rob Spanton says:

      Hi,

      The reason it’s not a PID controller is that it did not need to be a PID controller. Bang-bang control worked. As I noted in my blog post, time was short, so we didn’t have time to fit a rotary sensor to the dial, which would have been necessary to implement a PID controller.

      Keep it simple ;)

      Cheers,

      Rob

    • Tony says:

      Nice in theory, but a PID can’t guess when someone is going to take a shower. Autotune that!

      Simple PIDs are only $20 on eBay anyway, I replaced a defective oven thermostat with one yesterday. I’m not using the oven for cooking so the clunky ‘set temperature’ method most PIDs have isn’t an issue.

  7. Evolving dog says:

    Way too much time on their hands. Might scheduling their showers have worked? Some things just beg not to be done.

    “Perfection of means and confusion of goals seem to characterize our age.” – Albert Einstein

  8. Slipster says:

    Rube Goldberg

  9. xrayspex says:

    The point wasn’t to bake a cake, the point was to do something kinda cool just because they could. I’d say they accomplished that.

    The simplest solution would have been to turn off the water heater while baking, of course, but there isn’t much finesse in that.

    • bronk says:

      If it’s a multi-tenant apartment building, they very likely have no access to the water heater. Also, other tenants’ showers could trigger the problem so perhaps it’s not enough to prohibit showers during cake baking time =)

      Either way, there are multiple ways to solve a problem, but this is a great unconventional method that made me smile, a very pure hack.

      If they had fixed it the “obvious” way (repairing the gas pipe throughput, it wouldn’t be posted here, would it…

    • Slipster says:

      I’ll agree. Very much “Shotgun to kill a mosquito” approach but it worked.

      Cool hack.

  10. ejonesss says:

    another way that may work is to install a large tank to act as a buffer inline between the oven/stove and the gas line coming in and a one way valve to prevent the pressure from going back out.

    then again that may not be allowed by city code.

  11. Hirudinea says:

    Add a timer so you can have a hot supper when you get home, or connect the system to the net and start it yourself.

  12. F4R4D4Y says:

    I can only think of this;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 96,692 other followers