The headlight meter is a special testing device used to test headlights. It is mainly composed of two parts: the automatic positioning system and the testing system. After receiving the testing command, it can automatically enter the lighting area of the tested headlight to track the optical axis, and then automatically detect the luminous intensity, height, and the irradiation direction of the high and low beams of the tested headlight. It can also automatically measure the headlights of the four-lamp system or the two-lamp system. After the test is completed, it automatically returns to the initial position and the test results are automatically sent out.
The design idea of this system is to amplify the light intensity signal sensed by the headlight meter at different positions during the movement through the light sensing device, obtain the corresponding control signal through the appropriate control algorithm, and then output this control signal to the motor, so that the headlight meter is positioned at the appropriate detection position through the motor, thereby completing the automatic positioning of the headlight meter. The hardware structure block diagram of the headlight meter is shown in Figure 1.
Figure 1 Headlight instrument hardware structure diagram
Figure 2 Ambient light compensation circuit
Figure 3 Photodiode amplifier circuit
Hardware Design
The hardware part of the entire automatic positioning system mainly includes the column photosensitive part, PSD photosensitive part, DC brushless motor drive part, sensor part, communication part, LED display part and logic circuit part. The coordination and data transmission of each part are completed by the main microcontroller C8051F020. The main microcontroller is the core of the system. On the one hand, it is responsible for completing the data collection and processing during the movement of the headlight instrument, and on the other hand, it must pass the processing results to the corresponding control motor for corresponding position adjustment. Therefore, there are high requirements for the operating speed and interface functions of the processor.
Column photosensitive part
The column of the headlight instrument has 8 photodiodes evenly distributed in the direction perpendicular to the ground. After the headlight instrument starts and enters the lighting area, the photodiode converts the sensed light into an electrical signal, and then sends these 8 electrical signals to the ADC of C8051F020 for sampling after amplification. C8051F020 integrates two multi-channel ADC subsystems. Since this part does not require high data accuracy, an 8-bit ADC1 system is selected to convert 8 electrical signals using a single-ended input method.
Figure 2 is an ambient light voltage compensation circuit. This circuit uses a photodiode placed under ambient light to generate different reference voltages Verf according to the intensity of the external ambient light, and serves as the reverse voltage reference compensation of the photodiode amplifier circuit on the column. Figure 3 is an amplifier circuit diagram of a pair of photodiodes. The actual magnification can be adjusted by adjusting the resistance values of R3 (R7) and R2 (R6) according to the performance of the photodiode used.
PSD photosensitive part
The PSD sensor is used to accurately locate the center of the headlight. This sensor is a photoelectric position sensitive element based on the lateral photoelectric effect. When the incident light point falls on different positions on the photosensitive surface of the device, the PSD will output different electrical signals accordingly. By processing the output signal, the position of the incident light point on the PSD device can be determined. The intensity and size of the incident light point are independent of the position output signal of the PSD. At the same time, since the PSD is a non-divided element, there is no strict requirement for the shape of the light spot, so the position of the light spot can be continuously measured to obtain a continuous coordinate signal.
The headlamp light passes through the Fresnel lens of the headlight head and is projected onto the condenser at the rear of the light box. There is a small hole at the appropriate position of the condenser. The light passes through the small hole and is focused into a light spot. This light spot shines on the PSD surface and outputs electrical signals of different strengths. The operational amplifier TLC2272 is used to amplify these 4 electrical signals in two stages in phase and then send them to the 12-bit ADC0 for conversion. It should be noted that the amplified voltage value should not exceed the reference voltage of C8051F020 to avoid voltage saturation.
DC brushless motor drive part
Controlling the left and right and up and down movement of the headlight is achieved by driving two DC brushless motors (one vertical and one horizontal). The system periodically samples the feedback signal voltage, and the sampled value is processed by digital signal as the parameter of the controller. Finally, the control quantity is obtained by the appropriate control algorithm, and converted into the control voltage of the DC brushless motor by DAC to adjust the motor speed.
Sensor part
The headlight instrument uses an incremental photoelectric encoder as a feedback element for the motor rotation direction and speed. It is a sensor that converts the mechanical geometric displacement on the output shaft into pulses or digital quantities through photoelectric conversion. Depending on the rotation of the component, the photoelectric encoder generates an electrical pulse signal and sends it to the single-chip microcomputer for processing. The incremental photoelectric encoder has three-phase pulse signal outputs A, B, and Z. When rotating forward, the A-phase pulse leads the B-phase pulse by 90° (or 1/4 cycle); when reversing, the B-phase pulse leads the A-phase pulse by 90°. In this design, the A-phase pulse is used to trigger an external interrupt, and then the rotation direction of the motor is determined according to the level of the B-phase pulse, and the number of encoder pulses is recorded at the same time.
The communication part
C8051F020 has two enhanced UART serial ports, of which UART0 is connected to the RS-232 serial port of the PC to receive detection commands and send detection results; UART1 is connected to the communication serial port of the headlight instrument detection device, and the corresponding detection items are started according to the received PC detection command, and then the results are returned to the main microcontroller.
I2C bus LED display part
SAA1064 is a 4-bit LED driver from Philips. It is a bipolar circuit with an I2C interface and is designed to drive a 4-bit seven-segment LED display with a decimal point. The device has an I2C bus slave transmitter and receiver inside, which can be programmed to 4 different slave device addresses through the input level of the address pin ADR. Two SAA1064 drivers are used in this system.
Logic circuit part
Logic circuits are indispensable in the design of single-chip microcomputer systems. General logic circuits use general logic ICs (such as the 74 series) to build circuits. The more complex the system, the more complex the corresponding logic circuits, and the more logic ICs are required. However, if a programmable logic device is used to implement it, as long as the logic expression is described according to the specified syntax, after simulation, compilation and other processes, and finally downloaded to the programmable logic device, the designed logic function can be completed, thereby greatly improving the freedom of logic design.
In this system, Xilinx's CPLD programmable logic device XC9572 is used. The device contains 36 macro units and has 1600 logic gates. The development environment uses Xilinx's software toolkit FOUNDATION ISE7.1i. The design process is as follows: First, describe the circuit's functions, interfaces, and overall structure from an abstract perspective. Next, use behavioral level description to analyze the circuit's functions, performance, standard compatibility, and other issues. The behavioral level description is written in VHDL language, and the logic circuit design of the motor control module, encoder count control module, and travel limit switch control module are implemented respectively. Finally, through CPLD decoding, the command control I/O is mapped to the corresponding independent address. Taking the motor control module as an example, the six control quantities of the two motors, namely, enable, brake, and turn, only need to operate on the corresponding bits of their mapped addresses.
Software Design
The uC/OS-II operating system is used in the software design of this system. The latest KEIL7.50 integrated development environment is selected to develop the program. By embedding uC/OS-II in the system, the entire program can be divided into many tasks, each of which is relatively independent. Even if a task has a problem, it will not affect the operation of other tasks. This not only improves the reliability of the system, but also makes it easier to debug the program. Task
Creation
According to the goals to be achieved at different stages in the headlight positioning process, the software design is divided into main tasks, automatic test tasks, position control tasks, column light finding tasks, PSD light finding tasks, PC communication tasks, detection communication tasks, motor braking tasks and I2C display tasks.
Each task has its own name, memory space and priority. The priority setting varies according to different systems. In this design, the motor braking task plays a role in protecting the equipment in the system. If the motor cannot be braked in time in the event of control failure, it may cause damage to the headlight instrument, so its priority is set to the highest; PSD light finding task and column light finding task are relatively frequent, and the quality of task execution is directly related to the accuracy of the detection results. The priority is set to the second and third levels respectively; the remaining tasks are all in the normal operation state, just to achieve human-computer interaction, display status and parameters, and have no direct impact on the detection performance. There is no strict high and low priority setting, and it can be set at will.
Analysis of system operation process
The first link of system operation is initialization, which includes two parts: the first part is the initialization of the system and hardware parts, creating the main task; the second part is to create semaphores and establish functional tasks, and assign priorities to them. After
the system is initialized, it starts running from the main task first, and all functional tasks are in a ready state at this time. After power-on, the test personnel send the detection command on the PC. At this time, the first functional task to respond is the PC communication task. The system uses interrupts to receive instructions from the PC and sends a mark to start automatic detection according to the content of the instruction. The main task wakes up the automatic detection task after receiving the automatic detection mark, and sends a display signal to wake up the I2C display task. After entering the automatic detection task, the system calls different functional tasks at different detection stages according to the detection process. After the detection project is completed, the headlight instrument automatically returns to the starting position and waits for the next detection command.
Conclusion
The headlight automatic positioning system in this paper makes full use of the superior performance of the C8051F020 single-chip microcomputer, so that the control system is well integrated and the design cost is reduced. At the same time, practice shows that the use of the C/OS-II real-time operating system in motion control systems with complex systems, strict requirements on real-time performance and accuracy, and requiring more parallel processing tasks will speed up the development of embedded control systems, reduce the complexity of software writing, improve product development efficiency, and make maintenance and function expansion very convenient. The actual operation of the system for half a month at a certain automobile inspection station in Shandong has proved that the system has accurate light positioning, fast response speed, and good operation.
Previous article:Application of Virtual SPI in Communication between XF-S4240 and MCS51
Next article:Research on the Sun Automatic Tracking System Based on Single Chip Microcomputer
Recommended ReadingLatest update time:2024-11-16 20:51
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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
- IC card swiping technology under the screen
- AC detector
- Selection and application of freewheeling diode
- ESP32 CAM Development with MicroPython
- Challenges 5G Brings to Base Station RF PA Design
- Division circuit
- Android smart wearable device development from entry to mastery pdf download
- Why can't we develop industry software like Matlab?
- Android control LED-2-JNI basis of SinlinxA33 development board
- Free application: Canaan AI new product K510 development kit, RISC-V dual-core CPU @ 800MHZ (with training video)