Laser Pointer Mouse Xinpeng Huang and William Putnam 6.111: Introductory Digital Systems Laboratory 18 May 2006 Abstract: The purpose of this project is to design and implement a laser pointer mouse. The laser pointer mouse allows lecturers and presenters to point at a projected screen, and, with the press of a button, move the mouse cursor to the location of the laser, without ever touching the computer or mouse. A few more buttons allow the user to perform left, right, and double clicks. The system is implemented in Verilog, and realized on the FPGA on the 6.111 labkit.Overview During a PowerPoint or any other kind of presentation, it would be convenient for the lecturer to be able to not only point and direct with his laser pointer, but also to use it as a mouse. For example, he or she may want to open up a demo in another window, and it would be convenient to do so without having to walk over to his or her computer. Hence our project idea, the laser pointer mouse, is born. The laser pointer mouse works as follows. A camera is directed at the projected screen. The camera inputs its video data into the FPGA, where it is converted to a more useful format and then processed to extract the location of the laser pointer on the screen, along with the corner coordinates of the screen. The projected screen is then mapped to the computer screen – the projection does not fill up the entire field of view of the camera, so some rendering will be done to make the necessary conversion. After the laser pointer location is rendered to map to the user’s computer screen, its coordinates are outputted through PS/2 to the computer to move the mouse in the appropriate fashion. In addition to this basic functionality, a user interface with a variety of operating modes is incorporated into the system. The system has three functional modes: idle, find, and adjust. Additionally, the user interface provides the user with a variety of options in customizing the image processing to best suit the current lighting conditions. The user can choose between three possible methods of finding the laser pointer and can adjust various parameters that define how the laser is found. Figure 1 presents an overall block diagram of the complete laser pointer mouse system. The rest of this paper will go through each of the blocks in detail. Figure 1: Overall system block diagram. 2Video Input Buffering Xinpeng Huang Our system requires a camera to take in data from the screen where the laser pointer will be shined (hereafter the projection or projected screen) and store it into memory, so that the image processing can take in a video frame and find the location of the pointer. A high-level block diagram of the video input processing is shown in Figure 2. Figure 2: Video block diagram. The light from the projection goes through a series of darkening filters before passing into the camera. The filters are needed to filter ambient noise from the camera by darkening the incoming light intensity, and as a result make image processing easier later. The video data coming out of the camera is an analog TV composite signal compatible with NTSC standards. It is transmitted through the composite video port in the labkit and passes through the ADV7185 video decoder before entering the FPGA. The ADV7185 is an analog-to-digital converter (ADC) that takes in the analog TV data and outputs digital YCrCb signals to the FPGA. The output data is sampled at a 27 MHz TV clock generated by the decoder. YCrCb is a family of color spaces used for composite video data. Y is the luminance component, and Cr and Cb are red and blue chrominance components, respectively. YCrCb comes out from the ADV7185 as a 20-bit signal, the ten most significant bits of which actually contain all the color data. This 10-bit YCrCb data can be converted into RGB using the following transformations1: 1 Reproduced from XAPP283 Xilinx Color Space Converter, http://www-mtl.mit.edu/Courses/6.111/labkit/appnotes/xapp283.pdf. 3R = 1.164 (Y – 64) + 1.596 (Cr – 512), G = 1.164 (Y – 64) – 0.813 (Cr – 512) – 0.392 (Cb – 512), B = 1.164 (Y – 64) + 2.017 (Cb – 512). In addition, YCrCb obeys a set of timing and blanking standards. The three relevant signals are F (field), V (vertical blank), and H (horizontal blank). The video data is actually interlaced into odd and even lines, and the field signal indicates which set of lines is being processed, with F = 0 odd and F = 1 even. H and V are blanking signals, and video data is only being sent from the camera when both H and V are zero. The data comes in with 720 active pixels per line and a total of 525 lines. Generally, F, V, and H only change at the beginning and end of every line of video data written. The data from the DAC communicates the F, V, and H signals by preceding each transition with a series of 10-bit timing reference words in the order 3FF, 000, 000, XY. The last word, XY, takes the form XY = {1, F, V, H, P3, P2, P1, P0, 0, 0}, where P3, P2, P1, and P0 are protection bits intended for error detection. We made a conscious design decision to store a frame of video data into block memory. This eliminates the problems caused by the instability of the TV clock as well as the need to devise a scheme to overcome the problem of clocking the entire system at two different frequencies. Due to limited memory space, we are only able to store a quarter of the information, so the resolution in both the x-and y-directions is cut in half. This conveniently allows us to ignore the even lines and store only the odd lines, thus simplifying the decoding process. The YCrCb-to-RGB module in Figure X1 is a finite state machine (FSM) that is clocked on the 27 MHz clock from the ADC. It reads in YCrCb data on the rising edge of the TV clock and looks for the sequence of words 3FF, 000, 000, XY = 200, corresponding to F = V = H = 0. This signals that a new line is about to come from the decoder. The FSM reads data until coming across the sequence 3FF, 000, 000, XY = 27C corresponding to F = V = 0, H = 1, signaling the end of the line. Every line, a line counter is incremented to keep track of the current (odd) line being sampled. At the end of a frame, the FSM detects 3FF, 000, 000, XY = 2D8 corresponding to F = 0, V = H = 1, and resets the line
View Full Document