Abstract: This document aims to introduce how to use SPMC65P2404A MCU as the main controller combining with fuzzy control to implement a intelligent electric cooker controller.
Keyword: MCU, A/D Conversion, Temperature Control, Relay
Most electric cookers on today's market heat up with the selection of mechanical mode or rated power mode in which low energy utilization and single function fail to meet people's ever-increasing living demand. In such circumstances, it becomes extremely necessary to develop one kind of intelligent electric cooker with multifunction, safety and reliability. It has gone through many stages for mechanical electric cookers to develop into intelligent ones. Three major types including microcomputer, computer and machine with ten different patterns have come into being due to the predominant hi-technology being applied in electric cookers; besides, they turn to be more diversiform and fashionable on the basis of nice cooking. Apart from low price, the mechanical electric cookers barely satisfy people's demand for modern or high-quality living, while the intelligent ones being controlled by microcomputer or computer succeed with the following characteristics: The man-oriented interface design enables users to notice the operating state easefully; the whole cooking procedure is automatically controlled by computer; moreover, outer-space "black crystal" is taken as the inner pot for its super hardness, outstanding abrasion-resistant durability and everlasting handsomeness. All the features match the modern concept of time saving, labor saving and durability.
The intelligent electric cookers have the following functions: normal, fast, warming, small quantity cooking, 45-min gruel, 2h porridge, 1h soup and 2h soup; moreover, their personalized operation interface makes it easy for users to control the cooking. With far more capabilities besides boiling rice only, the intelligent electric cookers have played an indispensable role in our daily life. It's the very invention of the intelligent control that makes today's life simpler and easier.
2 Electric Cooking Procedure
The control of water absorption quantity, heat time, temperature controlling process, boiling keeping time, temperature keeping process and stewing process is essential to marvelous cooking. Cooking is a process to convert the β starch to the more absorbable and digestible α starch. Plenty of practice has proved that a perfect cooking procedure can be broken down into the following steps:
· Water absorption
Make rice absorb as much water as possible under appropriate temperature so that the cooked rice will look perfect and taste much better. Rice will absorb more water as the temperature rises. However, when the temperature is higher than 60℃, βstarch will be converted to αstarch and turned to paste. Thus it's necessary to control the temperature under 60℃. 35℃ is considered to be optimum and it's better to make the water content of rice amount to about 25%.
Sufficient heat convection is important in heat process to make rice full-cooked. Generally speaking, the optimum duration from heating to boiling is 10 minutes.
· Keeping boiling
In order to makeβstarch fully converted toαstarch, it's advisable to control the temperature around 98℃ in boiling state and boiling should last for about 20 minutes. The temperature can be controlled by controlling the on / off of the relay.
· Keeping cooking
The temperature falls as the electric cooker is powered off. Remained water in the pot can be vaporized if electricity is re-supplied for certain period when the temperature falls to 100℃. Duration for keeping cooking may vary according to your demand.
After upper procedure is finished, only a little water is left in the pot, here heat should be ceased. The remaining heat is enough to stew and generate the digestibleαstarch. The stewing time is generally kept for 12 minutes.
· Temperature keeping
When rice cooking is completed, the cooker will automatically enter temperature keeping mode. Once the temperature is lower than 65℃, the heated plate will heat the pot and the rice is edible.
3 Device Feature
SPMC65P2404A, 8-bit industrial micro-controller of Sunplus, provides powerful features for driving the intelligent electric cooker:
· Sunplus 8-bit micro controller SPMC65P2404A
- 182 instructions
- 11 addressing modes
- Operation speed: 8MHz @ 5V
- Support bit operation (Set, Clear, Inverse and Test)
· 2 8-bit programmable Timer / Counter (auto initialization)
- General purpose Timer / Counter
- 8-bit capture mode
- 8-bit compare mode
· 2 16-bit programmable Timer / Counter
- General purpose Timer / Counter
- 8 /16-bit capture mode
- 16-bit compare mode
- 12-bit PWM waveform output
· Interrupt management
- IRQ and NMI for the external interrupts
- 4 external interrupts
- 11 internal interrupts
· Operation voltage range: 3V ~ 5V
· 8 10-bit ADC (100KHz)
· Built-in 4K Bytes OTP ROM
· Built-in 192K Bytes RAM
· 23 programmable general purpose IOs
· 5 types of reset functions: Power-On Reset (POR), External Reset (RESET), Low Voltage Reset (LVR), Watchdog Timer Reset (WDTR), and, Illegal Address Reset (IAR)
· Clock selection: Crystal Resonator, RC oscillator, external clock
· Power saving modes: Halt and Stop
· Low voltage reset (LVR), Low voltage detection (LVD)
· One Buzzer output port
· Up to 2Mbps of the SPI communication frequencies
· ICE, In- Circuit Emulator interface
The intelligent electric cooker based on the Sunplus 8-bit micro controller SPMC65P2404A has two major functions:
4.1 Cooking Function
Select NORMAL mode and press START button to start to heat. After 45 minutes, it will enter stewing mode and the indicator will display "n". After another 10 minutes, the cooking will be completed. Now, the cooker will enter the temperature keeping mode and the indicator will display "b".
Select FAST mode and press START button, then the electric cooker starts heating. After 30 minutes, it will enter stewing mode and the indicator will display "n". After another 8 minutes, the cooking will be completed. Now, the cooker will enter the temperature keeping mode and the indicator will display "b".
Select WARMING mode and press START button, then the electric cooker starts heating. After 15 minutes, it will enter the temperature keeping mode and the indicator will display "b".
4)Small quantity cooking
Select SMALL QUANTITY COOKING mode and press START button, then the electric cooker starts heating. After 40 minutes, it will enter the stewing mode. Now, the indicator will display "n". After another 10 minutes, the cooking will be completed. Now, the cooker will enter the temperature keeping mode and the indicator will display "b".
Select GRUEL mode and press START button, then the electric cooker starts heating and the indicator displays "-". After 45 minutes, the cooker will enter the temperature keeping mode and the indicator will display "b".
6) 2h Porridge
Select 2h PORRIDGE mode and press START button, then the electric cooker starts heating, and the indicator displays "2". After 2 hours, the cooker will enter the temperature keeping mode and the indicator will display "b".
7) 1h Soup
Select 1h SOUP mode and press START button, then the electric cooker starts heating, and the indicator displays "1". After 1 hour, the cooker will enter the temperature keeping mode and the indicator will display "b".
8) 2h Soup
Select 2h SOUP mode and press START button, then the electric cooker starts heating, and the indicator displays "2". After 2 hours, the cooker will enter the temperature keeping mode and the indicator will display "b".
Note：The cooker will enter the temperature keeping mode and the indicator will display "b" whenever any of the above-8-mode is completed.
4.2 Timing Function
The timing will change according to the different operation mode. Press START button and the electric cooker begins to count. The counting number decreases by 1 after cooking for 1 hour. According to the time difference between the timing and the time required for the operation, the electric cooker automatically begins running, heating, and temperature keeping, and finishes the selected cooking function. Take 45-min gruel as an example, if the timing is set to be 2h, cooker will automatically begin running and enter 45-min gruel mode after timing operation has executed for 1 hour and 15 minutes.
5 System Introduction
The control system of the intelligent electric cooker based on SPMC65P2404A is shown in Figure 5.1. You can control the working mode of the electric cooker (8 modes in all), make the current working state display on the indicator, and set timing for working. MCU can control the connecting / disconnecting of the relay, which depends on the temperature data sampled by temperature sensor, so it can control the heat plate. Power supply offers 5V to MCU system and peripheral circuit to heat up the heat plate.
Figure 5.1 System Diagram
6 Hardware Design
6.1 Main Control Circuit
The main control circuit (shown in Figure 6.1 ) consists of switch key input circuit, temperature detection input circuit, reset circuit, and, crystal oscillation circuit. PA6 and PA7 are responsible for detecting the temperatures of top cover and bottom plate, and PA5 performs relay control. SPMC65P2404A is the core of the circuit.
Figure 6.1 Main Control Circuit
6.2 Display Circuit
The display circuit consists of one 2-digit 7-segment LEDs module of common anode and ten LEDs. The circuit displays the current running states based on the common selection and segment data driving by MCU, shown in Figure 6.2 .
Figure 6.2 Display Circuit
6.3 Power Supply Circuit
The DC +5V is supplied for the microcontroller.
After being stepped down, rectified and filtered, the AC 220V is converted to the DC +12V for supplying relay. The relay state is controlled by controlling the on/off of audion emitter.
The power supply circuit is displayed in Figure 6.3.
Figure 6.3 Power Supply Circuit
6.4 Temperature Collecting Circuit
J2 and J3 are the interface to the top cover and bottom plate temperature sensors. The signal detected by the MCU indicates the voltage value of the resistor dividing voltage from temperature sensors. Since the resistance of the temperature sensor will decrease with the rising of temperature, the voltage of divider resistor indirectly indicates the temperature at certain time. The temperature sensors circuit is illustrated in the following figure.
Figure 6.4 Temperature Sensors Circuit
7 Software Design
7.1 Program Flow
The whole system includes two parts: Input part and output part. The input system consists of two temperature sensors and five buttons; the output system consists of 2 7-segment digital display modules, 10 LEDs and the relay control signal. Based on control function, the program is designed into the following modules. Figure 7.1 flow charts the main program.
Figure 7.1 Program Flow
7.2 Subroutine Description
1. Diagnostic subroutine
The diagnostic subroutine is designed for collecting the temperature of sensors and judging whether they work normally or not. The subroutine detects the two temperature sensors continuously for twenty times, and if the data detected are beyond the temperature range (-10℃~160℃), it indicates that the sensor is in short-circuit or open-circuit mode. At the same time the digital displays "E" and the key press operation is disabled.
2. Switch key scan subroutine
The key-press is scanned during a switch key scan subroutine cycle. When scanning a key is pressed, the subroutine will store the key value temporarily. System considers the key data to be a stable one when the same data is continuously scanned for five times. There are five keys in the system. At any status, each key is available once gently pressed. These keys are connected to PA0, PA1, PA2, PA3 and PA4 respectively. If the key pressed is effective, the corresponding bit of the returned value is set to 0; routine is otherwise, set to 1.
3. Temperature collection subroutine
Considering the high sensibility of the thermistor, the way of moving average filtering is adopted for temperature collecting to prevent disturbing and frequently acting of the control unit from the frequent change of the temperature data. That is to continuously collect three data, and fetch the middle one.
4. Display subroutine
There are 2 7-segment digital display modules and ten LEDs in the system. The digital display module displays six statuses: Standby, Error Display, Stewing, Warming, Boiling and Timing; and the LEDs indicate the lamps including the selected function, 'Start' and 'Warming' statuses. In the system, the function is displayed in order. Before pressing the 'Start' button, the 'Start' lamp flashes continuously; and when the electric cooker enters the 'Warming' status, the corresponding lamp will be lighted. LED display subroutine is made up of common code scanning subroutine and segment selection subroutine.
5. Function performing subroutine
Function performing subroutine works depending on the flag set in the key process subroutine (Each cooking function is corresponding to a curve of temperature rising and heating). Cooking is processed according to each period.
Rather than just the boiling rice function, Sunplus 8-bit intelligent electric cooker has far more cooking functions, such as normal, fast, warming, small quantity cooking, 45-min gruel, 2h porridge, 1h soup and 2h soup. In the future, small home appliances should possess the following five functions: Intelligence, safety, multifunction, energy saving and pollution-free.
Firstly,intelligent. Hi-technology especially the advanced computer technology must serve for the usage and design of home appliances so that they can keep up with the pace of modern people.
Secondly,safe. Safety has met with much attention, because potential unsafety may put great threat to people's lives and property.
Thirdly, multi-functional. Multifunction has been playing a leading part in today's society, and promotes the consumption considerably.
Fourthly, energy saving. Every family is to have various types of home appliances. Insufficient investment on energy industry especially on electric power industry in our country is inclined to fail our needs. Family expenditure will weight a lot if immensity sources are consumed by small home appliance.
 Xiao Jianhua, and Jing Shunlin, The Application and Prospect of Fuzzy Control on Home Appliance, WUYI University Academic Journal (Natural Science Edition), 2001.
 Gu Yong, Fuzzy Control and Application, Modern Physics Knowledge, 1998.