A Smart Burn and Spill Proof “SAFE” Microwave that spares the Salad: Novel
Application of Levenberg-Marquardt Algorithms in Bayesian Analysis for Real-
Time Numerical Thermodynamic Modeling
By Muhammad Shahir Rahman
Problem Statements
• The use of heat is essential in household applications
• Many cooking apparatus, such as a microwave and oven are not intelligent and can often cause fires
• In fact, 42% of household fires are caused by cooking devices
• The goal is to create an intelligent microwave that can cook food to the correct adaptable target temperature profile with minimal user input.
Intelligent Microwave
The internet connected computer sends data to the user wirelessly
IOT solutions provide remote control and full telemetry. The user is able to set the target temperature to his/her own preferences
A thermopile sensor array at the top of the microwave will detect food temperatures
User places food of any kind inside the microwave
Cooking Apparatus
Cooking Device Body
Food Platter
Infrared Sensor Array
1. Start by compiling the sensor data into an array 2. Rotate & Smooth the
data
5. And then calculate the target temperature
4. Iterate through each cell and calculate the viscosity
Food Pixel Concept & Algorithm
3. Take the food temperature data & compare it to the virtual graph
Extensive programming (with Python) work for computation has brought this idea to reality!
DataLiquid Data
60
50
40
30
20
10
Time (Sec)
Tem
pe
ratu
re (
C)
1801601408040 60200 120100
Each line represents a pixel in the sensor array.
Platter data
Data from liquid food
0
70
60
50
40
30
20
10
050 100 150 200
Semisolid Data
Each line represents a pixel in the sensor array.
Platter data
Data from solid food
Time (Sec)
Tem
pe
ratu
re (
C)
Solid Data70
60
50
40
30
20
10
00 20 40 60 80 100 120
Each line represents a pixel in the sensor array.
Platter data
Data from solid food
Time (Sec)
Tem
pe
ratu
re (
C)
Solve for Viscosity and Amount by optimizing Total
Squared Residual𝑅2 =
𝑡=0∞ (𝑇𝑑𝑎𝑡𝑎−𝑇𝑣𝑖𝑟𝑡𝑢𝑎𝑙)
2
Target Time Reached
Calculate Target Time using the Viscosity and
Amount from the virtual graph
Start warming and record initial temperature
Stop MicrowaveYes
No
Intelligent CookingProgramming Strategy:
• Create a virtual thermal profile in the microwave
• Optimize the total squared residual between the virtual profile and the thermopile data to minimum
• By Changing the viscosity, amount, initial temperature and/or other properties in the virtual food profile
0 5 10 15 20 25 30 35 40
Po
we
r o
n/o
ff
Time (s) Sensor and Magnetron Duty Cycle
Sensor
Magentron
The electromagnetic waves generated by the magnetron severely interferes with the sensor’s data acquisition and the sensor cannot even survive for a second. At the same time, recovery of the sensor while it is ON takes too long. This difficult problem was solved by using a mutually exclusive duty cycle. In
addition to safeguard the sensor from a high voltage drop (𝑉𝐿 = 𝐿𝜕𝐼
𝜕𝑡) from
magnetron inductance the duty cycle was carefully controlled as shown below.
3 secSensor ON
6.6 secMagnetron ON
0.2 sec gap for sensor hysteresis recovery
Sensor Hysteresis & Radiation Management
Internet of Things Microwave
Temperature Profiling Database
Algorithm
Machine Learning
Cloud Computer
Heat MapUser
Detection
Android Device
Target Temperature
Device Signature
Sensor
Socket Programming
Microwave
Magnetron
Lamp and Motor for Turntable
Internet Cloud
User Customization
Profile Settings
Target Temperature
User Preferences
Temperature Data
Sever Calculations
Calculations
Targeted Pixel Based Heating (TPBH)
Targeted Pixel Based Heating or TBPH is one of the new innovations. Each temperature cell in the sensor array is interpreted as an individual food particle with its own separate properties. By targeting only specific pixels that need warming, we can all the food in the platter to the perfect temperate, warming the chicken and sparing the salad.
State of Art ComparisonFeature Current State of Art My Innovation
# of User Input Parameters 1-4 0 required
Fire Safety
Unattended Cooking
Cooking Accuracy 60-90% (human error) 99%
Power Consumption Time is guessed, magnetron: usually stays on longer than needed
Magnetron only on as required (saves lot of power)
Temperature Preference Personalization
Food Auto Detection
Integration in to Cloud
Remotely Controller through Smartphone
Cost $50-400 Less than 17% increase for a high end microwave
Intelligent Microwave
The internet connected computer sends data to the user wirelessly
IOT solutions provide remote control and full telemetry. The user is able to set the target temperature to his/her own preferences
A thermopile sensor array at the top of the microwave will detect food temperatures
User places food of any kind inside the microwave
References1. Ahrens, M. (2015, November). Home fires involving cooking equipment. Retrieved February 5, 2016, from National Fire Protection Association
website: http://www.nfpa.org/research/reports-and-statistics/fire-causes/appliances-and-equipment/cooking-equipment
2. Ahrens, M. (2015, November). Home Fires Involving Cooking Equipment. Retrieved from National Fire Protection Association website: www.nfpa.org/~/media/files/research/nfpa-reports/major-causes/oscooking.pdf?la=en
3. Boyd, S. (2007). Regularized least-squares and Gauss-Newton method. Retrieved from Stanford University website: https://see.stanford.edu/materials/lsoeldsee263/07-ls-reg.pdf
4. Cowles, K., Cass R., & O'Hagan T. (n.d.). What is Bayesian Analysis? Retrieved from International Society for Bayesian Analysis website: https://bayesian.org/Bayes-Explained
5. Croeze, A., Pittman, L., & Reynolds, W. (2012, July 6). Nonlinear Least-Squares Problems with the Gauss-Newton and Levenberg-Marquardt Methods. Retrieved from https://www.math.lsu.edu/system/files/MunozGroup1%20-%20Presentation.pdf
6. Freund, M. R. (2004, February). The Steepest Descent Algorithm for Unconstrained Optimization and a Bisection Line-search Method. Retrieved from Massachusetts Institute of Techology website: http://ocw.mit.edu/courses/sloan-school-of-management/15-084j-nonlinear-programming-spring-2004/lecture-notes/lec5_steep_desce.pdf
7. Gavin, P. H. (2015, September 29). The Levenberg-Marquardt method for nonlinear least squares curve-fitting problems. Retrieved from Duke University website: http://people.duke.edu/~hpgavin/ce281/lm.pdf
8. Gratton, S., Lawless, A. S., & Nichols, N. K. (2007). Approximate Gauss-Newton methods for nonlinear least squares problems. Retrieved from University of Reading website: http://www.henley.ac.uk/web/FILES/maths/09-04.pdf
9. Ranganathan, A. (2004, June 8). The Levenberg-Marquardt Algorithm. Retrieved from http://ananth.in/docs/lmtut.pdf
10. Rao, M. A., Rizvi, S., Datta, A. K., & Ahmed, J. (2014). Engineering Properties of Foods (4th ed.). Retrieved from https://books.google.com/books?id=2FnOBQAAQBAJ
11. THERMAL PROPERTIES OF FOODS. (2006). In 2006 ASHRAE Handbook — Refrigeration. Retrieved from http://pcfarina.eng.unipr.it/Public/Termofluidodinamica/Utility/Tabelle%20Alimenti.pdf
12. Vandenberghe, L. (2011). Nonlinear least-squares. Retrieved from University of California, Los Angeles website: http://www.seas.ucla.edu/~vandenbe/103/lectures/nlls.pdf
13. Vandenberghe, L. (2015). Nonlinear least-squares. Retrieved from University of California, Los Angeles website: http://www.seas.ucla.edu/~vandenbe/133A/lectures/nlls.pdf
14. Weisstein, E. W. (n.d.). Bayesian Analysis. Retrieved from Wolfram MathWorld website: http://mathworld.wolfram.com/BayesianAnalysis.html
15. Weisstein, E. W. (n.d.). Method of Steepest Descent. Retrieved from Wolfram MathWorld website: http://mathworld.wolfram.com/MethodofSteepestDescent.html
Scan this QR code for more Information!
Thank You
FULL STEPTwo phases
at a timeStrongest
Torque
2 3 4 5 6 7 81
Stepper motor allows optimum control of rotation at high heat points for denser food sections
Stepper motor can step through its rotation at any given multiple of step (3.75 degrees) and turn in any direction.
3.75 Step angel for extra precision rotation
Asymmetric high heat areas
in cabin
High viscosity
Low viscosity
Asymmetric density of
Food sections
How to skip the Salad!
Bayesian Food Characteristics Algorithm
Data from a single pixel of sensor
Real-time Heat Map from Sensor
Profile from the data (blue) is compared to that of the algorithm (red)
Using a specific viscosity and amount from the algorithm, the matching temperature profile is generated by interpolation of the profiles in the database as in a machine learning technique
Algorithms
Studied
Timing Results
Nelder-
Mead
10 loops, best of 3:
37.8 ms per loop
Powell 10 loops, best of 3:
26.5 ms per loop
CG 10 loops, best of 3:
404 ms per loop
BFGS 10 loops, best of 3:
48.6 ms per loop
L-BFGS-B 10 loops, best of 3:
46.1 ms per loop
TNC 10 loops, best of 3:
28.3 ms per loop
SLSQP 10 loops, best of 3:
23.2 ms per loop
COBYLA 100 loops, best of
3: 16.1 ms per loop
Differential
Evolution
10 loops, best of 3:
275 ms per loop
LM-LSQ 100 loops, best of
3: 7.82 ms per loop
Algorithm ProfileLM-LSQ is Levenberg
Marquardt Least Squares Method
The Cheese Experiment
Normal standing heat pattern
Oven inverted heat pattern
Functions Management and Thread Synchonization
Data collection involves four main components: Sensor, Edison, Network socket, & Algorithm with Python code
Bayesian Predictive Model
Generate Heat Map Image
EdisonThread 1
Threaded/Pipeline Mgmt.
LM-LSQ Optimization
Relay Calculations back to Edison
Target Determination
Broadcast data for Smartphone app
Data Acquisition
Bidirectional Socket Data Send
Server ACK
Dynamic Filtering
Cloud Server Task Delegation
EdisonThread 2
ServerThread 1
Asynchronous Data Recv.
ServerThread 2
ServerThread 3
Receive Phone Signature
Deviate Results using User Settings
Loop
Loop
Loop
Loop
Loop
Recv. Calculations from Server
Stop Microwave if Needed
Receive User Target Settings
Pipeline Mgmt. for Algorithm
Asynchronous Data Buffering
Journey to the Current Platform• Started with Galileo
– Inadequate and non-native display
– computation speed
• Minnow board was suggested for better computation– Same problems as Galileo
• At NDG the Edison was a better choice, however challenges remain:– PySerial
– HID device and PyUSB
– Yocto linux
– I2C voltage level shifting
– New linux command line
– Limited documentation
• With all of these platforms I had to:– Start from scratch
– Port code base
– Deal with device specific driver issues
Sensor Installation
First prototype was built with Melexis 16x4 sensor array EVB . However the aspect ratio was not optimal and communication was difficult and its radiation tolerance was very poor.
Eventually the Panasonic Grid-EYE, an 8 by 8 thermopile array with high accuracy and low cost was found. Communication with was also simple (both I2C & USB) and this is the current solution in the microwave as demonstrated.
Numerous low-cost, low-resolution, high accuracy thermopile sensor were investigated for to put inside the microwave
Magnetron Waves Exit
Standing Waves
In a microwave oven, standing waves emitted from the magnetron are emitted horizontally which creates uneven heating. To correct this the platter is rotated for homogenous heating. However, if the rotation of the microwave was controlled intelligently, this unevenness could be utilized for selective heating as explained in the TPBH section.
Water dipole heating
Microwave Heating Characteristics
Microwave Edison Setup
Yocto Poky Linux on Edison
ComputationalLibraries
Scipy
Matplotlib
Numpy
Socket
Pyserial
Libmraa
I/OLibraries
Microwave Programs
Python Interpreter
11 Digital Pins + 2 I2C Data Pins
5 Analog Pins
Sensor
MagnetronLamp and Turntable
Mathematical ConceptsThe Levenberg-Marquardt algorithm at its core is a trust-region algorithm that interpolates between the gradient descent method and the Gauss-Newton method.
Gradient Descent
Gauss-Newton
The Gradient Descent Method is based on the observation that if the multi-variable function 𝑓(𝒙) is defined at differentiable in the neighborhood of a point at a certain point, then 𝑓(𝒙) decreases fastest in the direction of the negative gradient−𝛻𝑓(𝒙). Therefore, it follows that with an initial guess 𝒙0, an iterative method can be produced for the next point to minimize 𝑓(𝒙): 𝒙𝑛+1 = 𝒙𝑛 − 𝛾𝛻𝑓(𝒙𝑛)(assuming 𝛾 is a small value such that 𝛾 > 0)
The gradient (a multidimensional derivative) of the function f(x,y) = −(cos2x + cos2y)2
depicted as a projected vector field on the bottom plane.
The Gauss-Newton Method on the other hand tries to minimize the sum of squared residuals. The algorithm is given 𝑚 functions (residuals) 𝒓 = (𝑟1, 𝑟2, … 𝑟𝑚) of 𝑛 variables 𝒙 = (𝑥1, 𝑥2, … 𝑥𝑚)where 𝑚 ≥ 𝑛, and the sum of squares is minimized: 𝑟(𝒙) 2 = 𝑖=0𝑚 𝑟𝑖
2 (𝒙). Rather than calculating second-order derivatives or the Hessian matrix, the method uses 𝑟(𝒙), and its derivative, the
Jacobian (𝐽𝑟)𝑖𝑗 𝒙 =𝜕𝑟𝑖(𝒙)
𝜕𝒙𝑗. Using the
Jacobian, 𝑟(𝒙) is linearized at current iteration 𝑛 given an initial guess 𝒙0:
𝑟 𝒙 ≈ 𝑟 𝒙𝑛 + 𝐽𝑟 𝒙𝑛 𝒙 − 𝒙𝑛= 𝐴𝑛 𝒙𝑛 𝒙 − 𝑏𝑛(𝒙𝑛)𝐴𝑛 𝒙𝑛 = 𝐽𝑟 𝒙𝑛 ,𝑏𝑛 𝒙𝑛 = 𝐽𝑟 𝒙𝑛 𝒙𝑛 − 𝑟 𝒙𝑛
The next iteration is found by minimizing the sum of squares
𝑟(𝒙𝑛+1)2 ≈ 𝐴𝑛 𝒙𝑛 − 𝑏𝑛(𝒙𝑛)
𝟐
Rotation Algorithm
As the plate rotates, the location of each of the food pixels relative to the initial grid changes, and that is tracked through each data collection
Raw data as is. Spikes exist because in some positions, the sensor senses food, in other times it senses the plate
The rotational tracking is applied to help compensate. However, some errors still do occur.
Finally smoothing is applied, eliminating all of the rest of the spikes.
Time 0 Time 1 Time 2
Each line is a pixel in the sensor array