Design and implementation of intelligent socket strip based on 51 single chip microcomputer

Publisher:omicron25Latest update time:2013-02-06 Source: dzsc Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  1 Introduction

  With the increasing awareness of energy conservation, emission reduction and green environmental protection, people have put forward higher requirements for energy conservation and emission reduction of household appliances. However, not every household has the funds to replace household appliances that have been used for many years and are still usable. To this end, this paper designs and develops an energy-saving and environmentally friendly smart power strip based on 51 single-chip microcomputer control. By using this power strip, the old generation of household appliances can be transformed into intelligent appliances with functions such as remote control, timer switch, and no standby power consumption, saving the cost of replacing household appliances. The power strip has a good on-site operation effect, meets the needs of general users, and has a certain value of promotion and application.

  2 Basic working principle of smart power strip

  For the convenience of users, this design divides the system into two parts: the power strip control system and the power strip remote control system (as shown in Figure 1 and Figure 2), which are controlled by an AT89S52 single-chip microcomputer. In the power strip control system, the single-chip microcomputer receives the remote control command of the remote control through the wireless receiving module, decodes it and performs related operations; the single-chip microcomputer controls the power on and off of the socket by controlling the relay connected to the power strip socket.

  Of course, the power on and off of the socket can also be controlled by the manual switch button. The LED indicator is used to indicate the current working status of the power strip. In the power strip remote control system, the wireless transmitter module sends remote control commands to remotely operate the power strip such as timed switching or immediate switching. This system uses the LCD display module FYD12864-0402B produced by Chengdu Feiyuda Industrial Co., Ltd., with a built-in ST7920 LCD controller. The LCD is used to display the remote control human-computer interaction interface.

Figure 1 Socket control system

Figure 1 Socket control system

Figure 2: Remote control system for power strips

Figure 2: Remote control system for power strips

  3 Smart socket hardware design

  3.1 Wireless communication module and 51 single chip microcomputer interface and communication technology

  3.1.1 Wireless transceiver module and 51 MCU hardware interface

  In order to reduce production costs, we use Atmel's AT89S52 microcontroller as the control unit in the power strip system, and use PT2272 and PT2262 paired encoding and decoding chips to form a wireless communication module. The circuit diagrams of the wireless transmitter module and the wireless receiver module are shown in Figure 3 and Figure 4.

Figure 3 Wireless transmitter module circuit diagram

Figure 3 Wireless transmitter module circuit diagram

Figure 4 Wireless receiving module circuit diagram

Figure 4 Wireless receiving module circuit diagram

  In Figure 4, the 17th pin (VT) of the decoding chip PT2272 is the receiving valid status indication, which is connected to the single-chip I/O port P3.2 (INT0) on the power strip control system; the 10th to 13th pins (D0-D3) are the four data pins after decoding, which are respectively connected to the single-chip I/O ports P2.0-P2.3; the 1st to 8th pins are three-state (VSS, VDD, empty) encoding pins; the 1st pin (RXD) of the LM358 outputs the demodulated square wave signal. [page]

  From the sampling results of the logic analyzer, it is known that when PT2272 receives valid coded data, the VT terminal will output a high level. Using this feature, the external interrupt trigger mode of the MCU can be set to falling edge trigger, and the output of the VT terminal when the wireless receiving module receives valid data can be used to drive the external interrupt of the MCU. In the external interrupt handler, the 4-bit data sent by the remote control is received, and four consecutive 4-bit data receptions are a complete transmission process.

  3.1.2 Working Principle of Wireless Transceiver Module

  The wireless transmission module is composed of the coded signal sent by the coding chip PT2262: the address code, data code, and synchronization code form a complete codeword. After the decoding chip PT2272 receives the signal, the address code is compared and checked twice, and the VT pin outputs a high level. At the same time, the corresponding data pin also outputs a high level. If the transmitter keeps pressing the button, the coding chip will transmit continuously. When no button is pressed in the transmitter module, PT2262 is not powered on, its 17th pin is low, and the 315MHz high-frequency transmission circuit does not work; when a button is pressed, PT2262 is powered on, and its 17th pin outputs a modulated serial data signal. During the period when the 17th pin outputs a high level, the 315MHz high-frequency transmission circuit starts to oscillate and transmits a high-frequency signal of equal amplitude. During the period when the 17th pin outputs a low level, the 315MHz high-frequency transmission circuit stops oscillating. Therefore, the high-frequency transmitting circuit is completely controlled by the digital signal output from pin 17 of PT2262. Therefore, the amplitude monitoring (ASK modulation) of the high-frequency circuit is equivalent to the amplitude modulation with a modulation index of 100%.

  3.1.3 Communication protocol between wireless transceiver modules

  The power strip control system and the remote control send and receive data through a wireless module composed of PT2272 and PT2262 paired chips. Due to the performance limitations of the chip, there is no built-in communication timing and protocol, and only 4 bits of binary data can be sent each time. Therefore, we have developed our own communication protocol to communicate complex data. We propose that sending 4 bits of data four times is a complete communication process. The specific operation is shown in Figure 5. Here, it is assumed that two power strip sockets are controlled.

Figure 5 Communication protocol between wireless transceiver modules

Figure 5 Communication protocol between wireless transceiver modules

  3.2 Socket System Hardware Circuit Design

  Figure 6 is the circuit diagram of the power strip remote control, which consists of four buttons and a FYD12864 LCD module to form a human-computer interaction interface. The functions of the four buttons are: up, down, confirm and cancel. Since the single-chip microcomputer has a relatively large interference with the wireless module, PC817 is used here for optical coupling isolation.

Figure 6 Power strip remote control circuit diagram

Figure 6 Power strip remote control circuit diagram

  Figure 7 is the circuit diagram of the power strip controller. The wireless receiving module receives the data sent by the remote control, controls the relay to turn on and off, and then controls the power strip. Four LED color blocks indicate the working status of the power strip, and two buttons can manually control the relay.

Figure 7: Plug and Play Controller Circuit Diagram

Figure 7 Socket controller circuit diagram [page]

  3.3 Data error correction function

  Due to the interference sources in the environment, the communication of the wireless transceiver module will inevitably cause frame loss or bit errors, so the power strip control system must have a certain error correction function. We adopt the following method to perform error correction: when the power strip control system receives incomplete data (complete data is four 4-bit data), after waiting for 0.3s (data retention time), if no valid data is received, it means that data frames are lost during the communication process. At this time, the previously received incomplete data frame is deleted from the memory unit, and the original data is discarded and waits for the next transmission of valid data.

  That is, the receiving program only processes valid matching data and directly discards invalid data. This can effectively avoid the situation where the program of the power strip control system runs out of control when errors occur in communication.

  4. Smart power strip software design

  The plug-in system software adopts 51 single-chip C language modular programming, and is mainly composed of the main program, remote control operation program, plug-in operation control system program, LCD display program, etc. Here is the flow chart of the remote control operation program and the flow chart of the plug-in operation control system (see Figure 8 and Figure 9).

  Due to space constraints, the flowcharts of other modules will not be repeated here.

Figure 8 Remote control operation program flow chart

Figure 8 Remote control operation program flow chart

Figure 9 Flowchart of the power strip operation control system

Figure 9 Flowchart of the power strip operation control system

  5 Conclusion

  This system uses a 51 single-chip microcomputer to control the power strip, which is innovative. It can be completely shut down by remote control, without the problem of standby power consumption, and is environmentally friendly and energy-saving.

  Completely shut down the appliance to give it a full rest, extend the service life of the appliance, and improve the safety of electricity use. The timer switch makes old appliances intelligent and user-friendly without replacement. In short, the power strip has a simple hardware circuit, good stability, high working reliability, and has great promotion and application value.

References:

[1]. AT89S52 datasheet http://www.dzsc.com/datasheet/AT89S52+_970343.html.
[2]. PT2272 datasheet http://www.dzsc.com/datasheet/PT2272+_1076352.html.
[3 ]. PT2262 datasheet http://www.dzsc.com/datasheet/PT2262+_1071334.html.
[4]. LM358 datasheet http://www.dzsc.com/datasheet/LM358_1060605.html.
[5]. PC817 datasheet http://www.dzsc.com/datasheet/PC817_542406.html.

Reference address:Design and implementation of intelligent socket strip based on 51 single chip microcomputer

Previous article:Design of a wireless calling system based on single chip microcomputer
Next article:Intelligent Street Light Simulation System Controlled by Single Chip Microcomputer

Recommended ReadingLatest update time:2024-11-16 21:47

Design of voice broadcast note-taking device based on AT89S52 microcontroller and ISD4004 voice chip
introduction With the development of digital electronic technology and the emergence of microcontrollers such as microcontrollers, voice storage and automatic playback have become easy to implement. At present, voice storage and automatic playback systems have been widely used in daily life. Voice station announcers o
[Microcontroller]
Design of voice broadcast note-taking device based on AT89S52 microcontroller and ISD4004 voice chip
AT89S52 controls DS1302 clock program
#include reg51.h   /****************************ds1302 and at89s52 pin connection********************/  sbit T_RST=P3^5;   sbit T_CLK=P3^6;                   sbit T_IO=P3^7;                           sbit A CC 0=ACC^0;  sbit ACC7=ACC^7;  unsigned char seg ={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09}; //0~~9 s
[Microcontroller]
AT89S52 and LCD1602 (asm/c51)
  LCD1602 DDRAM address mapping table: The first line address is 80H The second line address is C0H Interface between MCU and LCD1602 ;///////////////////////////////////////////////////////// Project name: AT89S52 and LCD1602 interface Experimental function: Display WWW.LZY.EDU.CN on the first
[Microcontroller]
AT89S52 and LCD1602 (asm/c51)
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号