You are on page 1of 24

# 1.

FUZZY LOGIC

1.1 Introduction Basically, it’s an intelligent version of a no-frills rice cooker. Instead of just an on/off button, a fuzzy-logic rice cooker has a micro-computer that lets the machine regulate time and temperature according to the type of rice being cooked (brown rice, for example, cooks at a lower temperature than white rice). It can cook more kinds of rice than you’ve ever heard of including sweet and germinated brown and some models can even cook oatmeal or polenta, steam vegetables, and make stew. But what really sold us on the cookers was how well they handle the white and brown rice we use every day. Fuzzy-logic rice cookers have computer chips that direct their ability to make proper adjustments to cooking time and temperature. Unlike basic rice cookers, which complete tasks in a single-minded, mechanical manner, the process behind the fuzzylogic rice cookers needs a bit more explanation. The fuzzy sets theory, first proposed by UC Berkeley professor Lotfi Zadeh in 1965, laid the groundwork for fuzzy logic, which he also put forward in 1973. Fuzzy sets theory has to do with mathematical sets, or groups of items known as elements. In most mathematical sets, an element either belongs to the set or it does not. Fuzzy logic is basically a way to program machines so they look at the world in a more human way, with degrees of truth. Instead of cold, hard parameters and strict data sets, fuzzy logic assumes a more practical approach. Using numbers, it incorporates non-definitive words like "slightly" or "almost" into its decision-making processes. As a result, the use of fuzzy logic in rice cookers helps to ensure properly cooked rice because it gives the appliances the ability to make judgment calls similar to those a person might make, albeit typically better than those a hungry, impatient person might make. An example of when fuzzy logic might be called into action is when the rice is cooking too fast on a hot day. In a typical scenario, the fuzzy logic algorithm will take the form of an if/then statement such as, "If the rice is too hot, and it is continuing to heat up fairly quickly, then the heating element needs to be turned down."

1

1.2 Problem Statement Rice needs two things to evolve from a hard, little grain to big, fluffy morsels. In order rice to be cooked, it needs lots of water and lots of heat. For this reason, cooking rice happens in four phases: 1. Sitting in water 2. Boiling 3. Absorbing water (steaming) 4. Resting

Rice cookers automatically guide rice through these four stages. The appliance consists primarily of a main body, an inner cooking pan, an electric heating plate, a thermal-sensing device and some buttons. Water and rice sit inside the cooking pan while it's inserted into the rice cooker's shell. The pan's weight depresses the thermal-sensing device, and the heating plate quickly brings the water to a boil. The sensing device is a small, spring-

loaded thermometer that gauges the temperature of the pan's contents. It's set into the bottom of the rice cooker's main body. Simple rice cookers usually warm their contents by transferring heat from the heating plate to the cooking pan, and the type of metal used can improve that transfer. Some metals copper and aluminum for example, there are highly conductive. In other words, they transfer their heat easily. A wide range of materials can be used for the cooking pan, and each type may affect the overall time it takes to cook the food. The process for cooking the rice is simple. Water boils at 212 degrees Fahrenheit (100 degrees Celsius), and once it reaches a steady boil, it won't get hotter. As long as there is water in the pan, the temperature should be stable. Once the rice absorbs all the water in the pan, the temperature will start to rise. The rice cooker senses this change and will either switch off or switch to a warming cycle. At this point, the rice has finished cooking and entered the resting stage.

2

In order to reduce the human effort.1. 1.4 Keep Warm Process We identified the inputs and outputs for this project.3 Project Description This project has four steps of processes to make perfect rice. And we described it with a simple block diagram and flow chart for this project. Figure 1: Block Diagram 3 . This project has two mode of cooking which is normal rice and congee or porridge.3 Heating Process 1. we let the machine to operate some of works to make rice.2 Measuring Process 1.1 Cleaning Process 1.

Flow chart for Smart Rice Cooker: Figure 2: Flow Chart 4 .

The rice to water ratio is 1:2 for normal mode and for congee mode is 1:5. The fuzzy rules for this process are:      IF mass is very_low THEN water_level is very_low IF mass is low THEN water_level is low IF mass is medium THEN water_level is medium IF mass is high THEN water_level is high IF mass is very_high THEN water_level is very_high 5 .4 Fuzzy Rules Cleaning Process For this process.1. The fuzzy rules for this process are: Water In      IF light is low AND water level is very_low THEN water in is true IF light is high OR water level is very_high THEN water in is false Motor Spin (Rinse) IF water in is false AND water level is very_high THEN motor spin is true Water Out (Drain) IF motor spin is false AND water level is very_high THEN water out is true IF water level is very_low THEN water out is false Measuring Process After the cleaning process. The outputs for this process are water in. The motor has been set to spin for 30 second. the inputs are light sensor and water level. water out (drain) and motor spin for rinse. we set up a mass sensor to detect the weight of rice so it can be measured. this rice cooker will go to the measuring process. The water or stock will come in and will be drain out based on the measurement. The light sensor will detect the cleanliness of the water. In order to get the right ratio between rice to water. If the light sensor detects a high output it means the water is clean. The sensor of water level will control the process of water in and out together with the motor.

From our researched. The fuzzy rules for this process are: Normal Mode:     IF temperature is medium AND water level is very_low THEN heat is true IF temperature is high AND water level is very_low THEN heat is false Congee Mode: IF temperature is medium AND water level is medium THEN heat is true IF temperature is high AND water level is medium THEN heat is false 6 .Heating Process The heating process is the main part of this project. If the temperature goes up to 100°C it will boil the water once again and make the rice too dry. The temperature is very high at 100°C boiling point. We decided to divide into two modes which are normal mode and congee mode. This process also has been divided into two modes because of the need of different amount of water. This is because each mode needs the different amount of water. This water level is based on the amount of water that has been measured before. The inputs are temperature and water level. The fuzzy rules for this process are: Normal Mode:   IF temperature is very_high AND water level is very_low THEN heat is false Congee Mode: IF temperature is very_high AND water level is medium THEN heat is false Keep Warm The last process is to keep warm of rice or congee that we made. we find that the temperature should be maintained between 60°C to 80°C. The water level for this process is not same with the measurement process or cleaning process. The inputs are temperature and water level. The idea is to control the heating process.

5 Fuzzy Tech Simulation By using the Fuzzy Tech 5.54 Professional Edition. The inputs and outputs should be decided how many level of membership functions. The minimum of membership function is 2 and the maximum is 5. we can make the fuzzy rules of all process much easier. we decided not to use fuzzy seen it just more logic gate compare to other process. Figure 3: Input and Output Variables There are three rule blocks for this simulation. For the first process which is cleaning process. For each rule blocks we have to make some rules to vary the desired output. For heating and keep warm process. Therefore only three processes will simulate using this software.1. 7 . we find that it can be combined together since they have the same inputs.

Figure 4: Fuzzy Rules for Measurement Figure 5: Fuzzy Rules for Heating Rice 8 .

Figure 6: Fuzzy Rules for Heating Congee 9 .

we get the exact output that we want for both normal and congee modes. we get approximately 4 cups of water and for congee mode is approximately 10 cups.6 Results After some couples of run test done for the simulation. 10 . then the water for each outputs match to its ratio. we can see that if mass or weight of rice is approximately 2 cups. one can be refer to software file given in the CD attachment. For example. For other results. we find that we have to make some tuning to get the desired output. we have to tune temperature input so that it can vary the medium and high as 60°C and 80°C respectively. For normal mode. For the measuring process.1. Figure 7: Ratio of mass to water level From Figure 7.

7 Defuzzification There are a lot of types and method to use for defuzzification. For this project we decided to use Weighted Average Method. The formula is: ∑ ∑ Figure 8: Weighted Average Method 11 .1. The method takes the peak value of each clipped/scaled output fuzzy set and builds the weighted (with respect to the peak heights) sum of these peak values. Weighted Average Defuzzification uses the individual clipped or scaled output fuzzy sets.

( ) ( ) Cups By comparing from calculation and simulation we find that it is just a slightly or minor different. The mass input is set at approximately 2 cups. we actually do not have to do the defuzzification seen the Fuzzy Tech already did the job for us. However. As a result. we decided to test the method on our measuring process. 12 . While the peak value for low is 6.39 and medium is 0. we can see that low part has height of 0.61.For this project. We can say that the method prove to be right and give the approximately the same output.50. we can find the value of output.25 and medium is 12. By using formula above. Figure 8: Weighted Average Method for Measuring Process From Figure 8 is the congee mode that has a ratio 1:5. for the purpose of study.

the network is adjusted. such as the brain. As in nature. 13 . artificial neural networks can be trained to solve problems that are difficult for conventional computers or human beings such as to perform complex functions in various fields. classification. and control of nonlinear systems.2. It attempts to replicate the human brain’s functionality on a much smaller scale. Commonly artificial neural networks are adjusted. The human brain contains approximately 1011 neurons whilst each neuron would have 104 inputs. Today. learn by example. The ANN can be trained to perform a particular function by adjusting the values of the connections (weights) between elements. The key element of this paradigm is the novel structure of the information processing system. or trained. including pattern recognition. This is true of ANNs as well. It is a similar structure which is composed of neurons which are connected via dendrites. neural networks have seen an explosion of interest over the last few years. identification. in areas as diverse as finance. and speech. like people. Learning in biological systems involves adjustments to the synaptic connections (weights) that exist between the neurons. ANNs. and are being successfully applied across an extraordinary range of problem domains. There. vision. so that a particular input leads to a specific target output. It is composed of a large number of highly interconnected processing elements (neurons) working in unison to solve specific problems. engineering. An ANN is configured for a specific application through a learning process. process information. In fact. Typically many such input/target pairs are needed to train a network. the network function is determined largely by the connections (weights) between elements. geology and physics. NEURAL NETWORK 2. medicine.1 Introduction An Artificial Neural Network (ANN) is an information processing paradigm that is inspired by the way biological nervous systems. Such a situation is shown below. until the network output matches the target. based on a comparison of the output and the target.

Figure 9: Multilayer Perceptron Architecture 14 . we decided to use two hidden layers in order to reduce the error. This device is attached to smart rice cooker. we decided to design rice classification device. So for neural network project.2. For neural network architecture. For rice classification device. we decide to train the device for two types of rice plain rice and basmati rice. so the rice cooker can determine the correct amount of water need to add based on the amount of rice. Each training set consist of 500 epochs. this is mean the system is trained 2500 times. The system is trained up to 5 times in order to make the system learn to classify between plain rice and basmati rice.2 Problem statement: Each type of rice needs different amount of water in order to cook perfectly.

This network topology is called feedforward multi layered neural network. means the values are propagated in one direction only. it just hands over it. network would not be capable of solving complex problems. This network is feed-forward. The neurons are arranged in a number of layers. generally three.The circles in the image represent neurons. Without this layer. 15 . This system is able to classify type of rice and auto adjusts to an appropriate amount of water. The names signify the function of the layer. Input layer never processes data. The functions of various layers are explained below:  Input layer: As it says.  Hidden layer: This layer is the real thing behind the network. hidden or middle and output layers. an intelligent classification system is needed to determine the right amount of water to add base on type of rice. Therefore. They are input. this layer takes the inputs (every pixel for character painted by user at input box) and forwards it to hidden layer.  Output layer: This layer consists of neurons which output the result. The network is called multi layered because it consists of more than two layers.

First run training result as shown in figure.2. the error is 11. we can see at first run the error quite high. Based on the result in figure. In this system two input variables and one output variable have been define.612%. Some of data sets as listed in Table 1. Each data set contains 100 data of rice that have been obtained randomly. 16 . the system determines 59 out of 100 as plain rice and 41 out of 100 as basmati rice. We trained the system to classify the between plain rice and basmati rice using this data set. As we know each type of rice has different length and colour.3 Data Data set that we use to train the system is based on the length and colour of rice. colour length rice white normal plain white normal plain brown long basmati white normal plain white normal plain white normal plain brown long basmati brown long basmati brown long basmati white normal plain white normal plain white normal plain white normal plain white normal plain white normal plain Table 1: Data Sets During the training process on the system.

2.4 Results Figure 10: First Run Result Figure 11: Several Run Result 17 .

we can see the visualise results as symmetrical to one and another. the plot has some jitters point if we look closely. Figure 12: Visualise Results From Figure 12. The second result as shown in Figure 11. However.Then after the several rounds the system is trained. After the second training is completed. the system determined 55 out of 100 as plain rice and 45 out of 100 as basmati rice. we can see the error has been reduced to 1. 18 .7265%.

Consider a simple neural network with two input units. t and the actual output. 19 . The network given X1 and X2 will compute an output y which very likely differs from t (since the weights are initially random). one output unit and no hidden units. X1 and X2 is the first and second input value of neuron. before training. Each neuron uses a linear output that is the weighted sum of its input. the error also depends on the incoming weights to the neuron. Initially. the weights will be set to random. the network learns from many inputs Before showing the mathematical derivation of the back propagation algorithm.5 Back Propagation Back propagation an abbreviation for "backward propagation of errors” is a common method of training artificial neural networks. which is ultimately what needs to be changed in the network to enable learning. Therefore. it helps to develop some intuitions about the relationship between the actual output of a neuron and the correct output for a particular training case. t) where X1 and X2 are the inputs to the network and t is the correct output (the output the network should eventually produce given the identical inputs). the output of a neuron depends on the weighted sum of all its inputs: Where W1 and W2 are the weights of the connection from the input units to the output units. From a desired output. A common method for measuring the discrepancy between the expected output.2. which in this case consists of a set of tuples (X1. y is the squared error measure: However. X2. Then the neuron learns from training examples.

1 Proteus The rice cooker controlled by the rules of “neuro-fuzzy” reasoning is not only driven by induction heating. SIMULATION 3. By using ATMEL 8051. the temperature proper to each of the cooking processes and the period at which each of the processes has to be maintained are finely controlled by the rules according to the given information. Figure 13: ATMEL 8051 20 .3. Our smart rice cooker will be function automatically and manually depend on consumer desire. We use Proteus to simulate our neural network design for smart rice cooker. such as the preferred rice stiffness. but the heat application is finely controlled according to the traditional controls which are reproduced. the amount of cooked rice deduced from the temperature rise and the power consumption. etc.a51. In this cooking process. For the problem with rice to water ratio. we use Analog Digital Converter (ADC 0804) to come up as a solution for the problem stated. we assemble the assembly language using file.

Figure 14: Schematic Diagram Figure 15: Analogue Digital Converter for Mass Sensor 21 .

a51 and .2 Source Code In attachment to this project. Maybe in the near future. we already include the source code in the CD. The simulation is just for the theoretical part and it cannot be done in practical. this project can be implementing in practical.3. The files are in . Figure 16: Source Code 22 .HEX.

Some models also offer texture settings. living things and human beings which are equipped with providential highly developed intelligence and functions. white rice. We believe that the real so-called heart ware can be realized only by creating the situations where the human beings can use machines and systems without consciousness of them. Therefore. The cleaning process is very useful for pharmaceutical industry. Fuzzy control is based on fuzzy logic a logical system which is closer in spirit to human thinking and natural language than traditional logical systems. Fuzzy logic control system is based on fuzzy logic provides means of linguistic control strategy based on expert knowledge into an automatic control strategy. and to apply the obtained knowledge to engineering. CONCLUSION From this project. These may include different keep-warm and quick-cook cycles for the optimum cooking of rice varieties like sushi rice. porridge rice. This project can be also implementing in the pharmaceutical industry. sweet rice and brown rice. their mathematical programming can deliver a slew of customized cooking options. The process of converting a crisp input value to a fuzzy value is called "defuzzification". some of the applications of neural networks to home appliances have been described above. This project using Proteus to simulate smart rice cooker and hex code is generated using assembly language. This means the fusion between the advanced technologies and the human science is indispensable. The rice cookers function under the same premise as basic models. making precise fluctuations in cooking time and temperature depending on the program selected. it is essential to study profoundly the natures. Crisp set is defined in such a way that all individuals in a given universe can be partitioned into two classes that those who belong to the set and those who do not belong to the set. Nowadays. known as "fuzzy sets". 23 . The trick to these capabilities is the rice cookers' ability to react. there are a lot of type fuzzy neuro of rice cooker in the market. The input variables in a fuzzy control system are in general mapped by sets of membership functions similar to this. mixed rice.4. allowing people to select hard or soft and sticky or wet rice.

Wiley 3. June 2007 5. REFERENCES 1. Michael Negnevitsky. LabVIEW. Third edition. fuzzy Logic With Engineering Application. Ross.ni. Timoty J. Addison Wesley 2. LabVIEW. June 2009 4. http://www.5. PID and Fuzzy Logic User Manual. Artificial Intelligence. PID and Fuzzy Logic User Manual.com/labviewse/ 24 . Second Edition.