Implementation of Communication Function of Automotive Four-Wheel Alignment System Based on RS-485 Bus
2026-04-06 09:06:22··#1
Abstract: An automotive four-wheel alignment system is a distributed computer measurement and control system. This paper introduces how to implement communication between a single PC and multiple microcontrollers in an automotive four-wheel alignment system via an RS-485 bus and the MSComm communication control using VB 6.0 ActiveX controls. Keywords: RS-485; serial communication; four-wheel alignment; VB; detection 1. Introduction During normal driving, a car should have easy steering and the ability to automatically maintain straight-line driving. Simultaneously, the steering wheels should be as purely rolling as possible to reduce tire wear and fuel consumption. These requirements are typically achieved through four parameters of steering wheel alignment (caster angle, kingpin inclination angle, wheel camber angle, and toe-in). Since most cars currently use front-wheel steering, steering wheel alignment is usually referred to as front-wheel alignment. Modern cars not only have alignment parameters for the front wheels, but many sedans also have alignment parameters for the rear wheels, including toe-in, camber, and thrust angle. The purpose is to ensure that the movement trajectories of the front and rear wheels on the road surface are as similar as possible, guaranteeing stability and safety at high speeds and helping to reduce wear on tires and suspension components. After a car has been in operation for a certain period or after replacing certain parts, the four-wheel alignment parameters will change. Therefore, it is necessary to check the vehicle's alignment parameters promptly or periodically. If they exceed the manufacturer's specified standard values, adjustments should be made to restore the vehicle's driving stability, safety, fuel economy, and reduce wear on tires and related components. There are two methods for wheel alignment testing: dynamic testing and static testing. Dynamic testing uses a sideslip test bench to test the matching of the front wheel toe-in and camber angles while the car is in motion. Its advantages are simple operation and high speed, making it very suitable for rapid testing, but it cannot measure individual wheel alignment values. This testing method is widely used in vehicle safety inspection lines or comprehensive inspection lines. Static inspection uses a four-wheel alignment machine, which can measure various alignment parameters of the wheels when the car is static. It is currently the most widely used method for wheel alignment inspection. There are three main types of four-wheel alignment machines in China: wire-operated, wireless measurement with wired transmission, and fully wireless. Wire-operated four-wheel alignment machines are largely obsolete due to their inconvenience and numerous factors affecting measurement accuracy. Fully wireless machines use optical non-contact measurement, with wireless information transmission between the main unit and sensors, resulting in high measurement accuracy and ease of use. The main difference between wired measurement with wireless transmission and fully wireless machines is that wired transmission uses signal cables to transmit test data. Although less convenient than fully wireless machines, they offer advantages such as fast and reliable information transmission and detection speeds, no need for battery replacement or charging, and low operating costs, and are still widely used. Modern four-wheel alignment machines are all microcomputer-controlled. The host computer (PC) responsible for control and management is connected to several slave computers (microcontrollers) responsible for data acquisition via a fieldbus, forming a distributed computer control and measurement system. The design and selection of communication system hardware and software are key technologies in the design of a four-wheel alignment machine, significantly impacting its overall performance. The RS-232C serial communication interface is a standard configuration for PCs, offering simplicity and ease of programming, but it can only be used for connections between two microcomputers, failing to meet the needs of multi-connection connections. We adopted the RS-485 communication interface, currently popular in industrial measurement and control systems, and conveniently implemented centralized control and data acquisition of multiple microcontrollers using the MSComm communication control in VB 6.0, effectively solving the communication problem in the four-wheel alignment machine. 2. System Composition of the Four-Wheel Alignment Machine The system composition of the four-wheel alignment machine is shown in Figure 1. The entire system consists of one host computer and four slave computers. The host computer is a PC microcomputer responsible for controlling the measurement process, reading the detection data from the slave computers, data processing and calculation, and displaying, storing, printing, and managing the results. Each of the four slave computers is a microcontroller system, using the AT89C51 microcontroller, used to implement the measurement control and data upload functions for the alignment angles of each wheel. The microcontrollers are located inside the housings of the front left, rear left, front right, and rear right rotors. The rotors are connected to clamps, and during measurement, the rotors are fixed to the rims of the four wheels of the car via the clamps. The entire system uses fourteen sensors. Six precision tilt sensors (two for each of the front rotors and one for each of the rear rotors) measure angles in the vertical plane (including caster angle, kingpin inclination angle, and wheel camber angle). Eight PSD (Position Sensitive Detector) optical sensors (two sets for each of the front and rear rotors) measure the wheel positioning angles in the horizontal plane. 3. System Communication Function Hardware Implementation The standard RS-232 interface can only be used for connections between two computers. The two RS-232 interfaces COM1 and COM2 of the PC can only connect a maximum of two microcontrollers. Adding a serial communication card to connect the four serial ports to the four lower-level machines would be expensive and structurally complex. Therefore, the RS-485 bus, currently popular in distributed industrial measurement and control systems, is adopted. Compared with RS-232, RS-485 interface has the following characteristics: (1) The interface level is lower than that of RS-232 C interface, which is less likely to damage the chip of the interface circuit, and the level is compatible with TTL level, which can be easily connected to TTL circuit. (2) High data transmission rate, with a baud rate of up to 10Mbps. (3) It adopts balanced driver and differential receiver, which has strong anti-common mode interference capability, that is, good anti-noise interference capability. (4) Long transmission distance, with a maximum transmission distance of 4000 feet. (5) Up to 256 transceivers can be connected on the bus, which has multi-station capability. Users can easily establish a communication network using a single RS-485 interface. In this system, the PC is connected to four heads through RS-232 interface and RS-232/RS-485 conversion module. The microcontroller of each head is also connected to the bus through RS-485 interface module and is assigned its own communication address code to identify its identity. The RS-485 transceiver used by the microcontroller is the Maxim Integrated MAX3082, a high-speed transceiver chip with fail-safe protection and slew rate limiting. This allows the host PC to communicate with the microcontroller of each machine head via the RS-485 bus, enabling data acquisition and process control of positioning parameters. 4. System Communication Function Software Implementation 4.1 System Communication Method Communication between the PC and each machine head uses a half-duplex mode with a baud rate of 9600bps. The communication format is: 1 start bit, 8 data bits, no parity check, 1 stop bit. Each machine head is assigned a unique local address. The host initiates communication and data acquisition by sending a command frame. After receiving the command frame, the slave determines whether the calling address is the same as its local address. If they are the same, the slave executes the corresponding data acquisition according to the command word and transmits the detection result to the host via a data frame. If they are different, the slave determines whether to emit infrared measurement light based on the address and command word. The format of a command frame is as follows: The first item is the frame header (STX), used to mark the beginning of a frame; the second item is the slave address code (ADDR); the third item, the command word, indicates the data content returned by the head unit or the content of this detection; the fourth item, FCS, is the XOR checksum, which is the XOR checksum of the preceding data used for communication error correction. The format of a data frame is as follows: Except for the third item, the data frame and the command frame have the same meaning. The third part of the data frame contains the positioning parameter detection data sent by the slave to the master based on the command frame issued by the master. 4.2 Implementation of MSComm Control and Serial Communication Control in VB6.0 VB6.0 provides an ActiveX control—Microsoft Communication Control, Version 6.0, called the MSComm control, which can be used to conveniently manage computer serial port communication. The MSComm control has many properties related to the serial port, which will not be described in detail here. When the serial port receives information, the MSComm control provides two processing methods: one is the polling method, and the other is the event response method, that is, using the SetCommEvent() function to set the serial port response event. When a response event occurs, the system activates the OnComm() event. Adding user-processed code to the OnComm() event enables interrupt-like serial port event handling; this system employs an event-response approach. The PC communication software controls the detection process and reads and processes real-time wheel alignment parameter data. Data is received and sent in text format, and an alarm function is provided when the master calls the slave without response. The following is a partial source code example of control initialization and command sending. (1) Initialization of the control: MSComm1.CommPort=2 'Select COM2 port for communication MSComm1.Setting="9600,N,8,1" 'Set communication parameters MSComm1.Inputlen=0 'Read all contents of the buffer MSComm1.InBufferSize=50 'Set the size of the receive buffer MSComm1.OutBufferSize=20 'Set the size of the send buffer MSComm1.InputMode=comInputModeText 'Receive data in text format MSComm1.PortOpen=True 'Open the communication port MSComm1.InBufferCount=0 'Clear the receive buffer MSComm1.OutbufferCount=0 'Clear the send buffer (2) Sending the command (taking the front wheel toe-in as an example): Dim Command, node, c, f As string Dim i, fcs As integer node="01" 'Node number, indicating the right front engine Command="FT" 'Front wheel toe-in detection c="@"+node+Command fcs=0 For i=1 To Len(c) fcs=fcs Xor Asc(Mid$(c,i,1)) ' Frame Check Code FCS Next i f=Hex$(fcs) if Len(f)=1 Then f="0"+f MSComm1.Output=c+f 5. Conclusion The communication between the host PC and multiple slave devices in the automotive four-wheel alignment instrument was realized through RS-485 bus and ActiveX control under VB6.0. Practice has proved that the communication function of this system is reliable and the design is reasonable. References [1] Elite Technology Translation. Complete Guide to Serial Ports [M]. China Electric Power Press. 2001 [2] Gong Peizeng, Lu Weimin, Yang Zhiqiang. Visual Basic Programming Tutorial (Version 6.0) [M]. Higher Education Press. 2000 [3] Zou Zongfeng, Pei Renqing. Using VB to realize communication between OMRON series PLC and microcomputer [J]. Mechatronics. 2001, (1): 59-60