Design of Camera Lens Control Circuit Based on 89C51

Publisher:乐呵的挑Latest update time:2011-05-14 Keywords:89C51 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Overview

As a remote monitoring and surveillance method, video surveillance is favored by many industries for its rich information and intuitive results. It is widely used in automatic control, product testing, security monitoring, information collection and other fields. Its basic working principle is to collect image information of the monitored object through the camera and transmit it to the corresponding terminal equipment and control equipment to realize the monitoring function. In these systems, the image quality captured by the camera is often the decisive factor in the application effect of the system, so the camera must be properly controlled according to the conditions of the shooting site.

At present, the cameras used in monitoring systems are mainly divided into two categories in terms of structure: one is an integrated camera with a built-in lens, and the other is an independent camera that requires an optional lens. The former is simple in structure and easy to use, and has a variety of control functions, allowing users to remotely control various shooting parameters (including aperture size, shutter speed, image gain, image focus, zoom, etc.) directly through related equipment. It is flexible to use, but due to the influence of its built-in lens performance, its scope of use is limited, and it is not suitable for some special environments or occasions with high shooting requirements. The latter type of camera can select a suitable camera lens according to the needs of the shooting scene to meet various shooting needs, but it is relatively difficult to control the shooting parameters of this type of camera, especially the adjustment of parameters such as aperture, focus, zoom, etc. must be achieved by controlling the lens itself, so an additional set of camera lens control circuits is required to complete this function.

Aiming at this problem, this paper discusses the control method and control circuit design of three variable camera lenses.

2 Camera Lens Control Principle

The main parameters of camera lenses include: the size of the CCD (Charge Coupled Device, i.e. the light-sensing element of the camera), focal length, aperture, focusing method and interface of the matching camera. Among them, focal length, aperture and focus are the parameters that need to be carefully adjusted during the shooting process, especially the adjustment of the aperture size is the fundamental method for the camera to adapt to changes in light. According to the adjustment method of the aperture of the camera lens, the lens is mainly divided into two categories: automatic aperture and manual aperture.

Automatic aperture lenses are divided into two types according to different driving methods: video drive and DC drive. However, both can automatically adjust the aperture size through the internal circuit of the lens according to the brightness of the camera image, so as to achieve a better shooting effect. This type of lens does not require too many external control circuits, especially video-driven automatic aperture lenses. It only needs to connect the video image analog signal generated by the camera to the lens aperture control end. Although this type of lens can automatically adjust the aperture size according to the external light conditions to achieve a better imaging effect, since its adjustment process is not open to the external controller, it is not completely applicable in some occasions that require special control by the system controller. In addition. Current high-definition industrial cameras often do not have analog output of video images, so there are some difficulties in using automatic aperture lenses.

Manual aperture lenses are divided into fixed-focus lenses, manual aperture zoom lenses and three-variable lenses. Among them, fixed-focus lenses and manual aperture lenses need to manually adjust the aperture, focus and other parameters of the lens to achieve lens adjustment, so they are less adaptable to automatic systems. The three-variable lens can adjust the aperture, zoom and focus through the internal motor of the lens, realizing full electrical control of the lens parameters, which is convenient for the automatic control system and remote monitoring to adjust the shooting parameters of the lens according to the actual application needs. To meet specific shooting requirements. This article mainly focuses on this type of lens, and takes Computar's H6Z0812M TVZOOMLENS three-variable lens as an example to discuss the design of its control circuit. The control of this lens is mainly achieved by loading +8V~+12V or -8V~12V power supply on three pairs of control signal lines. These three pairs of control signal lines correspond to the adjustment of aperture, zoom and focus parameters respectively, and the power polarity and existence time of each pair of control signals determine the direction and amount of parameter change. For example, if +12V power is input to the aperture control terminal, the aperture becomes larger, and the longer the power-on time, the larger the aperture opens. Conversely, if -12V power is input, the aperture becomes smaller. The longer the power-on time, the smaller the aperture becomes. The lens control circuit discussed in this article mainly provides control voltage signals with precise pulse width, correct polarity and appropriate amplitude for the three input terminals of the three variable lenses according to the control instructions of the system terminal or computer, so as to realize the complete control of the lens parameters by the system controller.

3. Design of three variable lens control circuit

According to the previous introduction, it can be determined that the control circuit of the three-variable lens needs three steps to complete the control function: 1) communicate with the control computer and receive control instructions; 2) analyze the content of the control instructions and generate basic control signals; 3) control the power circuit to generate the control signal required for lens control. Due to the need to complete the functions of data communication and instruction analysis, this paper selects the 51 series microcontroller 89C51 with a serial communication interface as the core to design the control circuit of the lens. The circuit corresponds to the work of the above three steps and is divided into three parts: serial communication circuit, central control circuit, and execution circuit.

3.1 Serial Communication Circuit

The serial interface of the 89C51 microcontroller uses the TTL level mode, that is, 2.4 V or more represents digital 1, and 0.45 V or less represents digital 0, while the general standard serial communication standard RS232 uses a voltage greater than +2V to represent digital 0 and a voltage less than -2V to represent digital 1. Therefore, the serial communication interface between the 89C51 and the control computer must undergo voltage conversion. The general method is to use a dedicated device (such as MAX232, etc.) to complete this conversion, but an additional set of ±12 V power supplies is required, which is not conducive to the safety of the equipment. In addition, since the circuit only needs to receive serial information, this design uses the circuit shown in Figure 1 to complete the level conversion and realize serial communication.

When RS232 transmits the digital "0", a voltage greater than +2 V appears between TXD and GND, the primary side of the photocoupler TLP521 emits light, the secondary side is turned on, and the output is low level, corresponding to TTL logic "0"; when RS232 transmits the digital "1", a voltage less than -2 V appears between TXD and GND, the primary side of the photocoupler TLP521 does not emit light, the secondary side is not turned on, and the output is high level, corresponding to TTL logic "1", thus completing the level conversion and realizing the reception of serial data. This circuit does not require an additional ±12V power supply, and can avoid direct electrical connection between the control computer and the lens control circuit, which has higher safety for field applications.

3.2 Execution Circuit Design

Design of Camera Lens Control Circuit Based on 89C51

The hardware design of this part is mainly to realize the output of three variable lens control signals. Figure 2 shows the control circuit of the lens aperture. The control circuit of focus and zoom is exactly the same.

The double-pole double-throw relay S1 in the circuit is used to change the polarity of the power supply to achieve the selection of the direction of the control parameter change. When the S1 coil is not powered, the AB terminal outputs a +12 V voltage to control the aperture to become larger; when the S1 coil is powered, the AB terminal outputs a -12 V voltage to control the aperture to become smaller, completing the conversion of the control parameter change direction.

The control of parameter change value is achieved by controlling the existence time of driving voltage. However, the continuity of mechanical action of relay makes it difficult to achieve precise on-off time control, and its error is generally more than 10ms. Therefore, MOSFET is used as electronic switch in this circuit to achieve precise control of on-off time, with an error of less than 0.1 ms. Under normal conditions, MOSFET is cut off, there is no current at output terminals A and B, and the aperture does not move. When the aperture needs to be enlarged, S1 coil is not energized, A terminal is connected to +12 V, B terminal is grounded through MOSFET, and then 51 single-chip microcomputer sends a control signal to turn on MOSFET, output A and B terminals form a current loop, and drive the aperture to expand; when the aperture needs to be reduced, S1 coil is energized, B terminal is connected to +12 V, A terminal is grounded through MOSFET, and then 51 single-chip microcomputer sends a control signal to turn on MOSFET, output A and B terminals form a current loop, and drive the aperture to reduce. This circuit structure and working mode not only realizes precise control of action time, but also effectively avoids the sparking phenomenon caused by live switching of the circuit, improves the working life of the relay, and reduces interference.

In addition, the optocoupler OP1 in the circuit is mainly used to isolate and transform the +5 V power supply voltage of the 51 microcontroller and the +12 V drive voltage of the lens action; the transistor T1 is used to control the power supply to the relay S1 coil.

3.3 Central control circuit and software design

The central control circuit is shown in Figure 3. The control core of the lens control module is 89C51. It mainly realizes the three functions of receiving control instructions, parsing control instructions and executing control instructions. The software is written in the assembly language of the 51 series microcontroller. The main advantage of using assembly language is that it has fast execution speed, can accurately grasp the action time, and occupies less memory.

Design of Camera Lens Control Circuit Based on 89C51

Asynchronous serial communication is used between PC and 89C51. The data bit can be up to 8 bits, which are defined as action type and action time. The first 3 bits of the data bit represent 6 action states, including aperture expansion, aperture reduction, image magnification, image reduction, focal length increase and focal length decrease. The last 5 bits of the data bit represent the action time, which can represent 32 different action times in total. According to the three functions to be implemented by the software, the program is initialized first. The two timers/counters of 89C52 are used for baud rate setting and action time timing respectively. The definition of the working modes of the two timers/counters can be completed by setting the working mode control register TMOD. Timer/counter 1 adopts working mode 2 to define the baud rate. Timer/counter 0 adopts working mode 1 for lens action time control.

Then comes the instruction processing part. The instruction is decomposed into two parts: action type and action time through the "logic and ANL" operation. The action type is screened using the comparison transfer instruction CJNE, and the pin setting is completed by assigning values ​​to R1 and R2 in the working register group:

Design of Camera Lens Control Circuit Based on 89C51

The pin output is performed in interrupt mode. Since changing the state of the double-pole double-throw switch under power may cause "sparking", to avoid this situation, when assigning values ​​to R1 and R2, the double-pole double-throw relay should be changed first and then powered on. The interval between the two steps is 10ms. The action time is in steps of 10 ms. According to the pre-designed instruction protocol, the action time can be controlled in the range of 0 ms to 320 ms, which can meet the requirements of this module.

4 Conclusion

By improving and debugging the software and hardware of this circuit, the expected application effect was obtained, and the qualitative and quantitative control of the lens was realized. The control characteristic curve of the circuit is shown in Figure 4, where the horizontal axis represents the parameter change step size, in units of 10 ms; the vertical axis represents the number of drive levels required for the maximum parameter change range.

Design of Camera Lens Control Circuit Based on 89C51

The control circuit has a simple structure, reliable control, strong environmental adaptability, and realizes complete control of shooting parameters by intelligent terminal devices. For example, the terminal can expand the aperture of the camera lens when the average brightness of the image is high, so as to make the image in the local shadow clearer. The specific control method can be customized according to actual needs.

分页
Keywords:89C51 Reference address:Design of Camera Lens Control Circuit Based on 89C51

Previous article:Design of LED Color Light Controller Based on AT89C51 Single Chip Microcomputer
Next article:Research on Dual-CPU Servo Motion Controller Based on AT89C51+DSP

Recommended ReadingLatest update time:2024-11-16 16:54

Design of wireless display system based on GSM network
    In order to use the existing mobile communication network to control the remote electronic display screen, a solution for wireless control of the display screen based on the GSM network is proposed. The system consists of a single-chip microcomputer and a TC35 wireless receiver. The controller sends a short messag
[Microcontroller]
Design of wireless display system based on GSM network
Ultrasonic LCD1602 liquid crystal display distance C language program based on 51 single chip microcomputer 89C51
#include     #include intrins.h     #define uint unsigned int     #define uchar unsigned char     sbit rs=P1^2;     sbit rw=P1^1;     sbit en=P1^0;     char idata disp_buf1 ; //1602 display buffer 1 (i.e. the upper 16 characters)     char idata disp_buf2 ; //1602 display buffer 2 (i.e. the bottom 16
[Microcontroller]
A brief comparison between 89C51 and STM8
Introduction to the topic: Content: Compare "89C51" and "STM8"; Source: derived from actual use; Function: To support comparison and provide reference for subsequent development; PCB environment: Altium Designer; Date: 2018-03-06; =====================Dividing line======================== Detailed explan
[Microcontroller]
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号