1 Introduction
With the rapid development of computer technology, communication technology, information technology and control technology, people have put forward higher requirements for the functions, environment and management level of intelligent buildings. As an important part of the building automation system of intelligent buildings, the guest room control and management of hotels are developing in a safer, more comfortable, efficient, convenient and energy-saving direction. The guest room control and management of hotels have the characteristics of decentralized control and centralized management. The whole system involves many objects, which are distributed in different locations and have different control requirements. If the traditional one-to-one wiring is used, the wiring in the building will be complicated and difficult to maintain, the system cost will be high, the reliability will be low and the scalability will be poor. Therefore, fieldbus technology is widely used in modern intelligent building building automation systems.
This article introduces the design of guest room communication controller based on CAN bus, combining the guest room control and management examples of hotels.
2 System Structure
The overall structure of the guest room control and management system is shown in Figure 1. The entire system consists of three layers: field control layer, monitoring layer and management layer. The field control layer is mainly composed of the guest room controllers or other control devices in the hotel; taking a guest room node as an example, each guest room controller can control various devices such as air conditioners, lights, background music, doorbells, alarms, etc. in the guest room, and can also receive customer demand information and upload the information to the communication controller of the monitoring layer. The main task of the communication controller of the monitoring layer is to filter the amount of information and upload the information to the management layer, while receiving the control instructions of the management layer to operate the recorded data and each node. The repeaters on each floor can increase the maximum number of nodes and expand the communication distance. The management layer is mainly composed of the central server, the main station PC, the engineering department PC, the service center PC, etc., which is mainly used for the comprehensive management and control of information, and has the functions of summarizing the information uploaded by each node, comprehensive decision-making, data query and processing, fault diagnosis, communication management, etc.
Figure 1 System overall structure diagram
Since the field control layer has many nodes and wide distribution, its communication system should have good reliability, adaptability, scalability and simple connection mode, and meet the needs of long-distance transmission and convenient field debugging. Therefore, the field control layer adopts the CAN bus, which is simple and flexible to use, highly reliable, real-time and low-cost. The central server PC, the main station PC, the service center PC, etc. of the management layer communicate with each other through Ethernet. The CAN communication controller of the monitoring layer provides an interface between the central server PC of the management layer and the CAN bus of the field control layer, that is, the data and commands of the central server PC are transmitted to the specified CAN network nodes, and the data of each network node are transmitted to the central server PC for further processing.
3 Hardware Circuit Structure
The hardware circuit structure of the CAN bus communication controller is shown in Figure 2. It mainly includes the main controller, clock holding circuit, non-volatile EEPROM memory, CAN bus interface circuit and RS232 interface circuit. The main controller adopts the AT89C51 microcontroller with high cost performance, simple structure and easy programming. It is mainly used to initialize the CAN controller SJA1000 and RS232 serial port, and realize the data exchange and other communication tasks between the field CAN bus and the central server PC of the management layer through the control operation of the CAN controller SJA1000 and RS232 serial port.
[page]
The CAN bus interface circuit is mainly composed of the CAN communication controller SJA1000, the high-speed optocoupler 6N137 and the CAN bus driver 82C250. As a controller for CAN bus protocol conversion, SJA1000 has a built-in BASIC CAN protocol and provides support for CAN2.0B protocol. By reading and writing the on-chip registers, the main controller microcontroller can set the CAN bus communication mode to realize data sending and receiving.
SJA1000 realizes the encoding and decoding of transmission data logically. If it is to be connected to the physical line, it must also use the bus driver 82C250 to enhance the differential transmission and reception driving capabilities of the CAN bus. In order to enhance the anti-interference ability of the CAN bus node and prevent crosstalk between lines, the TX0 and RXO of SJA1000 are not directly connected to the TXD and RXD of 82C250, but are connected to 82C250 through the high-speed optical coupler 6N137; In addition, the CAN bus driver is powered separately by an isolated DC/DC module, which realizes the isolation of the communication controller and the CAN bus and improves the reliability of the system.
The CANH and CANL pins of 82C250 are connected to the CAN bus through a thermistor. When overcurrent occurs, the resistor heats up and the resistance value increases, protecting 82C250 from overcurrent impact. Two small capacitors are connected in parallel between CANH and CANL and the ground, which can filter out high-frequency interference on the bus and have a certain ability to prevent electromagnetic radiation.
The RS232 interface circuit is mainly used for bidirectional data transmission between the main controller microcontroller and the management central server PC. Because it adopts standard RS232 serial communication, it has a simple structure and low cost.
Other peripheral circuits of the controller include power module, non-volatile EEPROM memory, clock holding circuit, LED indicator light and watchdog. The non-volatile EEPROM memory uses AT24C02 with a capacity of 2KB, which is used to save system configuration parameters and the latest information of each node, which is convenient for management to query. The clock holding circuit uses the trickle charging clock chip DS1302, which contains a real-time clock and calendar. It communicates with the microcontroller through a simple serial interface and is used to calibrate the time of each node controller. At the same time, the controller is also equipped with 4 LED indicators, which are used for system power-on, CAN communication, RS232 communication and system communication failure indication, so as to facilitate system debugging and monitoring of the controller's operating status.
4 System Software
The main task of the CAN communication controller is to filter the amount of information, upload the field layer information to the management layer, and receive the control instructions of the management layer to operate the recorded data or each CAN node. The CAN communication controller also has the functions of data recording and zero-point time calibration. Therefore, the controller software design mainly includes four parts: CAN communication, RS232 communication, reading and writing of EEPROM data, and reading and writing of system clock DS1302. The main flow chart of the program is shown in Figure 3.
[page]
Figure 3 Controller software flow chart
CAN communication software includes three parts: CAN initialization, message reception and message sending. When the controller is powered on, the CAN controller SJA1000 is initialized first, mainly including the setting of working mode, receiving filter mode, receiving mask register and receiving code register, baud rate parameter setting and interrupt enable register setting. SJA1000 initialization can only be performed in reset mode. After completing the initialization setting of SJA1000, it returns to the working state and starts to cyclically monitor the information on the CAN bus. The message is received in interrupt mode to ensure the immediate response of the system. In the process of message reception, the bus shutdown, error alarm, receiving overflow and other situations must be handled at the same time. The sending of messages is relatively simple. You only need to form a group of messages into the sending buffer of SJA1000 to start sending. RS232 communication software includes RS232 initialization and communication with the central server PC of the management layer; the controller uses query mode to receive data from the central server PC.
The reading and writing of EEPROM24C02 memory data and clock chip DS1302 are simply communicated in synchronous serial mode. When the controller receives the information of the node, it will upload this information to the management level, and write this information into AT24C02 memory at the same time, and save it as historical information for the management level to query. The zero-point time calibration function of the controller is to read the clock of DS1302. When the clock is zero, the time calibration of each field CAN node is unified, avoiding the accumulation of clock errors of each CAN node.
5 Conclusion
The guest room communication controller based on CAN bus has been successfully applied in the guest room control and management system of the hotel. Practice has proved that due to the use of CAN bus technology, not only the system structure is simple, adaptable and scalable, but also the CAN bus effectively improves the reliability of communication with its technical features of time-sharing multi-master, non-destructive bus arbitration and automatic error detection and retransmission, making on-site debugging more convenient and shortening the development cycle.
Previous article:Design of remote wireless monitoring system for cooking fume based on GPRS
Next article:DNC Remote Diagnosis and Monitoring System Based on CAN Bus
Recommended ReadingLatest update time:2024-11-16 17:38
- Popular Resources
- Popular amplifiers
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- Virtualization Technology Practice Guide - High-efficiency and low-cost solutions for small and medium-sized enterprises (Wang Chunhai)
- 2024 DigiKey Innovation Contest
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- Mir T527 series core board, high-performance vehicle video surveillance, departmental standard all-in-one solution
- Akamai Expands Control Over Media Platforms with New Video Workflow Capabilities
- Tsinghua Unigroup launches the world's first open architecture security chip E450R, which has obtained the National Security Level 2 Certification
- Pickering exhibits a variety of modular signal switches and simulation solutions at the Defense Electronics Show
- Parker Hannifin Launches Service Master COMPACT Measuring Device for Field Monitoring and Diagnostics
- Connection and distance: A new trend in security cameras - Wi-Fi HaLow brings longer transmission distance and lower power consumption
- Smartway made a strong appearance at the 2023 CPSE Expo with a number of blockbuster products
- Dual-wheel drive, Intellifusion launches 12TOPS edge vision SoC
- Toyota receives Japanese administrative guidance due to information leakage case involving 2.41 million pieces of user data
- 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!
- 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
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- 422 Driver Output Level
- NB-IoT application classification and technical characteristics analysis
- "Operational Amplifier Parameter Analysis and LTspice Application Simulation" 2. Chapter 2 Bias Current
- I2C Timing
- CUBEMX configures six-step square wave drive BLDC
- Resource Download: IoT technology is everywhere in the home
- [GD32307E-START] Development practice->K2 button + USART to achieve user interaction control + USRT print output status
- Looking for TI training course handouts!
- BQ24172 abnormal charging discussion and solution
- EEWORLD University Hall ---- Xiaomeige 2019 FPGA training course full HD recording