In the field of photoelectric measurement, it is often necessary to use optical cameras with long focal length and large aperture for target detection. This kind of camera has a large zoom ratio. In order to make targets at different distances form clear images on the image plane, in addition to controlling the change of magnification, it is also necessary to fine-tune the focus position. In the past, the most common method for controlling the zoom and focus of this kind of optical camera was to use a single-chip microcomputer. The advantage of using a single-chip microcomputer control is that the programming method is simple and easy to implement. The disadvantage is that the signals that need to be controlled and monitored include the drive signal of the zoom motor, the drive signal of the focus motor, the two limit signals of the zoom motor at both ends, and the two limit signals of the focus motor at both ends. These signals need to be controlled and monitored in real time, so it is usually necessary to use the query method for programming processing. The advantage of this method is that it can control the zoom and focus of the camera in a timely manner. The disadvantage is that due to the frequent query of the hardware status, the single-chip microcomputer is always in a busy working state, and the work efficiency is low. In addition, since the microcontroller queries in a fixed cycle, there is often a time difference between detecting that the motor runs to the limit state and stopping the motor movement. This time difference can cause the motor to be in a stalled state, which is easy to damage the circuit board and the motor.
This paper designs an optical camera focus and zoom control system. This system uses FPGA+microcontroller (MCU) as the core chip. The command to control the operation of the motor is issued through an interrupt to ensure that the motor moves as soon as it receives the command in real time. When the motor reaches the limit position, the FPGA obtains the limit state and immediately sends a stop signal to cut off the power on the motor pin to stop the motor immediately. Compared with the previous method, the advantage of this method is that the real-time control of the motor is stronger, which can effectively control the movement and stop of the camera zoom and focus mechanism, and avoid motor stalling, which may burn the motor or circuit board.
1 Hardware composition
The focus and zoom system based on FPGA+microcontroller mainly includes MCU, communication module, FPGA (programmable logic device) module, motor drive module, optocoupler module, and motor. Its composition block diagram is shown in Figure 1. The MCU adopts AD's ADU812. In addition to the general functions of the single-chip microcomputer, this chip also has an AD conversion function. When the optical lens needs to send back the current position information in real time, the potentiometer can be connected to the motor, and the output end of the potentiometer can be connected to the AD input port of the MCU. The current position of the motor can be read through the program; the communication module adopts 16C650, which can convert the parallel data signal of the MCU into a serial signal for transmission; the FPGA adopts EP1K100-208I, and the motor drive module adopts L298. This chip has two motor drive signal outputs and can drive two motors at the same time; the optocoupler module adopts Omron's EP470. The optocoupler module is simple to connect and has a light indicator on the module, and the current status can be known by the light; the motor adopts a Swiss motor.
[page]
1.1 Working PrincipleThe human-computer interaction module sends the focus and zoom command to the MCU through the communication module. The MCU receives the command through an interrupt and passes it to the FPGA in real time. After receiving the command, the FPGA sends the corresponding logic level to the focus and zoom drive circuit according to the command. After the focus and zoom drive circuit receives the corresponding logic, it sends the forward and reverse voltage to the corresponding control motor to make the motor forward or reverse according to the command. When the motor turns to the limit position, the optocoupler module detects that the corresponding motor turns to the limit position as a sensor and passes the limit state to the FPGA. After receiving the limit signal, the FPGA immediately sends a signal to the focus and zoom drive circuit to make its output zero voltage and the motor stops rotating immediately. The advantage of using FPGA to complete the control here is that the focus and zoom can be realized by programming the FPGA; the motor rotation position can be monitored; and the motor rotation can be stopped in real time. When the motor rotates to the limit position, the motor can be stopped in time and quickly.
1.2 FPGA control module and motor drive module
FPGA has the characteristics of high integration, high reliability and intelligent development tools. At present, it has gradually become the ideal choice for complex digital circuit design. In addition, FPGA can realize the logical functions of hardware through programming, which greatly reduces the complexity of hardware design. Therefore, this paper uses FPGA as the core device to design the focus and zoom drive circuit. Here, ALTERA's EP1K100-208I is selected, and VHDL language programming is used to generate focus and zoom control signals, limit signal detection logic, and motor drive module enable control signals. After the system is powered on, when the MCU receives the focus and zoom control command sent by the human-computer interaction mechanism, it immediately passes the command to the FPGA. The FPGA receives the control command and converts it into an actual control signal and passes it to the motor drive module. The motor drive module receives the control signal and generates a corresponding voltage to drive the motor to rotate, thereby realizing the control of the camera focus and zoom. The control principle diagram of the motor drive module of FPGA is shown in Figure 2. Among them, MFOCUS STOP and FOCUS STOP are the control enable signals of the zoom motor and the focus motor sent by the FPGA to the motor drive module respectively; MFOCUS+ and MFOCUS- are the zoom control signals sent by the FPGA, and FOCUS+ and FOCUS- are the focus control signals sent by the FPGA; the zoom motor+ and zoom motor- are the voltages output by the motor drive module to control the rotation of the zoom motor, and the focus motor+ and focus motor- are the voltages output by the motor drive module to control the rotation of the focus motor. When the corresponding motor turns to the limit point, the FPGA sends a low-level signal to the corresponding enable end. No matter what state the corresponding motor control signal is in, the voltage output signal in the corresponding motor drive module is zero level, and the motor stops moving. When the motor does not move to the limit point, the corresponding enable end is set to a high level by the FPGA, and the FPGA controls the motor drive module to output the corresponding voltage by sending corresponding signals to the zoom control end and the focus control end. The corresponding relationship between the enable signal sent by the FPGA, the motor control signal and the voltage output by the motor drive module is shown in Table 1 and Table 2. Among them, X represents an arbitrary level.
[page]
1.3 MCU module and communication module
In this design, MCU is mainly used as a communication management chip to realize communication with the human-computer interaction module. The operator sends a zoom and focus command to the communication module through the human-computer interaction module. The communication module forwards the command to the MCU. The MCU receives the command in interrupt mode and passes it to the FPGA in real time. The FPGA controls the motor drive module to realize zoom and focus control. The FPGA detects the state of the optocoupler module and passes it to the human-computer interaction module through the MCU module and the communication module, so that the operator can grasp the current camera state. Because the human-computer interaction module sends data frequently, in order to prevent the MCU from freezing, the communication port of the human-computer interaction module is not directly connected to the serial port of the MCU, but the two are connected through the communication module. The communication module here uses a 16C650. The advantage of this chip is that it has a 32-byte FIFO inside, which can act as a data cache, so that the MCU can receive data stably and reliably.
1.4 Optocoupler Module
The optocoupler module mainly plays the role of real-time detection of whether the current motor runs to the limit point. If the motor does not run to the limit point, the optocoupler module outputs 0 level to the FPGA. When the motor runs to the limit point, the optocoupler module outputs 1 level to the FPGA. In order to facilitate observation and debugging, Omron's EX470P optocoupler is selected here. The optocoupler can indicate the current output state of the optocoupler through the indicator light.
2 Software Design
The software design of this article mainly programs MCU and FPGA. Among them, C language is mainly used for MCU programming, and VHDL language is mainly used for FPGA programming. The MCU program block diagram is shown in Figure 3. The FPGA program flow chart is shown in Figure 4.
[page]
3 Conclusions
This paper introduces a zoom and focus system for a continuous variable focal length camera based on FPGA. Compared with the previous system that only uses MCU to complete the zoom and focus function, this system uses FPGA to control focus and zoom, which can control the movement and stop of the motor more quickly. It has a certain effect on preventing the motor from stalling due to the failure to issue a stop operation in time when it moves to the limit position, thereby causing damage to the motor or the control system. Therefore, it has certain application value.
Previous article:Design of DBPL Encoding Signal Source System Controlled by Single Chip Microcomputer
Next article:Production of Simple Programmer for STC12 Series MCU
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
- What is the input voltage of the power chip that steps down the 24V battery to 5V?
- Why can't the segment code LCD screen be lit up when driving with STML152?
- Disassembling Nokia Bluetooth Headset BH501 from over 10 years ago
- Analysis of the types of pads and design standards in PCB design
- The pitfalls encountered when playing with TMS320F28379D
- Why should the power supply be set to +3.3V?
- Analysis of the composition and working principle of the radio frequency identification system
- Add RTT log output to common projects. Simple configuration. It is very easy to use.
- Arduino Bluetooth Obstacle Avoidance Car
- AC Current Sensor = AC Current Transducer = AC Current Transducer