Share the design of camera lens control circuit based on 89C51

Publisher:咖啡狐狸Latest update time:2012-11-17 Source: 21ic 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. 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 camera's CCD (Charge Coupled Device, i.e. the camera's light-sensing element), focal length, aperture, focusing method and interface. 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 camera lens aperture, 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, its adjustment process is not open to the external controller, so 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 automatic control systems and remote monitoring to adjust the shooting parameters of the lens according to actual application needs. To meet specific shooting requirements. This article mainly focuses on this type of lens, and takes Computar's H6Z0812M TV ZOOM LENS three-variable lens as an example to discuss the design of its control circuit.

The control of this lens is mainly achieved by loading +8 V to +12 V or -8 V to 12 V power 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 of parameter change and the magnitude of the change. For example: inputting +12 V power at the aperture control end will increase the aperture, and the longer the power-on time, the larger the aperture will open; conversely, inputting -12 V power will reduce the aperture. 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 ends 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 the digital 1, and 0.45 V or less represents the digital 0, while the general standard serial communication standard RS232 uses a voltage greater than +2V to represent the digital 0, and a voltage less than -2V to represent the 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 it is necessary to provide an additional set of ±12 V power supplies, 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. [page]

Serial communication circuit

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

Execution Circuit

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 accurate on-off time control, and the error is generally more than 10ms. Therefore, MOSFET is used as electronic switch in this circuit to achieve accurate on-off time control, 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, the S1 coil is not powered, the A terminal is connected to +12 V, and the B terminal is grounded through a MOSFET. Then the 51 single-chip microcomputer sends a control signal to turn on the MOSFET, and the output terminals A and B form a current loop to drive the aperture to expand. When the aperture needs to be reduced, the S1 coil is powered, the B terminal is connected to +12 V, and the A terminal is grounded through a MOSFET. Then the 51 single-chip microcomputer sends a control signal to turn on the MOSFET, and the output terminals A and B form a current loop to drive the aperture to reduce. This circuit structure and working mode not only realizes the precise control of the action time, but also effectively avoids the sparking phenomenon caused by the 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.

Central control circuit

Asynchronous serial communication is used between PC and 89C51. The data bit can be up to 8 bits, which are defined as the 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 first initialized. 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. [page]

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:

Pin Settings

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.

Pin Settings

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.

Control characteristic curve of the circuit

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:Share the design of camera lens control circuit based on 89C51

Previous article:Design of a household intelligent watering device based on AT89S52
Next article:Design and implementation of water regime telemetry terminal based on AT89S52

Recommended ReadingLatest update time:2024-11-16 15:41

The production of a LED dot matrix Chinese character display screen
【Abstract】This article mainly introduces the circuit design principle and circuit board production method of LED dot matrix Chinese character display screen controlled by 89c51, which is conducive to beginners to master the general design application of single chip microcomputer and circuit board production method thr
[Microcontroller]
The production of a LED dot matrix Chinese character display screen
Watchdog circuit composed of 89C51 single chip microcomputer + X25045
The watchdog circuit is composed of 89C51 single-chip microcomputer and X25045. The hardware connection diagram of X25045 is shown in Figure 1. The X25045 chip contains a watchdog timer, and the system monitoring time can be preset by software. If there is no bus activity within the preset time of the watchdog timer, X
[Microcontroller]
Watchdog circuit composed of 89C51 single chip microcomputer + X25045
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号