Smart Hob by Alex Ross-Martin & Chris Cobb

Overview:

Many houses use electric hobs, these are quite inefficient and waste a lot of energy by over-heating and then stay hot for a long time after being switched off. They are present in 31% (Gov Report 9: Domestic appliances, cooking &
cooling equipment) of homes all over the uk and so a small energy saving would equate to big net savings.

On of the inherent inefficiency of the hob when it is being carefully used, a large amount of energy is wasted by users who are not using their hobs properly, such as boiling over or maintaining a temp that is above what is needed.

Project Aim:

To produce a device capable of monitoring and controlling the temperature of a hob to ensure that it is operating at its most efficiently. As well as the sustainability benefits, it should enhance the users cooking experience and be easy to use.

Research:

Stats:

The average house uses 1.5kwh per day cooking.

How much energy does it take to boil 1 litre of water on the hob?

Our experiments showed that bringing a pan of water to the boil over 10 minutes used 0.2Kwh.

Additionally we found that after bringing water to a boil, we could continue to boil water for 4 minutes after switching it off due to the retained heat in the ring.

How will our project help users?

Evidence shows that telling people alone is not enough to make them change their habits, that is why our project will aim to automatically improve energy usage without the user having to do anything. Additionally it should make the cooking process easier which will encourage them to use it.

Components:

-Arduino R3 Uno

-DS18B20 waterproof temperature sensor

-Max6675 breakout board

-K type thermocouple

-LCD display

-i2c board for LCD

-Buttons

-240v relay (5v input)

Using sensors to plot temperature

Our first step was using both our sensors to read the temperature of the hob and the water.

IMG_20180409_173821

Both sensors use their own libraries to convert data to a useable format, you need to use the correct functions to call the data from the sensors in order to use it.

Hob&water1

Once we had both sensors working together we could easily record the temps on the serial plotter like this.

Relay control of the hob

hot plate guts

This hob is very simple, having essentially only on/off switches. This meant we could control it using a relay inline in the positive feed.

Simple on or off relay control is as simple as writing pins high or low, but for more accurate control “time proportioning control” is used, this is where a window of maximum on time is created, then the relay can be turned on for a proportional of that window equivalent to the desired output.

ie if 50% power is required relay is on for 1/2 the window.

This system is very easy to set up and can be good for use with relays due to the fact it doesn’t produce excessive switching.

Control system

The bulk of this project has been spent on understanding and applying control to the hob. We started with a very simple “bang-bang” control, however this proved completely unusable due to the large thermal lag in the system.

We needed something better, hence we started investigating PID control.

This highly tuneable method is an industry standard for maintaining tight control over closed-loop systems. It uses 3 terms to compute the output needed to get a measured variable to a set value and keep it there, the first is proportion, which means increasing the output in proportion to the gap (error) between the measued and desired variables. It also takes account of the previous errors in the integral term and uses these to try to address consistent errors, this makes it adaptive to change in the system. The final term is the differential, which tries to predict what the next error will be based on how the error is changing, this can be used to make the system react quickly to upsets.

Writing an entire controller from scratch would be time consuming, luckily there is an arduino library available for the job. However implementing the library is not the easiest task, it requires careful tuning and a good knowledge of the underlying system.

https://create.arduino.cc/editor/AlexRossMartin/87a0c311-3678-44ac-bf07-eadfa69ec2b1/preview?embed

After several hours attempting to tune it, the controller was only able to be kept within 15* of the setpoint. However this could be improved with additional tuning time.

The user inteface

A key part of the project has been trying to add benefit to the user experience of cooking on the hob. Inspiration came from the simple interface on a microwave, where an lcd displays time and input is given by buttons.

IMG_20180419_151759[1]

Bringing it all together

The final version contains 2 sequential PID controllers, setup to feed into one another. Using this method, the stabilisation temperature of the water was improved significantly, now being stable to within a few degrees.

https://create.arduino.cc/editor/AlexRossMartin/f4c363ca-7c6d-43a6-a0f7-c628da934096/preview?embed

updated code, 23/04/2018:

https://create.arduino.cc/editor/AlexRossMartin/df786638-a882-4350-b65a-650b23975ed3/preview?embed

IMG_20180419_153307[1].jpg

Conclusion

In conclusion, this project has demonstrated the use of PID control to reduce the energy consumption of a hob.

With some careful tuning it could have a very good impact on reducing as well as benefiting the cooking experience.

Continuing from PID

Foreword:

After our previous work on PID control of the hob, despite the challenges of tuning we decided to press on with development of the code.

I decided to experiment with my earlier idea of using sequential PID controllers to better regulate the temp. I also made the effort to re-organise some of the code and group it into individual functions.

https://create.arduino.cc/editor/AlexRossMartin/539598fa-0b47-4f4e-92b3-f5a210f0255b/preview?embed

Despite the ropey tuning, this version was surprisingly stable. I think due to the thermal capacitance of the water. I feel confident that with better tuning it could do a reasonable job!

 

Now that we had some semblance of a working controller, we had to add the extra functionality which would make it into a consumer product.

These functions are:

  • LCD display showing temps and cooking time.
  • Buttons for adding cooking time.

I decided to start on adding the buttons, they are simple enough to wire up, we have them switching the signal to low.

buttons

Luckily I had already written a sketch for a descending timer, for use with some earlier code. It allows users to input a time in 30 second increments and will proceed to run the desired main loop function once no button has been pressed for 30 seconds.

Combining:

Next was combing this with the code I had already written for controlling the hob.

https://create.arduino.cc/editor/AlexRossMartin/e82a0180-8ab1-4218-b602-78520436eab5/preview?embed

My first attempt was just adding the two together without causing any errors, which was easy enough.

Next up I added some actual functionality to the timer as well as including a function which converts time in millis to an output in hh:mm:ss.

https://create.arduino.cc/editor/AlexRossMartin/2e81abf7-3f96-4d4d-b9bb-7b2f5952d469/preview?embed

I took this video showing the timer in action.

LCD screen:

In order to save space on the arduino, we decided to use the i2c bus. Coding it all in was pretty straight forward. I also made a few adjustments to the organisation of the code.

LCD

https://create.arduino.cc/editor/AlexRossMartin/f4c363ca-7c6d-43a6-a0f7-c628da934096/preview?embed

 

Video in action:

 

 

 

Conclusion:

We are pretty pleased with the amount we have managed over the last week, the controllers will definitely need to tuning and i would like to add more functionality if possible, particularly including the cooling rate estimator from earlier in the project.

 

I think due to the poor tuning it will be difficult to quantify the sustainable benefits, It is clear that a well tuned PID controller would reduce the energy consumption of the hob, since it would not over shoot the desired temp.

 

Alex&Chris

Datasheets

open-uri20160601-21382-59magl

SONGLE Single Relay Module for Arduino

  • Type: SPDT (Singe Pole Double Throw)
  • Coil Voltage: 5VDC
  • Contact Rating: 10A 250VAC/10A 125VAC/10A 30VDC

DATASHEET

http://elecfreaks.com/store/download/datasheet/breakout/Relay/SRD(T73).pdfSRD(T73)

http://elecfreaks.com/store/download/datasheet/breakout/Relay/SRD(T73).pdf

3 Pin design requires 5V supply, Ground and a signal pulled to HIGH for switching. A clue to whether this type of relay is working or not is that the switch is audible.

MAX6675 THERMOCOUPLE

MODULE-WITH-K-TYPE-THERMOCOUPLE-SENSOR-MAX6675-FULL-VIEW-TOP-300x300

DATASHEET

http://henrysbench.capnfatz.com/wp-content/uploads/2015/05/MAX6675-Datasheet.pdf

These pins function as follows:

SO: The module’s serial output.   Your Arduino will read this output.

CS:  Chip Select.   Setting low, selects the Module and tells it to supply an output that is synchronize with a clock

SCK : The Serial Clock… an input from your Arduino.

VCC: 5V supply

GND:  Ground.

– (or Minus):   The K thermocouple minus input.

+ ( or Plus):  The K Thermocouple plus input.

IMPORTANT NOTE– Most K thermocouples come with a red lead and a yellow lead.  The red lead is normally your negative connection and the yellow lead is your positive.  That is industry standard.

That said, some of the suppliers for the module are different, and will provide you a thermocouple with red indicating positive.

The way to know is if you increase the temperature at the thermocouple tip, and the indication goes lower. (Henry’s bench, 2017)

thermocouple-seebeck-effect

Artwork: The basic idea of a thermocouple: two dissimilar metals (gray curves) are joined together at their two ends. If one end of the thermocouple is placed on something hot (the hot junction) and the other end on something cold (the cold junction), a voltage (potential difference) develops. You can measure it by placing a voltmeter (V) across the two junctions. (Explainstuff, 2018)

DS18B20 One Wire Thermometer

Datasheet

https://datasheets.maximintegrated.com/en/ds/DS18B20.pdf

 

Explainstuff, 2018. Thermocuples. [online] Available at: <http://www.explainthatstuff.com/howthermocoupleswork.html&gt; [Accessed 12 April 2018].
Henry’s Bench, 2017. MAX6675 Temp module arduino manual and tutorial. [online] Available at: <http://www.library.nhs.uk/guidelinesFinder> [Accessed 12 April 2018].

 

 

Project change

DIRECTION CHANGE 

Though it is not recommended to ‘give up’ on any project, it is worth recognizing time constraints, the learning requirements of a brief, and when to cut your losses.

After buying two HC-05 bluetooth modules with the intention of pairing them, for the communication of our fitness tracker, we found the datasheet https://exploreembedded.com/wiki/images/a/a5/HC_05_Core_Datasheet.pdf and then ran through the following online tutorials for the module:

http://www.instructables.com/id/Arduino-AND-Bluetooth-HC-05-Connecting-easily/

http://www.instructables.com/id/Remotely-Control-LED-using-HC-05-Bluetooth-Arduino/

http://exploreembedded.com/wiki/Setting_up_Bluetooth_HC-05_with_Arduino

https://create.arduino.cc/projecthub/user206876468/arduino-bluetooth-basic-tutorial-d8b737

http://www.martyncurrey.com/arduino-with-hc-05-bluetooth-module-in-slave-mode/

We had the best results with the last site, and each website details their own success with their particular version of the module. All have several comments relaying others success, despite this, we had no luck pairing the the modules ourselves. This shows there is variation in the modules, what works for one does not necessarily work for all.

 

A Smart Pan Project

 

Intro

The suggestion for the project is to investigate the potential savings to be made from creating a smart sauce pan, to optimise electric hotplates and hobs. We began by purchasing a MAX6675 Thermocouple and a cheap hotplate. We already had a 5V relay module rated 240V @ 7Amps. Below is a photo showing the inside of the hotplate. There is a power supply, thermal fuse, and a basic thermostatic switch. Our 5V relay module is wired inline of the power supply, making sure to isolate it from any metal casing. The thermocouple has been screwed through the supporting chassis, so that it is in contact with the underside of the heating element.

hot plate guts.jpg

The initial plan is to map the cooling rate of the heating element to see if the residual heat when the power is off is usable, and to what degree.

Experiment Setup

Experiment Board_bb

Continuing from bang-bang.

Foreword:

At the conclusion of the last post we had slightly given up hope on developing a really robust solution to our control problem.

we went back to the drawing board and decided to compare directly the hob and water temps whilst under human control.

Using the following code and outputting to the serial monitor, we plotted these graphs.

https://create.arduino.cc/editor/AlexRossMartin/862a54f6-5dfb-4814-b627-4cfa38ffa96f/preview?embed

As you can see the gradient at which the temp increases is pretty linear. This is good because it means the rate can be predicted.

We then decided to turn the hob off and observe the ramping down, here our original hypothesis was proven to be right! After turning the hob off at temp of ~160* and water temp of 98* (an aggressive boil), we got 4 more minutes of sustained boiling before making the judgement that although the water was still bubbling, it did not qualify as  rolling boil. We observed that the temp of the hob when this happened was around 130*.

Next:

We now assume that 135* is enough to sustain a boil in the water, we should now be able to simplify our model to running a closed loop PID controller which only monitors the hob temp and infer that a stable hob temp of 135* will be enough to maintain the boil.

I began by downloading the arduino PID library, which has taken care of the complex mathematical side of things and leaves the tuning and implementation.

https://create.arduino.cc/editor/AlexRossMartin/99728b40-9a1d-418a-8e2a-31752cc6f1f5/preview?embed

This is the example code for using the PID library to control a relay.

I had to edit it to make use of our max6675 thermocouple.

https://create.arduino.cc/editor/AlexRossMartin/87a0c311-3678-44ac-bf07-eadfa69ec2b1/preview?embed

Once we did this and uploaded the code we found a strange issue…

we needed to examine the serial plotter to have ago at tuning the PID, however when we opened it we found that the sensor reading was stuck at one value. First we thought that there must be something wrong with our variables, meaning a new value was not getting written to the value but we double checked the code and were pretty sure this was not the case. We then realised that everytime you closed the serial monitor and opened it again, it was stuck at a different value.

We went back and checked the data sheets and discovered that the max6675 takes 0.22 seconds to calculate it’s new values and our loop function was cycling much faster than that. After this we added a sensor refresh statement to the code which fixed the problem.

First run:

now that our PID control was working we had a first run.

PID control 1st run

It is some way off being stable, but that is to be expected given that we are using arbitary tuning values. We will have a go at tuning it next but first…

Hardware lag:

We have been facing consistent problems with lag in the system, which makes control difficult. We had assumed that our system was in 2 layers, the hob plate itself and then the water/pan, but whilst working today we noticed through a gap in the hob that the heating element itself is completely seperate and the gap between them is responsible for the continued increase of the hob even after we have turned the element off.

We believed that our placement of the sensor in direct contact with the hob plate was giving us an accurate reading of the input temp to the system but that is clearly not the case. We will relocate the sensor much closer to the heating element and that should help make control easier.

 

 

 

 

 

Tuning:

After the hardware adjustment I had a go at tuning the PID controller, based on what I read here.

Initially I set the gains for the integral and derivative functions to 0, effectively turning them off.

After several hours of slaving, I managed to get it oscillate around the set point by around 15*. The values i used were kp =128, ki = 0.1, kd = 2.

At this point I decided to give up on calibrating further and try to progress with the code.

Alex & Chris

week 4: Bang bang controller

Foreword:

Following on from our observations that the pan of water would maintain a steady rolling boil if the hob was at 135* we decided to try to build a simple “bang bang controller” to do that.

What is that?

In control theory, a bang–bang controller otherwise known as 2 step or on–off controller, also known as a hysteresis controller, is a feedback controller that switches abruptly between two states.  They are often used to control something that accepts a binary input, for example a furnace that is either completely on or completely off. Most common residential thermostats are bang–bang controllers.

A water heater that maintains desired temperature by turning the applied power on and off (as opposed to continuously varying electrical voltage or current) based on temperature feedback is an example application of bang–bang control. Although the applied power switches from one discrete state to another, the water temperature will remain relatively constant due to the slow nature of temperature changes in materials. Hence, the regulated temperature is like a sliding mode of the variable structure system setup by the bang–bang controller.

Symbol for a bang-bang control
IMG_20180417_213638.jpg

Application:

In our temperature control system, the most simple application of a bang-bang control is simply 2 cases: if the temp is below the target temp, switch the hob on; if the temp is above it, switch it off.

This can be described by a quick if statement:

https://create.arduino.cc/editor/AlexRossMartin/96b2197e-b7c7-4b12-871b-f9758dc8a61c/preview?embed

Bangbang1bangbang2bangbang3

This is the code as simplified as possible and as you can see from this graph it doesn’t do a very good job of controlling the temp. The switching produces an alternating massive overshoot above and below the target, it overshot the target temp of 100* by almost 40*.

This highlights a key problem with simple controllers like this, which is they don’t cope well with lag. They can be quite effective in a system where the control acts immediately but since our entire project revolves around the fact that there is heat lag in the hob it will not be as effective.

That is not to say that a bang-bang controller can be completely ineffective, because if you are using a completely closed system then the lag should be consistent and you will be able to introduce some parameters to tune it out. This is the case in hot water boilers, which use a fixed element and volume of water.

What next?

Next we have a choice, do we stick with a simple on/off controller and try to add some more complexity to get it to be more stable or move to a PID controller which ought to be better but will be substantially more complicated and therefore much easier to make errors in the code.

Well what is a PID controller?

proportional–integral–derivative controller (PID controller or three term controller) is a control loop feedback mechanism widely used in industrial control systems and a variety of other applications requiring continuously modulated control. A PID controller continuously calculates an error value e(t) as the difference between a desired setpoint (SP) and a measured process variable (PV) and applies a correction based on proportional, integral, and derivative terms (denoted PI, and D respectively) which give the controller its name.

In practical terms it automatically applies accurate and responsive correction to a control function. An everyday example is the cruise control on a road vehicle; where external influences such as gradients would cause speed changes, and the driver has the ability to alter the desired set speed. The PID algorithm restores the actual speed to the desired speed in the optimum way, without delay or overshoot, by controlling the power output of the vehicle’s engine.

The first theoretical analysis and practical application was in the field of automatic steering systems for ships, developed from the early 1920s onwards. It was then used for automatic process control in manufacturing industry, where it was widely implemented in pneumatic, and then electronic, controllers. Today there is universal use of the PID concept in applications requiring accurate and optimised automatic control.

IMG_20180417_213646.jpg

 

  • Term P is proportional to the current value of the SP − PV error e(t). For example, if the error is large and positive, the control output will be proportionately large and positive, taking into account the gain factor “K”. Using proportional control alone in a process with compensation such as temperature control, will result in an error between the setpoint and the actual process value, because it requires an error to generate the proportional response. If there is no error, there is no corrective response.

 

  • Term I accounts for past values of the SP − PV error and integrates them over time to produce the I term. For example, if there is a residual SP − PV error after the application of proportional control, the integral term seeks to eliminate the residual error by adding a control effect due to the historic cumulative value of the error. When the error is eliminated, the integral term will cease to grow. This will result in the proportional effect diminishing as the error decreases, but this is compensated for by the growing integral effect.

 

  • Term D is a best estimate of the future trend of the SP − PV error, based on its current rate of change. It is sometimes called “anticipatory control”, as it is effectively seeking to reduce the effect of the SP − PV error by exerting a control influence generated by the rate of error change. The more rapid the change, the greater the controlling or dampening effect.

 

The controller does not require all terms to work well, you can use only the P, the PI or the full PID. Each layer should give you better and better control, however due to the fact that the controller will need tuning, it may be more difficult to make it stable the more terms that are added.

Examples

With PID controllers in mind, we began browsing online to see if there were any examples we could use.

As it turned out, we found multiple examples of arduino powered sous vide builds which were producing very similiar functionality to what we were looking for.

Ada-fruit sous viduino.

I then found this example which claimed to be self-tuning, so I had a go with it.

code here:

https://create.arduino.cc/editor/AlexRossMartin/4df2ef43-79ea-4623-bc70-588591704178/preview?embed

After editing the code to fix the target  temp at 90* and add some extra serial monitoring, we could run the code and get it to maintain the water to +-5*c.

However this is not good enough for maintaining a rolling boil and the code was far too complex to make any serious adjustments to. None the less I was able to spend some time getting to understand the majority of the functions in the code and dealing with such a long piece of code taught me a few lessons about good lay out and making code easy to understand.

I believe that the reason this code could not stabilise the temperature was due to the measuring system we were using, it was set up to measure the water temp directly using a ds18b20, which we also used. However our system also had an element which was not being measured, the hob plate itself, this was acting as a thermal capacitor, meaning the controller did not have direct control of the water temp, it had to go through the hob plate. Thus depending on the hob plate’s current temp the control system would have to apply a different amount of heat to get the same change in water temp.

Conclusion:

At this stage in the project, we realized that we would need to take account of both water temp and hob temp to successfully maintain a boil. I drew this diagram describing an ideal system of control.

IMG_20180417_233047[1].jpg

It describes a system of sequential PID controllers where the output of the first is used as the set point for the second.

Unfortunately…

It is too late in the project to attempt to resolve that level of detail. We went back to the drawing board…

to be continued…

2: Electric hob heat wastage device

Foreword:

Our new concept was a way to take advantage of the residual heat from electric hobs and use it our advantage. In order to do this we had to figure out a way to estimate the rate that it was cooling.

The maths:

In order to estimate cooling rate, I used this equation which describes exponential cooling.

IMG_20180416_212154

I converted that equation into code, which used the two sensors we had available to take readings.

https://create.arduino.cc/editor/AlexRossMartin/3739fec9-9a1d-482f-a8b3-9815bf4a4e94/preview?embed

The problems I had with the code early on were small teething problems, where i wrongly defined variables and tried to do calculations with different types.

I also didn’t know how to print time in hour.minute.second format, but was able to find an example online which I put in.

The circuit:

IMG_20180409_115021

Cooling rate calculator_bb

Here is the code in action, as you can see it calculated that the hob would take 2.30 to cool by 20%. This means that you could turn the hob off early and maintain enough temp to keep cooking, thereby reducing your energy consumption.

IMG_20180409_122023

IMG_20180409_173821

I think this demonstration has showed that there is potential in the idea, next up we will try to give some kind of control to the arduino so that it can maximise efficiency of the hob.

 

Alex & Chris

Week 3: Measuring energy usage of a hob

In order to quantify the effect of our project on electricity consumption, we needed to establish a base line.

Although the project would ideally be built in to a 4 ring home hob, this is not practical for prototyping, therefore we decided to use a small single ring electric hotplate for now. Since it has a mains plug that makes it extra easy to measure its consumption by using a plug in power monitor.

To establish a baseline I will boil water for 10 minutes from a cold start. To make the test repeatable, I will measure exactly 1 litre of water, use the same pan and begin the clock from the moment I turn it on. I will also measure the start temp of the water as well as the ambient air temperature.

IMG_20180416_181604

The experiment will be carried out as followed:

  • Ensure power meter is zeroed.
  • Fill pan with 1 litre of tap water.
  • Measure water temp.
  • Measure ambient temp.
  • Begin timer.
  • Turn hob to max setting.
  • When water is visually observed to be boiling, turn down to medium heat.
  • As soon as timer reaches 10 minutes unplug the hob.
  • Read values from power meter.

This should be a close representation of typical usage and give us an idea of the energy savings we can make.

The results are in! The 10 minute on time used 0.2 KWh. It only actually reached a boil after about 7 minutes, so was on constantly during that time.

 

Inside the hob we are using the switch looks like this:

IMG_20180411_163115

It is about the cheapest possible thermostatic switch, it uses to layers of metal (the spring like bit) when this is heated the different thermal expansion properties of the parts mean that it changes shape and causes the switch to open. the white plastic boss is moved inwards by the knob and applies varying amounts of pre-load to the spring and by this method the temperature can be adjusted.

 

This switch is very reliable but not super precise and doesn’t give the user any accurate control over the temperature.

We are anticipating that we should be able to improve both the efficiency and usability of the hob by controlling it electronically.

Further Experiments:

We also wanted to find out how well we could estimate whether or not water was boiling by monitoring its temperature in different locations.

 

Earn Your Energy

After researching available Bluetooth modules, I discovered there are a few things to consider. Bluetooth operates using a communication setup, where a module is either listed as a master, or a slave. Some can be set as either, which has obvious benefits.

Bluetooth networks (commonly referred to as piconets) use a master/slave model to control when and where devices can send data. In this model, a single master device can be connected to up to seven different slave devices. Any slave device in the piconet can only be connected to a single master. (Sparkfun, 2018)

5216816c757b7f1f668b4567

(Sparkfun b, 2018)

 

Further reading reviews of modules on the market highlighted the HC-05 as an accessible, readily available and relatively cheap option. It also has the option to function as either master or slave.  I have ordered two of these modules to start approaching the necessary communication aspect of this product.

Sparkfun, 2018. Bluetooth basics. [Online] Available at: <https://learn.sparkfun.com/tutorials/bluetooth-basics/how-bluetooth-works>%5BAccessed 18 March 2018].

Sparkfun b, 2018 (jimbo).Examples of Bluetooth master/slave piconet topologies . [Image online] Available at: <https://learn.sparkfun.com/bluetooth-basics/how-bluetooth-works>%5BAccessed 18 March 2018].