Design of Camera Lens Control Circuit Based on 89C51

This article refers to the address: http://

1 Overview

As a remote monitoring and monitoring 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. The basic working principle is to collect the image information of the monitored object through the camera and transmit it to the corresponding terminal device and control device to realize the monitoring function. In these systems, the quality of the image captured by the camera is often a decisive factor in the application of the system, so the camera must be properly controlled according to the conditions of the scene.

At present, the cameras used in the monitoring system are mainly divided into two types, 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 and easy to use, and has a variety of control functions, allowing the user to directly control various shooting parameters (including aperture size, shutter speed, image gain, image focus, zoom, etc.) directly through the relevant device, which is flexible, but due to its The effect of the built-in lens performance limits its range of use, and is not applicable in some environments where the environment is special or the shooting requirements are high. The latter type of camera can be equipped with a suitable camera lens according to the needs of the shooting scene, so as to meet various shooting needs, but the control of the shooting parameters of such cameras is relatively difficult, especially the adjustment of aperture, focus, zoom and other parameters must pass The lens itself is controlled to be implemented, so an additional set of camera lens control circuits is required to perform this function.

In this paper, the control method and control circuit design of the three variable camera lens are discussed.

2 camera lens control principle

The main parameters of the camera lens include: the size, focal length, aperture, focus mode and interface of the camera CCD (Charge Coupled Device), in which the focal length, aperture and focus are carefully selected during the shooting process. The adjustment parameters, especially the adjustment of the aperture size, are the fundamental way for the camera to adapt to changes in light. According to the adjustment method of the lens aperture of the camera, the lens is mainly divided into two types: automatic aperture and manual aperture.

The auto iris lens is divided into video drive and DC drive according to the different driving modes. However, according to the brightness of the camera imaging, the aperture size can be automatically adjusted through the internal circuit of the lens to achieve better shooting results. This kind of lens does not require too much external control circuit, especially the video-driven auto iris lens. It only needs to connect the video image analog signal generated by the camera to the lens aperture control terminal. Although this type of lens can automatically adjust the aperture size according to the external light to achieve better imaging results, but because the adjustment process is not open to the external controller, it is not necessary for some special control of the system controller. Fully applicable. Also. Current high-definition industrial cameras often do not have analog output for video images, so there are some difficulties with using auto-iris lenses.

The manual iris lens is divided into a fixed focus lens, a manual aperture zoom lens, and a three variable lens. Among them, the fixed focus lens and the manual aperture lens need to adjust the lens aperture and focus by manually adjusting the lens, so the system adaptability to the automatic work is poor. The three variable lens can adjust the aperture, zoom and focus through the internal motor of the lens to realize the complete electric controllability of the lens parameters. It is convenient for the automatic control system and remote monitoring to adjust the shooting parameters of the lens according to the actual application. To meet specific shooting requirements. This article focuses on this type of lens, and uses the Computar 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 supply on three pairs of control signal lines. The three pairs of control signal lines respectively correspond to the adjustment of aperture, zoom and focus parameters, and the polarity of the power supply and the length of existence of each pair of control signals determine the direction of the parameter change and the amount of change. For example, when the +12 V power supply is input to the aperture control terminal, the aperture becomes larger. The longer the power-on time, the larger the aperture is opened: conversely, the input -12 V power supply becomes smaller. The longer the energization time, the smaller the aperture becomes. The lens control circuit discussed in this paper mainly provides control voltage signals with precise pulse width, correct polarity and appropriate amplitude for the three inputs of the three variable lenses according to the control commands of the system terminal or computer. Full control of the parameters.

3 three variable lens control circuit design

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) communicating with the control computer, receiving the control command; 2) analyzing the content of the control command, generating a basic control signal; 3) controlling The power circuit produces the control signals needed for lens control. Due to the need to complete the functions of data communication and instruction parsing, this paper selects the 51 series single-chip microcomputer 89C51 with serial communication interface as the control circuit of the core design lens. The circuit corresponds to the above three steps, and is divided into three parts: a serial communication circuit, a central control circuit, and an execution circuit.

3.1 Serial communication circuit

The serial interface of the 89C51 single-chip adopts the TTL level mode, that is, 2.4 V or more represents the number 1, 0.45 V represents the number 0, and the general standard serial communication standard RS232 uses the voltage greater than +2V to represent the number 0, with less than The voltage of -2 V represents the number 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) to complete this conversion, but need to provide a set of ±12 V power supply, which is not conducive to the safety of the device. In addition, since the circuit only needs to receive serial information, this design uses the figure. The circuit shown in 1 completes level shifting for serial communication.

Serial communication circuit

When RS232 transmits the digital “0”, a voltage greater than +2 V appears between TXD and GND. The photocoupler TLP521 emits light on the primary side, and the secondary side turns on, outputting a low level, corresponding to the TTL logic “0”; When RS232 transmits the digital "1", a voltage less than -2 V appears between TXD and GND. The photocoupler TLP521 does not emit light on the primary side, the secondary side does not conduct, and the output level is high, corresponding to the TTL logic "1". This completes the level shifting and enables the reception of serial data. This circuit does not require an additional ±12V power supply, and it can avoid direct electrical connection between the control computer and the lens control circuit, and has higher security for field applications.

3.2 Execution circuit design

Execution circuit

The hardware design of this part is mainly to realize three variable lens control.

The output of the signal. Figure 2 shows the control circuit for the lens aperture. The control circuit for focusing and zooming 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 realize the selection of the direction of change of the control parameters. When the S1 line package is not energized, the AB terminal outputs +12 V voltage, and the control aperture becomes larger. When the S1 line package is energized, the AB terminal outputs -12 V voltage, the control aperture is reduced, and the change of the control parameter change direction is completed.

The control of the parameter change value is realized by controlling the existence time of the drive voltage. However, the continuity of the mechanical action of the relay makes it difficult to achieve accurate on-off time control. The error is generally more than 10ms. Therefore, the MOSFET is used as an electronic switch in this circuit to achieve accurate control of the on-off time with an error of less than 0.1 ms. Under normal conditions, the MOSFET is turned off, and the output terminals A and B have no current, and the aperture does not operate. When it is necessary to enlarge the aperture, the S1 line package is not energized, the A terminal is connected to +12 V, and the B terminal is grounded through the MOSFET. Then, the 51 MCU 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 it is necessary to reduce the aperture, the S1 line package is energized, the B terminal is connected to +12 V, and the A terminal is grounded through the MOSFET. Then, the 51 MCU sends a control signal to turn on the MOSFET, and the output terminals A and B form a current loop, and the driving aperture is reduced. This circuit structure and working mode not only achieve precise control of the action time, but also effectively avoid the sparking phenomenon caused by the switching of the circuit, improve the working life of the relay and reduce the interference.

In addition, the optocoupler OP1 in the circuit is mainly used to isolate and convert the +5 V power supply voltage of the 51 MCU and the +12 V drive voltage of the lens action; the triode T1 is used to control the power supply to the relay S1 line package.

3.3 Central Control Circuit and Software Design

The center control circuit is shown in Figure 3. The control core of the lens control module is the 89C51. It mainly realizes three functions of receiving control command, analyzing control command and executing control command. The software is written in assembly language of 51 series MCU. Mainly to focus on the use of assembly language has a fast execution speed. Can accurately grasp the action time, the small memory and other advantages.

Central control circuit

Asynchronous serial communication is used between PC and 89C51. The data bit can be up to 8 bits and is defined as the action type and the action time. The first three bits of the data bit indicate six kinds of action states, including aperture expansion, aperture reduction, image enlargement, image reduction, focal length increase, and focal length. The last 5 bits of the data bit indicate the action time, which can represent a total of 32 different action times. According to the three functions that the software is to implement, the program is first initialized. The two timers/counters of the 89C52 are used as baud rate settings and action time timers, respectively. The definition of the two timer/counter operating modes can be accomplished by setting the operating mode control register TMOD. Timer/Counter 1 uses mode 2 to define the baud rate. Timer/Counter 0 uses mode 1 for lens action time control.

Then there is the processing part of the instruction. The instruction is decomposed into two parts: the action type and the action time by the "logical and ANL" operation. Use the comparison transfer instruction CJNE to perform action type filtering, and complete the setting of the pins by assigning values ​​to R1 and R2 in the working register group:
Pin setting

The pin output is performed in the interrupt mode. Since the state of the double-pole double-throw switch may be "fired" in the charged state, in order to avoid this situation, when the R1, R2 are assigned, the double-pole double-throw relay is first changed and then energized. The interval between the two steps is 10ms. The action time is in steps of 10 ms. According to the pre-designed command protocol, the operating time can be controlled from 0 ms to 320 ms, which can meet the requirements of this module.

4 Conclusion

Through the improvement and debugging of the hardware and software of this circuit, the expected application effect is obtained, and the qualitative and quantitative control of the lens is realized. The control characteristic curve of the circuit is shown in Fig. 4. In the figure, the abscissa indicates the step size of the parameter change, the unit is 10 ms; the ordinate indicates the number of drive stages required for the maximum variation range of the parameter.

Circuit control characteristic curve

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

Owing to our expertise and with the help of our experienced professionals, we are offering our clients. Recessed Down Light. This light is extensively used in high rising buildings across the world. High in demand for its features like superior illumination, perfect finish and durability, this light is available in a variety of colors, designs and patterns. Designed in accordance with international standards using premium quality raw materials, we offer this down light at very affordable rates to the clients.

LED ALR Lamp

LED ALR Lamp, Bean Container Lamp, LED Single Head Bean Lamp, LED Double Head Bean Lamp, LED Triple Head Bean Lamp

Dearhe Optoelectronics Techco.Factory in Shenzhen,China , http://www.dearheledfactory.com

Posted on