Design of focus and zoom system based on FPGA+MCU

Publisher:创新思绪Latest update time:2012-05-11 Source: 现代电子技术 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
0 Introduction
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.

a.jpg [page]

1.1 Working Principle
The 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.

b.jpg

c.jpg

[page]

d.jpg


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]

e.jpg



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.

Reference address:Design of focus and zoom system based on FPGA+MCU

Previous article:Design of DBPL Encoding Signal Source System Controlled by Single Chip Microcomputer
Next article:Production of Simple Programmer for STC12 Series MCU

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号