Design of an Intelligent Fully Automatic Washing Machine Control System Based on STC89C52

Zhang Zhe, Li Zhi, Guan Sihai

(School of Mechanical and Electrical Engineering, Xi’an University of Electronic Science and Technology, Xi’an, Shaanxi 710071)

Abstract: To reduce the operating power consumption of fully automatic washing machines, improve operational stability, lower manufacturing costs, and facilitate easier operation, a fully automatic washing machine control system based on the STC89C52 microcontroller has been designed. This control system consists of a Bluetooth module, infrared pyroelectric sensor, LCD1602 display, and DC motor, among others. The Bluetooth wireless communication technology is used to control the washing machine’s operational parameters from a mobile terminal over long distances; the infrared pyroelectric sensor facilitates clothing retrieval operations. Finally, the hardware structure and software flow of the control system are presented, and simulation tests using Proteus verify that the control system is simple and effective.

Keywords: STC89C52; Bluetooth wireless communication; infrared pyroelectric; smart home

Classification Number: TP13 Document Identification Code: A DOI: 10.19358/j.issn.1674-7720.2017.07.030

Citation Format: Zhang Zhe, Li Zhi, Guan Sihai. Design of an Intelligent Fully Automatic Washing Machine Control System Based on STC89C52 [J]. Microcomputers and Applications, 2017, 36(7): 102-105.

0 Introduction

*Funding Project: National Natural Science Foundation (61673310) Due to the advantages of fully automatic washing machines, such as minimal damage to laundry items, the ability to wash a large amount of clothing at once, and labor-saving benefits, they have become widely used in households [1]. However, with the introduction and dissemination of the smart home concept and its preliminary use in daily life, people have raised demands for fully automatic washing machines to be reliable in performance, low in washing power consumption, easy to operate, highly efficient, and convenient to maintain, all while being affordably priced. Currently, most fully automatic washing machines only offer simple washing functions like washing, spinning, and pausing, which are insufficient to meet the demand for intelligent control. Additionally, the operational status of traditional washing machines is often displayed using digital tubes, leading to unclear operational states, ambiguous error codes, and a lack of user-friendliness, thus creating significant inconvenience for operation and maintenance.

To effectively address the above issues, this paper utilizes the HC-05 Bluetooth module, matrix keyboard, LCD1602 display, and infrared pyroelectric sensor to design an intelligent control system based on the STC89C52. The HC-05 Bluetooth module and matrix keyboard are used for wireless mobile terminal control and close-range human-machine operation, respectively; the LCD1602 display provides a clear English display of the current operational status with bright backlighting, combined with the infrared pyroelectric sensor to greatly facilitate the operation of the washing machine.

1 Overall Design of the Control System

Design of an Intelligent Fully Automatic Washing Machine Control System Based on STC89C52

This control system consists of the STC89C52, Bluetooth serial circuit, motor drive circuit, matrix keyboard circuit, LCD1602 display module, infrared pyroelectric module, and alarm circuit. The system block diagram is shown in Figure 1.

In Figure 1, the STC89C52 serves as the microcontroller to implement the control algorithm; the Bluetooth transmission module is used to set the washing mode, washing time, etc., wirelessly over long distances; the LCD1602 displays the current operational status (e.g., washing, spinning, and washing modes) and working time; due to the limited output capability of the STC89C52 (approximately 10 mA), a motor drive circuit is utilized to amplify the current for motor operation; the infrared pyroelectric module primarily drives lighting devices to assist users in operating the washing machine in dark conditions; the alarm circuit is mainly used for emergencies such as motor damage and unexpected power outages, as well as reminders after washing is completed.

2 Main Hardware Design

2.1 STC89C52 Microcontroller System

The STC89C52 system mainly consists of a microcontroller (MCU), clock circuit, and reset circuit. The STC89C52 is fully compatible with the 8051 microcontroller, with key parameters including a maximum clock frequency of 80 MHz, five built-in interrupt sources divided into two priority levels (with programmable priority for each interrupt source), and four 8-bit input/output ports (P0, P1, P2, P3). It has a full-duplex serial port with four operating modes configurable via the SMOD register, and three 16-bit timers/counters [2]. Since the STC89C52 microcontroller has internal pull-up resistors on all ports except P0, an external pull-up resistor must be connected to the P0 port to ensure reliable levels. Additionally, the reset circuit uses a method where the capacitor charges upon power-up to achieve automatic reset. Furthermore, the serial ports (P3.1, P3.2) connect to the Bluetooth module’s serial ports (TXD, RXD), P2 connects to the washing machine’s function keyboard, P0 serves as the data bus for the LCD, and P1.7 controls the buzzer for the alarm circuit.

2.2 Bluetooth Serial Circuit

The principle of Bluetooth communication is similar to serial communication between a microcontroller and a computer, requiring a serial port for communication, as shown in Figure 2 [3].

Design of an Intelligent Fully Automatic Washing Machine Control System Based on STC89C52

In Figure 2, GND represents the reference ground for the microcontroller and HC-05 system, TXD is the serial transmit pin, and RXD is the serial receive pin. To ensure the power reference is the same for communication between the HC-05 and the microcontroller, the GND of the microcontroller is connected to the GND of the HC-05. Next, to build the communication channel, the microcontroller’s receive pin is connected to the HC-05’s transmit pin, serving as the microcontroller’s receive channel; the microcontroller’s transmit pin is connected to the HC-05’s receive pin, serving as the microcontroller’s transmit channel. The circuit diagram for the HC-05 Bluetooth serial circuit is shown in Figure 3.

Design of an Intelligent Fully Automatic Washing Machine Control System Based on STC89C52

2.3 Infrared Pyroelectric Module

The principle of infrared pyroelectric sensors [4] is to perceive the infrared spectrum emitted by the human body through its internal sensor, thus generating a high-level signal. When a person leaves the sensing area, the high level is automatically turned off, outputting a low level. Moreover, the infrared pyroelectric sensor has low power consumption, with a static current of only 65 mA. Its VCC connects to the positive power supply, GND to the negative power supply, and OUT1 connects to an LED through a 1 kΩ current-limiting resistor.

2.4 Motor Drive Circuit

Design of an Intelligent Fully Automatic Washing Machine Control System Based on STC89C52

The high voltage output from the STC89C52 is 5 V, low voltage is 0 V, and the current is 10-20 mA. However, the starting current of the DC motor is 200-400 mA, which is insufficient to drive the motor, so the L298 motor driver module is selected to amplify the current. The main functions of the DC motor PWM control system include: controlling the forward rotation, reverse rotation, and emergency stop of the DC motor by controlling the logic levels of two input pins, and adjusting the voltage to change the motor speed, allowing for convenient intelligent control of the motor [5]. The control functions are shown in Table 1.

In the L298, ENA and ENB are enable ports, with ENA controlling the left motor and ENB controlling the right motor; IN1, IN2, IN3, IN4 are control pins used to set the on/off state of the transistors. The H-bridge is used to control the motor operation, where the control is effective when the enable pin is high; when the enable pin is low, the input control of the motor is ineffective [6]. One input pin connects to the PWM signal, and when the other input pin is low, the motor rotates in the forward direction; if this pin is low and the other pin receives a PWM signal, the motor rotates in the opposite direction. When both input pins have the same logic level, the motor quickly stops. The pins and their functions are shown in Table 2.

Design of an Intelligent Fully Automatic Washing Machine Control System Based on STC89C52

3 Software Design

3.1 Overall Software Structure Design

The system program consists of the main program, timer interrupt program, delay program, LCD1602 display program, and motor driver program, among others. Timer interrupt 0 is used to control the washing process time and motor rotation direction. The countdown for the corresponding function is carried out through external interrupt 0, and during this time, if the stop button is pressed, the process is terminated and the system returns to the initial interface. The delay program is used for waiting during write operations to the LCD1602 display. The motor driver program controls the logic levels of the corresponding control pins. The control system flowchart is shown in Figure 4.

Design of an Intelligent Fully Automatic Washing Machine Control System Based on STC89C52

3.2 Bluetooth Serial Program

In the UART communication process, the LSB method is used, which sends the low byte of data first, followed by the high byte, then sets TXD to low and holds it for a period until all 8 bits of the binary number have been sent, while simultaneously setting TI and RI to 1. Additionally, to ensure that the mobile device (host) and washing machine can communicate normally, both must be set to the same baud rate, necessitating the use of the microcontroller’s timer 1. Using the formula: baud rate = (2 * SMOD / 32) × (T1 overflow rate) [2], the baud rate for this system is set at 9600 b/s; when using the serial port, after receiving or sending data, the flag bits are set to 1, but the serial interrupt does not automatically clear the flag bits like the timer interrupt, requiring software to clear the flag bits. The specific process for receiving data via the Bluetooth serial port is shown in Figure 5.

3.3 Matrix Keyboard Subroutine

The matrix keyboard consists of 16 keys. Due to the limited pins on the microcontroller, it is configured as 4 rows and 4 columns, performing row or column scanning to reduce the use of IO ports. Additionally, to avoid key bounce when a key is pressed, debouncing processing is required. The key scanning process is shown in Figure 6, and the debouncing flowchart is shown in Figure 7.

Design of an Intelligent Fully Automatic Washing Machine Control System Based on STC89C52

Design of an Intelligent Fully Automatic Washing Machine Control System Based on STC89C52

3.4 LCD1602 Display

The LCD1602 [5] has an internal display RAM of 80 B for sending data, structured as shown in Figure 8.

Design of an Intelligent Fully Automatic Washing Machine Control System Based on STC89C52

The first row address ranges from 0X00 to 0X27, and the second row from 0X40 to 0X67H, where the first row from 0X00H to 0X0F corresponds to the display positions of the first 16 characters on the LCD, and the second row from 0X40H to 0X4F corresponds to the display positions of the second row’s 16 characters. The extra portions of each row serve to display scrolling subtitles [7].

The basic operation timing:

Read Status:

Input: RS=L, R/W=H, E=H;

Output: D0~D7 status word;

Read Data:

Input: RS=H, R/W=H, E=H;

Output: None;

Write Command:

Input: RS=L, R/W=L, E=H, D0~D7=command code;

Output: D0~D7 data;

Write Data:

Input: RS=H, R/W=L, E=H, D0~D7=data;

Output: None.

The process for operating the LCD1602 display is as follows:

(1) Use the RS signal to determine whether to write data or commands to the LCD;

(2) Set the read/write mode (R/W) to write mode, meaning R/W is set to low;

(3) Send data or commands to the data bus;

(4) Send a high-level signal to the enable signal pin EN, allowing the data to be written into the LCD’s RAM, completing the write operation.

4 Experimental Results and Analysis

To further verify the simplicity and effectiveness of the control system designed in this paper, programs were written using Keil and simulated using Proteus. The simulation results indicate that the washing machine operates normally and the LCD displays the information correctly. Based on the schematic and simulation diagrams, a hardware prototype was produced, and an Android Bluetooth serial software was developed using Eclipse. Communication tests were conducted at various distances in non-open environments, controlling the fully automatic washing machine’s operation via the mobile Bluetooth serial software, observing the maximum operational distance.

Debugging results show that the effective communication range of the HC-05 Bluetooth module is 0-25 m, within which communication between the mobile device and washing machine is normal. The experimental results are shown in Table 3. This system can achieve remote control of the washing machine’s operational status, with low power consumption, accurate control timing, simple operation, and user-friendly features. The operational status of the fully automatic washing machine is clearly visible, making it suitable for users of different age groups. The Proteus simulation results are shown in Figure 9. Figure 9 shows the Proteus simulation results of the washing machine in the water filling mode. The corresponding LED indicates the current operational status, while the backlit LCD displays the working status and remaining time, which is more accurate and clearer compared to traditional digital tube displays. The simulation demonstrates the motor’s rotation status. The infrared pyroelectric sensor illuminates when a person passes by in dark conditions to assist with clothing retrieval. Through Proteus software simulation and actual hardware testing, it is concluded that this control system, compared to traditional fully automatic washing machine control systems, not only enables remote control operation, human body sensing for clothing retrieval, and user-friendly, intelligent operation but also significantly reduces operational power consumption and manufacturing costs by using the STC89C52 as the control chip. Additionally, hardware testing shows that the washing machine can issue alarms under abnormal motor conditions and display existing issues via the LCD, greatly reducing maintenance difficulty.

References

[1] Liu Xiaotong. Design of Fully Automatic Washing Machine Control System Based on Proteus [J]. Microcomputer Information, 2012: 28(9):146-148.

[2] Wen Zongzhou, Meng Jianhua. Principles and Interface Technology of Microcontrollers [M]. Beijing: China Electric Power Press, 2009.

[3] Zhao Yong. Design of Bluetooth Module for Embedded Systems [D]. Beijing: Beijing Jiaotong University, 2007.

[4] Xu Qingshan, Li Zhengyun. Intelligent Control Switch for Infrared Pyroelectric Human Sensing Drinking Water Machine: China, CN201830232 [P]. 2010-10-29.

[5] Liu Shuzhong, Sun Shuying, Wang Chunping. Implementation of Serial Interface for Microcontroller and LCD Driver [J]. Microcomputer Information, 2007, 23(2):49-53.

[6] Peng Hongcai. Principles and Driving of Motors [M]. Beijing: Mechanical Industry Press, 2007.

[7] NXP. NXP Semiconductors “TJA10 42 Rev. 7-8” [S]. 2012.

Design of an Intelligent Fully Automatic Washing Machine Control System Based on STC89C52Design of an Intelligent Fully Automatic Washing Machine Control System Based on STC89C52

Leave a Comment