Share this

Design of a video-based wireless laser positioning device

2026-04-06 05:17:15 · · #1
With the increasingly widespread application of CCD (Charge Coupled Device) technology in industrial, military, and civilian sectors, application systems that utilize CCD cameras as the front-end image sensor and combine them with other hardware circuits for rapid sampling, transmission, and data processing of the measured image information are attracting growing attention. This paper introduces a video signal processing device with a CCD camera, primarily used for measuring the coordinates of target points and positioning the cursor on a projection screen. 1. System Overall Design Scheme The overall system design is shown in Figure 1. The light spot emitted by the laser pointer onto the measured image is received by the CCD camera. The CCD camera outputs a video signal to the synchronization separation circuit and the shaping circuit. After using the synchronization separation circuit, the horizontal synchronization signal, vertical synchronization signal, and parity signal can be obtained from the video signal. The horizontal and vertical synchronization signals are sent to the counting circuit. After the video signal passes through the shaping circuit, the optical signal is obtained and also sent to the counting circuit. The counting circuit processes the signal and outputs the two-dimensional position information of the light spot. This information is processed by the microcontroller and transmitted to the computer via a serial port. The computer uses software programming to position the cursor and simulate the single/double-click function of a mouse. [align=center] Figure 1 Overall Circuit Structure Diagram[/align] 2. System Hardware Circuit Design 2.1 Shaping Circuit As shown in Figure 2, the video signal output by the CCD camera device 1 is directly transmitted to the operational amplifier 4 for amplification. One path of the signal output by the operational amplifier 4 serves as one input to the voltage comparator 7, and the other path is sent to the maximum value holding circuit 5. The maximum value holding circuit 5 mainly includes three components: a voltage follower 5, a capacitor C1, and a Zener diode Dz1. When a signal is continuously output from the voltage follower 5A, due to the presence of the diode D1, the capacitor C1 continuously charges, and the voltage continuously increases until the maximum value of the signal is reached. At this time, the voltage of C1 also increases to the maximum value. After that, when another signal arrives, since its voltage does not reach the voltage applied across the capacitor, the capacitor stops charging, and the voltage remains unchanged. When the field synchronization signal shown in the figure arrives, the Zener diode Dz1 conducts in reverse, and the capacitor discharges rapidly. When another signal is output from the voltage follower 5A, the capacitor begins to recharge again. This design allows the strongest signal to be extracted from each video signal, and this value is output to the other input of voltage comparator 7 via voltage follower 6. The signal output by voltage comparator 7 is the optical signal extracted from the video signal. This optical signal has the following characteristics: for each video signal, the optical signal output is high only when the current signal value is greater than the previous signal value; otherwise, the output is low. After the maximum value of the video signal, the optical signal output remains at a low level. In Figure 2, voltage follower 6 acts as a high input impedance element to prevent capacitor C1 from discharging too quickly. Power supply VCC provides a clamping voltage. [align=center] Figure 2 Detailed schematic diagram of the shaping circuit[/align] 2.2 Synchronization Separation Circuit The video signal is a television signal that reflects the image content. Its voltage level indicates the brightness of the image pixels. Since the image is random, the video signal level also fluctuates randomly within a certain range. The video signal is generated by electronic scanning, where the camera converts scenes of different brightness into corresponding electrical signals, which are then transmitted through the signal channel. At present, when transmitting video signals, the image signal, blanking signal and composite synchronization signal are combined and sent in a certain proportion. The television signal used in my country is the interlaced scanning (PAL) system (CCIR for black and white), with a line frequency of 15625Hz and a line synchronization pulse width of 4.7μs; the field frequency is 50 Hz and the field synchronization pulse width is 160μs[1]. Accurate separation of video signals is crucial to the success of the system. In this system, the video signal synchronization separation can be achieved by using the chip LM1881. The input is a video signal that meets the CCIR standard, and the output includes composite synchronization signal, field synchronization signal and odd/even field flag signal. Among them, the composite synchronization signal includes a line synchronization signal with a period of 64μs and a field equalization signal and field synchronization signal with a period of 32μs during the field retrace period[2]. 2.3 Counting circuit 2.3.1 Optical signal line counting A 20MHz crystal oscillator is selected as the counting clock pulse input of the line counter. The clock frequency of the counter actually determines the number of sampling points of each line of the video signal, that is, the digital resolution of each line. The line period is 64μs, the frequency is 15625Hz, and the sampling points of each line are 20M/15625=1280. After deducting the time for line blanking and line synchronization, the effective sampling points of each line can reach more than 1000 points. In order to ensure that the counter does not overflow, a 10-bit binary address is required, so we choose to use a 12-bit counter. The optical signal and the field synchronization pulse are connected to the counter's clear pin through a NAND gate, and the 20MHz clock signal and the line synchronization pulse are connected to the counter's clock pulse input pin through a NAND gate. When the optical signal arrives, the counter starts counting. When the next line synchronization pulse arrives, it will stop counting and trigger the latch to store the value in the counter. Thus, the line coordinates of the optical point are obtained. When the next field synchronization pulse arrives, it will clear the counter and start measuring the point coordinates of a new line [3]. Figure 4 is a waveform diagram of line counting. [align=center] Figure 3 Waveform diagram of line counting[/align] 2.3.2 Optical signal field counting The working principle of field counting is similar to that of line counting, except that the counter clock pulse input is changed to the line synchronization pulse. The counting begins when the light signal arrives and stops when the field synchronization pulse arrives, triggering the latch to store the value in the counter, thus obtaining the field coordinates of the light spot. Simultaneously, the field synchronization pulse resets the counter to zero, starting a new field coordinate measurement. Because the camera uses interlaced scanning, two fields constitute one frame; odd fields scan odd lines, and even fields scan even lines. Therefore, the obtained field coordinates have a significant error compared to the actual values. To improve accuracy, it is necessary to determine whether the current scan is of an odd or even field. If the value in the field counter is n, the odd/even field flag pin of the LM1881 outputs 0, indicating that the current scan is of an even field, and the light spot should actually be in line 2n; if it outputs 1, it indicates that the scan is of an odd field, and the light spot should actually be in line 2n-1. 3. Microcontroller Serial Communication Process The microcontroller used in this system is the Lingyang SPCE061A, whose UART module provides a full-duplex standard communication port for serial communication with peripherals. When using the asynchronous serial port UART of the SPEC061A to communicate with a PC, because the I/O levels of the SPEC061A and the PC are inconsistent, a MAX232 microcontroller is required for level conversion. The RXD and TXD pins of the MAX232 are connected to IOB10 (TX) and IOB7 (RX) of the SPEC061A, respectively. According to the RS-232 standard, the SPEC061A microcontroller transmits data byte by byte. Utilizing the special functions of the IOB port and the UART IRQ interrupt, UART interface data reception and transmission can be completed simultaneously. The serial communication frame structure of the SPEC061A microcontroller is: 1 start bit, 8 data bits, 1 parity bit, and 1 stop bit. When using the UART module for communication, pins IOB7 must be set to input mode and IOB10 to output mode beforehand. Setting the baud rate to 9600 b/s will meet the real-time data transmission requirements of this system. The initialization code is as follows: * P_IOB_Dir = 0x0400; // IOB0~IOB7 are initialized as inputs, IOB10 as output * P_IOB_Attrib = 0x0480; * P_UART_BaudScalarHigh = 0x05; // Baud rate is set to 9600bps * P_UART_BaudScalarLow = 0x00; * P_UART_Command1 = 0x0000; // Enable receiving and sending * P_UART_Command2 = 0x00C0; The microcontroller data transmission program code snippet is as follows: Ret = * P_UART_Command2; // Check the flag bit to see if the last data transmission is complete Ret = "Ret" & 0x0040; while (Ret == 0) // If not, wait and continue sending { Ret = * P_UART_Command2; Ret = "Ret" & 0x0040; *P_Watchdog_Clear=C_WDTCLR; } m1=m&0x000f; //Convert hexadecimal m1 to ASCII code and transmit it to the host computer Hex_ASC(m1); *P_UART_Data=m1; 4. PC Software Design At the computer receiving end, the data sent by the microcontroller is received by serial port 1. The software program is designed using VB 6.0, and serial communication is implemented using the MSCOMM control [4]. MSCOMM can easily develop computer communication programs that use the computer serial port. In this system, the MSCOMM control uses an event-driven method to obtain data from the port. The software processing flow is as follows: open the serial port to start receiving data sent by the microcontroller, first determine the start byte of the data frame, if it is, close the OnComm receive event, then receive the data bytes, determine the maximum and minimum values ​​of the data, use the coordinate transformation algorithm to convert the received coordinates into screen coordinates, and finally open the OnComm receive event and wait for the next OnComm event to be generated. The Windows SDK function `SetCursorPos()` can display the mouse cursor at a laser dot on a large projection screen. This function takes two parameters, `x` and `y`, representing the mouse's coordinates on the screen. The function `mouse_event()` can simulate a mouse event. For example, a left-click can be simulated using the following command: `mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0`. This achieves the control of the mouse pointer positioning, movement, and single/double clicks on the target large screen using a laser pointer dot. 5. Conclusion Experiments show that the equipment design is reasonable, meets the design technical requirements, operates stably and reliably, and has strong expandability. Only minor modifications are needed to adapt to higher user requirements. If further improvement in cursor positioning accuracy is required, a higher-precision crystal oscillator can be selected as the input for the row counter pulses, and the counter can be expanded if necessary. This is equivalent to refining the pixel points, thus improving accuracy. This device is an ideal demonstration tool for product demonstrations, electronic teaching, and academic conferences, used in conjunction with a computer and projector. After modification, it can also be used for police officers and military firearms simulation training, and has broad application prospects. References [1]. Yu Sile et al. Television Principles (5th Edition). Beijing: National Defense Industry Press, 2000 [2]. LM1881, LM1881-X Video Sync Separator General Description. National Semiconductor, June 2003 [3]. Hu Dunhui et al. Point Coordinate Measurement Method Using Video Method [J]. Electronic Technology Application, 2003, (3): 33-35 [4]. Li Guangming et al. Using VB to Implement Ordinary Serial Communication between S7-300 PLC and PC [J]. Microcomputer Information, 2005, (09): 38-40
Read next

CATDOLL 146CM Ya TPE (Customer Photos)

Height: 146cm A-cup Weight: 26kg Shoulder Width: 32cm Bust/Waist/Hip: 64/54/74cm Oral Depth: 3-5cm Vaginal Depth: 3-15c...

Articles 2026-02-22