Design of a Guest Room Communication Controller Based on CAN Bus

Publisher:BlissfulHikerLatest update time:2009-08-31 Source: 微计算机信息 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Reference address:Design of a Guest Room Communication Controller Based on CAN Bus

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

Win11 Cloud PC may be released during the Inspire conference on July 14
   IT Home Previously, Microsoft released the Windows 11 system, which simplified the interface design and user operation. The new Windows is more modern, neat and beautiful. Whether it is the new "Start" key and taskbar, or every sound, font and icon, everything has been carefully designed to give you free control. M
[Mobile phone portable]
Win11 Cloud PC may be released during the Inspire conference on July 14
Using USART to realize communication between MCU and PC
;Purpose of the experiment: Get familiar with USART communication ;Use the "Serial Debug Assistant" to assist in the work ;The Serial Debug Assistant sends data to 877, and 877 forwards it back to the Serial Assistant after receiving it ;Hardware requirements: All the S7 dip switches are set to ON, and t
[Microcontroller]
Implementation of command batch processing in serial communication between PC and microcontroller
    Abstract: This article introduces the implementation ideas, methods, communication protocols and C51 program platform of batch processing commands for communication between PC and MCS-51 microcontroller. It provides a new method for the design of serial communication program between PC and microcontroller.   
[Industrial Control]
WeChat PC version 3.6.0 officially released: finally supports adding friends
      For a long time, the PC version of WeChat has been complained by users because it has never had the function of adding friends. For office workers, if they want to add friends, they have to pick up their mobile phones to operate, which is very inconvenient.   Today, WeChat released the official version update of
[Mobile phone portable]
WeChat PC version 3.6.0 officially released: finally supports adding friends
Gartner: Global AI PC shipments are expected to account for 43% of total PC shipments in 2025
By 2026, Al laptops will be the only choice for large enterprise laptops According to the latest forecast from Gartner, global shipments of artificial intelligence personal computers (AI PCs) will reach 114 million units in 2025, a 165.5% increase from 2024 . Gartner defines AI P
[Home Electronics]
Gartner: Global AI PC shipments are expected to account for 43% of total PC shipments in 2025
Summary of knowledge on communication between 51 MCU and PC
The serial port of the 51 single-chip microcomputer is a full-duplex serial port, which can send data and receive data at the same time. When the serial transmission is completed, the flag bit TI will be set to 1. Similarly, when the data is received, the flag bit RI will be set to 1. No matter RI or TI is 1, as l
[Microcontroller]
PC and MCU communication (89c52 VB control LED)
//MCU C code #include reg52.h   #include string.h   #define INBUF_LEN 4 //数据长度  unsigned char inbuf1 ;  unsigned char checksum,count3;  bit read_flag= 0 ; sbit p1=P1^0; sbit p2=P1^1; sbit p3=P1^2; sbit p4=P1^3; sbit p5=P1^4; sbit p6=P1^5; sbit p7=P1^6; sbit p8=P1^7; void init_serialcomm( void )  {  S
[Microcontroller]
Latest Security Electronics Articles
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号