Abstract: A software and hardware implementation scheme of an electric sunroof durability test system based on VB serial communication is proposed. The system includes a host computer composed of a PC and a slave computer composed of a single-chip microcomputer. The host computer provides a good human-computer interaction interface; the slave computer uses integrated circuits, as well as signal sampling, V/F, F/V conversion and D/A conversion, and connects the single-chip microcomputer to the PC through serial communication. With this system, the durability test of various electric sunroofs can be conveniently, flexibly and accurately implemented.
1 Overview
The car sunroof is designed to meet the health and comfort requirements of consumers. Therefore, people's requirements for the performance of the sunroof are not only beautiful and luxurious, but also must meet all-round requirements such as safety, reliability, and smooth operation. Therefore, before installing the car sunroof, it is necessary to first conduct durability and safety tests to ensure that it meets the technical and user requirements after installation. However, the existing car sunroofs have problems such as insufficient travel, the sunroof cannot be opened; insufficient travel, the sunroof cannot be closed tightly, posing a threat to the car's anti-theft and rainproof; the control switch fails, resulting in the phenomenon of people being pinched, and other hidden dangers and problems.
At present, most domestic sunroof tests use a stand-alone lower computer system. Although this type of system can perform routine tests, it cannot record or feedback test information. The automotive sunroof test system we designed is divided into an upper and lower computer. The lower computer has an actuator to control the sunroof. It can not only control the sunroof's reciprocating movements and complete test items, but also has an automatic fault identification function and can automatically record the sunroof motor failure time. The upper computer displays the number of endurance tests and faults. Relying on the reliable communication between the upper computer and the lower computer, test operation, information transmission and information feedback are realized.
2 Key technologies of electric sunroof durability test system
2.1 Hardware Technical Characteristics
This hardware system is to realize the judgment of the sunroof opening and closing, stopping and necessary rest of the motor. It is mainly composed of two parts: detection circuit and control circuit. The system schematic diagram is shown in Figure 1:
Figure 1 Circuit diagram
In-place detection circuit: In the system, in order to ensure the durability of the sunroof test bench itself, the design uses a non-contact sensor (infrared photoelectric sensor) instead of a fragile contact sensor, and the sunroof can be flexibly adjusted to the open or closed position to meet the needs of users. The working principle of the sunroof in-place circuit is as follows: the circuit is composed of a 3D infrared transmitting tube, a 3E receiving tube and an LM324 operational amplifier. When the sunroof is not in-place or not closed, no signal is sent. Only when the sunroof is in-place will a signal be sent to the microcontroller.
Midway stop detection circuit: In the system, due to the load characteristics of the control object (sunroof motor), the sunroof motor is not allowed to work continuously to prevent the motor from overheating and affecting normal operation. In the subsystem for obtaining the midway stop signal, a sampling resistor is used to sample and hold. In order to ensure that the signal is not distorted, a two-stage amplifier circuit can be used, after V/F and F/V conversion (because the signal ground and the power ground cannot be shared), and then amplified by one stage, and connected to the microcontroller after comparison.
Alarm control circuit: The signal from 8255 controls the optocoupler through 7405. If the system is detected to be blocked, an alarm will sound.
Overcurrent protection control circuit: When the system is blocked, the relay opens and the motor stops working immediately.
Motor control circuit: After the open position signal (closed position signal) comes out from 8255, it controls the conduction of the optocoupler through 7405, and then controls the relay through the transistor to stop the motor for 30 seconds.
2.2 Software Technical Features
Single-chip microcomputer part: The lower computer part is composed of a single-chip microcomputer and an expansion interface circuit, mainly including 8031, address latch 74LS373, EPROM2764 used as an off-chip program memory, and 8255 for expanding the I/O port, and then communicates with the upper computer through the RS-232 interface. Since the input and output levels of the single-chip microcomputer are TTL levels, and the PC is equipped with an RS-232 standard serial interface, the electrical specifications of the two are inconsistent. Therefore, in order to complete the data communication between the single-chip microcomputer and the PC, the TTL level output by the single-chip microcomputer must be converted. A standard RS-232 chip MAX232 is used in this circuit. The lower computer software is written in assembly language, mainly consisting of the main program, delay subroutine, interrupt subroutine, skip motor start subroutine, handshake subroutine and stall current assignment subroutine. Its functions are as follows:
Figure 2 MCU program flow chart
Main program: completes system initialization and allocates and calls subroutines to realize system functions;
Delay subroutine: In order to meet the characteristic requirements of the sunroof motor, the motor is controlled to work discontinuously;
Interrupt subroutine: When the stall current is greater than the set current, the motor stops working;
Skip the motor start subroutine: When the motor starts, the current is very high and may exceed the stall current. This subroutine allows the motor to work normally.
Handshake subroutine: When the upper and lower computers are communicating, the handshake subroutine ensures reliable communication and reduces malfunctions;
Stall current subroutine: sets the stall current value to control the motor operation; part of the code is as follows, and the program flow chart is shown in Figure 2:
ORG 0000H
LJMP MAIN
ORG 000BH
LJMP TOT0
ORG 0030H
MAIN: MOV R6,#0FFH ; Delay subroutine, wait for 8255 to be completely reset
MAIN1: DJNZ R6, MAIN1
MOV P1,#0FFH
MOV SP,#40H
MOV DPTR,#7FF3H ; Write control word to 8255, PA, PB. PC output, 0010 0100 0000 0011
MOV A,#80H
MOVX @DPTR,A
MOV DPTR,#7FF0H ; PA outputs all 01111111
MOV A,#00H
MOVX @DPTR,A
MOV DPTR,#0BFFFH
MOV A,#0FFH
MOVX @DPTR,A
MOV TMOD,#22H; T1 is baud generator, mode 2, timing. T0 mode 2, timing
MOV TL1,#0F3H ; baud is 1200B/S
Upper computer part: It is composed of a PC and has a human-machine interface, as shown in Figure 3. Since the VISUAL BASIC language has a very friendly interface and plays a good role in its visualization characteristics, it is favored by the majority of programmers. Therefore, the software is written using the VB6.0 language environment, and the interface operation is convenient and direct. In this system, if you want to use upper and lower computer communication, you must use serial port technology. Serial port communication generally adopts RS232 or RS485 and other specifications, and there are dedicated chips to implement related hardware communication circuits. In the Windows environment, we can call API functions or directly use ActiveX serial port communication controls. It is more complicated to use API functions to write serial port communication programs. The MSComm communication control of VB6.0 is a standard communication command set, which provides an interface that allows programmers to establish a connection based on the serial port, which can confirm commands, exchange data, and monitor various events or errors that may occur at the serial interface, and can respond. In addition, VB6.0 provides the setting of serial communication port parameters through attribute methods, which can easily solve serial port communication problems. Moreover, the MSComm control shields the underlying operations in the communication process, making serial port programming very convenient. Therefore, when developing a system, using the MSComm control can shorten the design cycle and increase system reliability. At the same time, as long as you understand the parameters you need, you can write the host computer software in sequence, so here we use the MSComm control programming to achieve communication with the microcontroller. The parameters of the control are briefly described as follows:
CommPort: Set and return the communication port number;
PortOpen: Sets and returns the communication port status (true means open, false means closed);
InPut: Return and delete data from the receive buffer;
Output: Write data to the send buffer;
InBufferSize: sets and returns the size of the receive buffer;
OutBufferSize: sets and returns the size of the send buffer;
InputLen: Sets and returns the number of bytes that the Input property reads from the receive buffer at one time;
Settings: Set and return the baud rate, parity, data bits, and stop bit parameters;
InputMode: sets and returns the data type read by the Input property;
InBufferCount: Returns the number of bytes waiting in the receive buffer. When set to 0, it can also be used to clear the receive buffer.
OutBufferCount: Returns the number of bytes waiting in the send buffer. It can also be used to clear the output buffer when set to 0;
Figure 3 Test system interface
The serial communication program design first initializes the work, sets the communication baud rate and the format of the transmitted characters, including the number of character bits, the number of stop bits, the parity check method, etc. The baud rate of the communication in this system is 1200b/s, and the format of the transmitted characters is 1 start bit, 8 data bits and 1 stop bit, etc. Usually, once the character format is determined, it will not be changed in subsequent communications.
3 Conclusion
The automobile sunroof test system based on serial communication developed by us realizes test operation, information transmission and information feedback through the joint use of upper and lower computers, which improves the performance of the single-machine lower computer system that can perform routine tests but cannot record or feedback test information. At the same time, it has more functions such as fault identification. Considering that there may be other potential problems with automobile sunroofs, the test system has external interfaces to expand and improve more test functions.
Today, when my country is actively advocating an independent automobile industry, the design of the durability test system for the automobile sunroof provides an effective platform to ensure that the sunroof has high reliability during use. It can greatly improve the social and economic benefits of the automobile industry and has broad application prospects.
4. Innovations of the author of this article
The system realizes test operation, information transmission and information feedback through the joint use of the upper and lower computers. The lower computer controls the actuator of the sunroof, which can control the sunroof's round trip, opening, stopping, etc., and record the number of round trips of the sunroof; it can also automatically identify various faults, record the sunroof motor failure time, and terminate the test process at any time. In addition, the motor stall current is provided to meet the requirements of various sunroof motors. The upper computer provides a user-friendly interface, displays the number of durability tests, displays faults, and has the functions of recording the sunroof's immediate position, test progress, printing test results, and recording the time and location of the fault. The core is the communication reliability of the upper computer and the lower computer. In the design, the characteristic requirements for the sunroof motor are that it must pause for 30 seconds after working for a cycle, and this sunroof motor has a midway stop function. Since the sunroof needs to be tested for durability, we abandon the commonly used mechanical switch and use a durable photoelectric switch sensor to increase the system's working reliability and response speed, and ensure the instant and accurate test data.
In view of the slight differences in the application of this system for different car models and different sunroof design functions, the functions need to be continuously improved, and the specific economic benefits created by this need to be further counted and studied.
Previous article:Safety is the key point BMW launches two new automotive lighting technologies
Next article:Application design of automotive HID lamp based on UCC2305
- Popular Resources
- Popular amplifiers
- 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
- 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
- Looking to buy a TMS320F28379D development board
- What are the benefits of DSP program architecture?
- How is the development of purely domestic MCU? Pingtouge RISC-V chip development board review
- I have a question about the normalization calculation of multi-order low-pass filters. Thank you!
- Digital Signal Processing (DSP) Library for MSP430 Microcontrollers
- CCS6.0 creates a DSPc2000 series project operation steps
- Live FAQ: Renesas RA MCU family members are growing rapidly, helping to build safe and stable industrial control systems
- Bluetooth protocol analysis (5)_Technical analysis related to BLE broadcast communication
- [Voice and vision module based on ESP32S3] Software development progress - using openmvIDE, I can finally transfer pictures, the speed is...
- Check out the exclusive disassembly document! How do TWS earphones achieve hands-free and voice wake-up control?