Abstract: This paper develops a data communication terminal based on power line transmission medium. The system is fully compatible with the HomePlug standard and has many advantages such as low cost, high speed and good confidentiality. It can be used to build power line networks and realize high-speed information interaction of digital and intelligent systems such as video on demand, VoIP, and remote monitoring. The network terminal can complete the conversion between power line data packets and Ethernet data packets, so it is easy to develop power line communication application systems just like developing general Ethernet application systems.
Power Line Communication (PLC) is a new communication technology that has developed rapidly in recent years and uses power line networks as carriers. Using embedded systems and power line modulation and demodulation technology to build power line network communication terminals, people can easily build local area networks in offices, homes, and industrial sites, becoming a good system construction method for smart homes and distributed industrial process control, with broad application prospects and markets. This application system uses power line terminal platforms and routers to build a power line home network to achieve centralized management of home appliances, security precautions, and three meters; it connects to the Internet through broadband, and remote terminals can query and control the status of home appliances through software. The specific construction method is to place a power line communication terminal platform in each room, living room, and kitchen, mount it on the power line to form a home network, and centrally manage all appliances. At the same time, the power line modulation and demodulation module is used to connect the router, and the entire home network is interacted with the Internet through ADSL Internet access, so that the remote terminal can access the home LAN through the Internet.
1. System Function and Design
The main functions of this application system are as follows: 1) Real-time monitoring of the temperature in the living room. For example, if the temperature exceeds 33 degrees in summer, the system will actively control the cooling air conditioner to turn on; if the temperature is below 10 degrees in winter, the heating air conditioner will be turned on. 2) The residential security system can upload security information by connecting to the power line communication terminal platform and the GPRS interconnected with it. For example, when someone illegally enters the house, the system will send early warning information to the pre-set alarm receiving terminal through the Internet network in real time, such as the 110 alarm station, the property service company monitoring room, the owner's office phone or the owner's mobile phone. 3) The owner can access home appliances through the remote terminal and implement remote control, such as turning on and off fluorescent lights and turning on rice cookers, so that he can eat fragrant rice when he gets home from get off work.
In order to realize the above functions, the GPIO (general purpose I/O) port of LPC2210 on the CPU module is used to connect the relay to control the switch of household appliances, such as rice cookers, air conditioners and fluorescent lamps; the chip external interrupt is used to connect the security system, and when the system alarms, the external interrupt is triggered to notify the ARM CPU to send the alarm information using GPRS; at the same time, LED lights and A/D conversion circuits are installed on the hardware circuit to test and display the current operating status of various household appliances in real time. This application system involves two aspects: programming of the power line communication platform and programming of the PC. Among them, the CPU module (lower computer) is used as the server side, using TCP as the communication protocol to provide services. After receiving the service request, the server side parses the request and provides corresponding services according to different requests. The PC, as the client, sends a service request and displays the specific content on the screen after receiving the server's response. In this example, the client uses the Qt visual programming environment. In the following, the relevant knowledge of Qt is first introduced, and then the application design is specifically analyzed by the server and the client.
2. Qt Introduction
Qt is a comprehensive C++ application development framework. It includes a class library and tools for cross-platform and international development. Qt is a comprehensive development framework that includes a wide range of features, capabilities and tools to develop high-performance, cross-platform client and server applications.
At the same time, Qt encapsulates specialized APIs for different platforms (Unix, Windows, and Mac), such as file handling, network (operation, protocol), process handling, threading, database access, etc. The unified cross-platform API allows programmers to focus on value-added technological innovations without worrying about maintaining and managing the infrastructure and interfaces of multiple versions of existing applications. Qt has been tested by thousands of commercial and open source application developers on multiple operating systems and compilers, laying the foundation for high-performance and resource-intensive applications. Qt does not require a "virtualizer", simulation layer or large-capacity runtime environment. It is written directly into low-level graphics functions like a local application, so Qt programs can be executed at source code speed. By using Trolltech's dual licensing model, Qt presents all the advantages of open source under a framework that is both commercially supported and effective: the open source advantages include an active open source developer community. Due to Qt's uninterrupted development and complete code transparency, Qt developers are allowed to "thoroughly and deeply view" and customize and expand Qt to meet their unique needs. The commercial product guarantee includes customer-approved product support, a dedicated Qt development team, and a growing ecosystem of third-party tools, components and services.
(1) Signal
When a signal's client or owner changes its internal state, the signal is emitted by an object. Only the class that defines this signal and its derived classes can emit this signal. When a signal is emitted, the slot associated with it will be executed immediately, just like a normal function call. The signal-slot mechanism is completely independent of any GUI event loop. The emission function (emit) will only return after all slots return. If there are multiple slots associated with a signal, then when this signal is emitted, these slots will be executed one after another, but the order in which they are executed will be random and uncertain. We cannot manually specify which one will be executed first and which one will be executed later. The declaration of the signal is carried out in the header file. The Qt signals keyword indicates that the signal declaration area has been entered, and then you can declare your own signal.
(2) Slot
Slots are ordinary C++ member functions that can be called normally. Their only special feature is that many signals can be associated with them. When the signal associated with them is emitted, the slot will be called. Slots can have parameters, but slot parameters cannot have default values. Since slots are ordinary member functions, they also have access rights like other functions. The access rights of a slot determine who can be associated with it. Like ordinary C++ member functions, slot functions are also divided into three types, namely public slots, private slots and protected slots.
3. Server
In this application, the power line communication terminal platform connects to household appliances as the server side. While displaying the status of electrical appliances in real time, a TCP server needs to be built to provide services for remote terminals to realize remote control and alarm functions. In the network protocol stack based on the QF operating system, the QL4 interface class implements the parsing and processing abstraction of the L4 protocol (transport layer). In this application, a QTcp class needs to be derived to implement the TCP protocol of the transport layer.
Processing abstraction. In this application, a QTcp class needs to be derived to implement the TCP protocol of the transport layer. Generally, TCP-based network applications must inherit the QTcp class, and then add sub-states in the ESTABLISHED state to complete specific functions. On the server side, a QServer class is implemented using the quantum framework. It is an active object that inherits from the QTcp class. After the QServer active object is connected to the client TCP Socket, it enters the ESTABLISHED state, receives the client's request by calling the Recvfrom function, and then parses the requested service type, and provides different services according to different requests. Its software flow chart is shown in Figure 1:
Figure 1 QServer active object state flow chart
The specific services that the server needs to provide include: (1) When receiving a request from the client to turn on household appliances, use the GPIO port to send a level signal to turn on the relevant appliances through the relay. (2) Monitor the temperature in the living room. If it exceeds 33 degrees in summer, the cooling air conditioner will be actively controlled to turn on. In winter, if it is below 10 degrees, the heating air conditioner will be turned on. The air conditioner switch information is transmitted to the remote terminal through the TCP protocol in a timely manner. (3) When someone triggers the security system and an external interruption occurs, the server sends an alarm signal to the client. And send warning information to the 110 alarm station, the property service company monitoring room, the owner's office phone or the owner's mobile phone through GPRS.
4. PC Client
As a remote client, the main task of the PC is to send service requests to the server, and after receiving the server's response or alarm signal, the specific content received is displayed on the screen to achieve the functions of remote control and alarm. In this example, I use the Qt visual programming environment. The following introduces the specific functions and implementation of the client: By pressing the fluorescent lamp or rice cooker button on the client's visual interface, a request to turn on and off household appliances can be sent to the server, and the server will execute it after receiving the request; similarly, by pressing the A/D button, a request to read A/D can be sent, and after receiving the A/D value collected by the server, the client will display it on the screen; the temperature measurement is to send a request every two seconds, read the current temperature, display it on the screen, and determine whether to turn on the air conditioner, and read its status information from the server, update the switch status bar of the air conditioner, and display it in the text box; when the server-side security system detects an intrusion, it will send an alarm signal to the client, and the client needs to modify the current security system status to alarm accordingly.
First, use Qt's tool Qt Designer to design the interface. Then enter the specific client programming stage and construct a form class called TcpClient class. The specific software is written as follows:
TcpClient::TcpClient(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
adsocket = new QTcpSocket(this); //TCP channel for transmitting A/D data
tempsocket = new QTcpSocket(this); //TCP channel for transmitting temperature data
applincesocket = new QTcpSocket(this); //TCP channel used to control household appliances
securitysocket = new QTcpSocket(this); //TCP channel for security system alarm
QTimer *temptimer = new QTimer(this); //2S timer
connect(temptimer,SIGNAL(timeout()),this,SLOT(temp_update()));
temptimer->start(2000);
connect( adsocket,SIGNAL( connected() ),this, SLOT( ad_request() ) );
connect( adsocket,SIGNAL( readyRead() ), this, SLOT( ad_readresult() ) );
connect( tempsocket,SIGNAL( connected() ),this,SLOT( lm_request() ) );
connect( tempsocket,SIGNAL( readyRead() ),this,SLOT( lm_readresult() ) );
connect(appliancesocket,SIGNAL( connected() ), this,SLOT( appliance_request() ) );
connect(securitysocket,SIGNAL( readyRead() ),this,SLOT( security_readresult() ) );
}
Dynamically allocate four QTcpSocket (Qt's internal encapsulation class for TCP protocol) objects, and use the object pointers of this class, adsocket, tempsocket, appliancesocket, and securitysocket, to point to these four objects. Then define a QTimer object to implement a 2-second timing. Then connect some signals and slots to complete the communication between the components, including: the timeout signal of the QTimer object is connected to the temp_update() slot, the connected signal of the adsocket object is connected to ad_request(), and the readyRead signal of the adsocket object is connected to the ad_readresult() slot. Similarly, connect the signals and slots of several other QTckSocket objects.
The following describes in detail how to implement the temperature detection and air conditioning automatic control functions (the implementation of other functions is similar and will not be repeated): (1) The timer is triggered every 2 seconds, and the client uses tempsocket to connect to the server and send a temperature measurement request. (2) After receiving the temperature data from the server, it is displayed on the interface, and the air conditioner is decided based on the requirements. (3) Use appliancesocket to send a command to turn on or off the air conditioner. And modify the air conditioner switch status bar display based on the execution result of the server.
V. Conclusion
In the actual test, the server was run in the laboratory, connected to fluorescent lamps, rice cookers and air conditioners. The client was run in the dormitory. On the basis of realizing all functions of this application, the power line terminal was turned on continuously as a server for a week and carried out a high-flow load test. It was able to run stably, and all functions performed normally without any failure. This verified the stability of this terminal and the feasibility of this smart home application.
Previous article:Design of a Novel BiCMOS Bandgap Reference Circuit
Next article:Problems and design requirements of urban landscape lighting
- MathWorks and NXP Collaborate to Launch Model-Based Design Toolbox for Battery Management Systems
- STMicroelectronics' advanced galvanically isolated gate driver STGAP3S provides flexible protection for IGBTs and SiC MOSFETs
- New diaphragm-free solid-state lithium battery technology is launched: the distance between the positive and negative electrodes is less than 0.000001 meters
- [“Source” Observe the Autumn Series] Application and testing of the next generation of semiconductor gallium oxide device photodetectors
- 采用自主设计封装,绝缘电阻显著提高!ROHM开发出更高电压xEV系统的SiC肖特基势垒二极管
- Will GaN replace SiC? PI's disruptive 1700V InnoMux2 is here to demonstrate
- From Isolation to the Third and a Half Generation: Understanding Naxinwei's Gate Driver IC in One Article
- The appeal of 48 V technology: importance, benefits and key factors in system-level applications
- Important breakthrough in recycling of used lithium-ion batteries
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- Potential Problems Using Decibel Calculations
- What an RF engineer should know
- The 2020 ST MEMS Sensor Creativity Competition Award Ceremony pays tribute to those who dare to challenge and persist~
- LCD segment screen photolithography is bad---floating glue
- Share Keil's background color and font configuration files and VS Code
- Arm Cortex-M low power modes basics
- I would like to ask you about the problem when starting MINI6410
- MicroPython User Development Guide
- [Modelsim FAQ] No waveform can be simulated and the waveform window has no content
- Accidentally leaked company source code to GitHub, fined 200,000 and sentenced to six months in prison!