















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
















By
Spring 2007
Abstract The purpose of this paper is to discuss the design, operation, specifications, and benefits of our innovation: the laser guided mouse. This device is an advanced version of a PowerPoint clicker combined with a common laser pointer to create a wireless mouse that is meant to be used with a projected screen. The major components of this device are a webcam, a laser pointer, our own clicking and receiving devices, and a computer whose screen is enlarged using a projector. This product is a combination of circuit fabrication, image acquisition and analysis, and mouse driver manipulation, all controlled by a software GUI that manages the function of all device inputs. The hardware is capable of two functions while the laser pointer accomplishes one objective. The software links both of these data contributions together, analyzes the resulting command, and then executes the directive, which becomes noticeable on the projected screen with almost no lag time. After design, development, integration, and testing of the subunits that make up this project, we had a working prototype that accomplished all the goals that we desired in the proposing phase of this endeavor. Despite the immediate successes of our model, there are still areas in which further innovation and improvements can and should be discovered. This project has high potential in the real world market and has applications that may become a standard in the business of presentations and wireless PC control. ii
1. Introduction In our collegiate experiences we have all observed and participated in many presentations in both informal classrooms and large corporate information sessions. Although the technology behind public presentations has evolved significantly in these last few years with the contributions of Microsoft PowerPoint and Laser pointers, the mobility of the speaker is often limited by having to use the mouse to control actions. Even now with the PowerPoint remote controller that allows the speaker to go through slides without returning to the computer, we believe there is still room for improvement. This is where we got the idea for the laser-guided mouse: a laser pointer that has the ability to act as a wireless mouse, permitting the holder to control the computer’s actions from anywhere within the range of the laser’s beam. Now when a presenter is done with one file and wishes to open another, he does not have to return to his machine to do so; he can simply use the laser pointer to direct the actions of the mouse. We are very excited about the marketability of such a device and the potential it has to be the new official device for presentations everywhere. 1.1 Purpose The goal of this project is to use a regular laser pointer and combine its pointing capability with a separate wireless-clicking device to enable the two to control the mouse drivers of the computer that is being projected. If the presenter wishes to utilize the left or right buttons of the mouse, he will use the clicking device, which will send a wireless signal to the computer, activating the drivers to carry out the commands. The desired range of the wireless clicking device is the effective range of a conventional laser pointer, which allows the presenter to roam far away from the computer and still have control over his presentation with no lag time. 1.2 Specifications This product is designed to have the following features: Be user friendly Simple calibration method Cameras able to detect laser light with adjustable filter Accurate up to 100 ft without noise. Compact and clear design that laser pointer users are accustomed too Can be easily integrated into existing computer-projector setups Software GUI that is easy to install and use without difficulty Adjustable brightness threshold for different ambient light situations Low Power consumption: standard 9-volt battery can last over 20 hours 1.3 SubProjects This project was divided into three overall subunits that could be designed, built, and tested independently before combining into the final product. 1.3.1 The Clicker and Receiver The first subunit is the hardware, which consists of the clicker and receiver devices that wirelessly simulate the left and right button functions of the mouse. The receiver is designed to be always plugged into the computer via a direct serial connection or a serial to USB cable and the clicker is a sleeker hand- held device that the speaker holds with one hand while holding the laser pointer with the other.
1.3.2 Mouse Driver Manipulation and System Integration The second subunit is the software that manipulates the mouse drivers so that the clicker/receiver and the laser pointer can wireless control the mouse without losing the ability to use the actual mouse. This software is the program that is run when using the device and it serves as the unifier of all device inputs. 1.3.3 Image Acquisition and Analysis The third subunit is image acquisition in which the laser pointer’s dot must be captured from the projected screen via webcam, analyzed to determine location, and then calibrated for future movements. This subunit also controls laser dot calibration and brightness threshold adjustments for different light settings. Overall Project Block Diagram LASER POINTER CLICKING DEVICE PROJECTED SCREEN CAMERA RECEIVER COMPUTER Figure 1.3.3.1 Green and blue arrows denote optical/wireless transmissions and wired connections respectively.
Figure 2.1.1 LM 555 Timer in a stable Mode LM 555 timer equation for frequency: (2.1.1) LM 555 timer equation for duty cycle: (2.1.2) Following these two equations we selected R1 = 1600 Ohms, R2 = 2000 Ohms, and C = .1 uF. Inputting these values into equations 2.1.1 and 2.1.2 will generate a theoretical frequency of 2576.8 Hz and a theoretical duty cycle of 64.3% high. The transmitter ( TXM-900-HP3-PPS) and receiver (RXM-900-HP3-PPS) were not complicated in their application as we followed their datasheets precisely. The transmitter sends out the 8-bit code serially and the receiver gets this data and then in turn outputs it to our serial-to-logic converter, the MAX 232. Basic circuit block diagrams: Figure 2.1.2 Basic Clicking device block diagram Transmitter Left Click Right Click Clock PISO Shift Register CLICKING DEVICE Wire Signal
Figure 2.1.3 Basic Receiver block diagram 2.2 System Integration Design The goal of the system integration is to make sure the software communicates correctly and efficiently with the software. There were a number of design considerations for the communication between laser position detection and mouse click detection. The first was deciding which process to operate first, the image processing or the clicker processing. If the clicker processing were to operate first and then process the image to find the laser pointer, the entire runtime would be delayed. Thus a different approach would be to have the image processor running all the time, and then when the click is detected, the mouse driver uses the position analyzed by the image processor at that specific moment. It was decided to run in Windows instead of Linux since most projection computers are in Windows. Also, for the ease of programming, the MSDN library was used resulting in the need for the Microsoft’s .NET Framework for Windows. The application was written in C# mainly because of programmer’s familiarity with the terse language. Microsoft Visual Studio has an extensive and dynamic environment that allows the creation of GUI, making the interface more user friendly. 2.3 Image Acquisition and Analysis Design Image acquisition and analysis is performed to locate the laser point. To perform the image acquisition, a webcam is used. Our project uses a Logitech QuickCam Fusion webcam but any average webcam can be used. Microsoft DirectX SDK [10], specifically DirectShow [3], is used to acquire the video stream coming in from the webcam. The graphic user interface (GUI), image analysis, and calibration calculations were developed using C# in the Microsoft Visual Studio environment. Visual Studio greatly aided the development of the GUI by facilitating the addition of camera view windows, buttons, text boxes, sliders, etc. The C# language was utilized for its simplicity and versatility: it has fewer symbolic requirements than C++ and fewer declarative requirements than Java while also being relatively economical in memory and processing power. Some C# classes were borrowed from Andrew Kirillov’s Motion Detection Algorithm and Image Processing Lab software [5], [6] to help with image analysis. The webcam produces bitmaps of resolution 320240 pixels and each one is analyzed to find the brightest location in the array. The iterative algorithm checks every 5 pixels for brightness and records the brightest one. Every 5 pixels were checked because we found it to be a good balance between Receiver Serial to Logic Converter
Wire Signal Cable
3. Design Details 3.1 Clicker and Receiver Module Please refer to figure A.1 for the clicker’s full device schematic and figure A.2 for the receiver’s full device schematic. The two capacitive push buttons are pulled down to GND using 5100 ohm resisters so that upon being pushed they go from low to high and not the other way around. These two signals are sent into a NOR gate which functions according to the following table: Table 3.1.3 NOR and Shift gates table Left Right Nor Shift/Load Low Low High Shift Low High Low Load High Low Low Load High High Low Load When neither button has been pushed, the NOR gate is High and it feeds this high into the shift/load input of the shift register which translates to “shift”. Of course, if there is no data in the shift register nothing is being actively shifted accept a steady stream of high bits. Once a button is pushed, the NOR goes low and signals to the register to load the eight parallel signals A – H discussed earlier. Then when the button is released, the NOR gate will begin to shift A – H at the clock speed created by the LM 555 timer. These eight bits are sent to the transmitter which is continually sending data to the receiver. Although the two formulas 2.1.1 and 2.1.2 generated theoretical values that were not as precise as desired, the clock signal was cleanly recognized by the comport of the PC and no errors occurred. One initial set back with the timer was that the wave produced in a stable mode was not a square wave, but this problem was resolved by placing a .01 uF capacitor between pin 5 and GND, resulting in a square wave with a duty cycle very similar to the theoretical value. The TXM transmitter and the RXM receiver were not complicated in their application as the only real variable in them was deciding which channel to send the data on. We chose to implement channel 101, which is shown as pins 3 – 5 on the transmitter and pins 10 – 12 on the receiver. The MAX232’s function is to convert serial voltages that range in this case from 0 – 5 volts to voltage values that can be understood by the serial comport. This transformation follows the rule that logical 1’s must be read as voltages less than –3 volts and logical 0’s must be read and voltages greater than 3 volts, which is basically an inversion and amplification of the serial voltages send in. The 232 is also capable of receiving information from the computer, but since that was not needed in this project we did not take advantage of that feature. Both of these designs are optimal when they are powered by a VCC of 5 volts. In order to generate this voltage we used a 9-volt battery and sent its power output into a 5-volt regulator which was then used to supply the VCC bus. One negative consequence of using this technique is that unlike a laboratory power supply, a battery’s power is not as “clean” and can be quite noisy. This was fixed by placing a 100 uF capacitor between the VCC and GND buses on both devices. 3.2 System Integration Module The system integration block diagram is outlined in Figure B.1. The primary procedures involve reading and analyzing data from COM port, acquire relative location of laser pointer from image processing, and integration of these two factors followed by mouse driver manipulation.
Reading from the COM port is accomplished by manipulating the MSDN serial port library. A list of functions and methods of the SerialPort Class are shown in Table B.1. A GUI (shown in Figure 3.2.1) was created initially to provide the programmer with a better understanding of the SerialPort Class. The process for reading the COM port begins with a search for the COM ports. All the COM ports are displayed in the pull down menu as shown in Figure 3.2.1. Upon selecting a COM port, the COM port opens and a connection is established. When data is received, the program is notified and data is read from the serial port buffer. The data is then interpreted as left and right clicks and further analyzed (discussed later). When the program is closed or when the user selects a different COM port, the COM port connection is then closed. Figure 3.2.1 GUI with list of COM ports searched Acquiring the relative location of the laser pointer from image processing requires a global variable (detector.point) from the image processor with the X and Y coordinates of the mouse click. The class Point is handy in this situation since it represents a location in (x,y) coordinate space, specified in integer precision. After receiving and analyzing data from the serial port and acquiring the relative laser pointer position, the mouse is then controlled in accordance with the information. To do this, the user32.dll library must be called using DllImport. The function SendInput within the library allows mouse control given the right input data. Code Sippet B.1 shows a snippet of the information to send into the function SendInput. 3.3 Image Acquisition and Analysis Module The image processing module was designed to locate the laser point in the webcam’s view screen and convert that into an (x, y) location on the computer screen. The first step is to acquire a bitmap image from the webcam. This is done in the Camera class in the video_NewFrame subroutine. After the image is acquired, it is sent to the Detector class to be processed, utilizing the ProcessFrame subroutine. This subroutine iterates across x and then y, calculating the brightness of every 5 pixels in the bitmap. Brightness is found using the following equation: (299 Re ) (587 ) (114 ) 1000 d Green Blue Brightness
If the brightness of the current pixel is above the threshold that the user defines, it is saved until a brighter pixel is found in the bitmap. After the entire bitmap is processed, an xPos and a yPos of the brightest point in the webcam view is recorded. Using this method, approximately 7-10 bitmap images are processed per second.
ScreenHeight YFactor LowerBounds UpperBounds
(3.3.2b) It is important to note that the screen resolution is automatically acquired by the software so this program can be applied to screens of different resolutions without modifying the code. The last step is to use XFactor, YFactor, xPos, yPos, LeftBounds, and UppserBounds to calculate ScreenX and ScreenY: ScreenX ( xPos LeftBounds ) XFactor (^) (3.3.3a) ScreenY ( yPos UpperBounds ) YFactor (^) (3.3.3b) ScreenX and ScreenY correspond to the location on the screen where the user would like to click. These two values are saved in a Point data structure: clickPoint = new Point(ScreenX, ScreenY) (3.3.4) Figure 3.3.2 Calibration assist marks activated
4. Design Verification 4.1 Clicker and Receiver Testing and Data Throughout the building and testing phase of the hardware, we wanted to make sure certain components of the design worked properly before moving on. This way we could debug the glitches and errors without having to figure out where they were being generated from and how to fix them without hurting other areas. This is a list of the areas in the hardware that we wanted to test and verify before moving on the in the process:
As you can see in the plot, the serial code is: 010 10 010. This indicates that during this test the left button was pushed. There is almost no visible lag time in this plot and almost no noise whatsoever. We believe that 20 feet is generally a good distance for testing because from our own personal experience, presenters do not normally wander too far from their computers and 20 feet is a pretty large distance to roam. We did however conduct tests at larger distances just to cover all the bases. Test 5: The last major test that needed to be passed was the successful conversion of the serial code into voltages that can be read by the computer without falling into the –3 to 3 volt noise range. The following plot shows the output of the shift register (2) vs. the output of the MAX232 (1). This test was done at a larger distance than the others: 35 feet. Figure 4.1.4 Shift Register Output vs. MAX232 Output at 35 feet. From the plot above it is shown that while the shift register outputs values from 0 to 5 volts, the 232 outputs values from –9.6 volts to positive 9.7 volts. None of the values fall into the noise range and there is no visible lag time between the two plots. 4.2 System Integration Dissected Testing Before the entire project was integrated, individual parts were tested beforehand. As stated previously, a GUI was created to gain a better understanding of the serial port. In order to test it, a serial loop back (shown in Figure 4.2.1 and 4.2.2) was used, so data sent from the computer to the COM port was read back into the computer.
Figure 4.2.1 Serial Port Pin Diagram Figure 4.2.2 Serial Port Loop Back As shown in the figure above, pin 2 is receive data and pin 3 is transmit data. Simply connect the two to perform a hardware loop back [4]. After recognizing the operability of the GUI, the next step is to make sure the COM port reads the data sent from the hardware. The hardware is setup to send at a baud rate of 2400 in the format of 7 data bits, 1 stop bit, and 0 parity bits. Data from the hardware translated to ASCII then becomes “i”s (left click) and “j”s (right click) as shown in Figure 4.2.3. Figure 4.2.3 Received data from COM port To provide the programmer with a better understanding of controlling the mouse, an autoclicker GUI (Figure 4.2.4) was made. Figure 4.2.4 Autoclicker GUI [14]
Figure 4.3.2 Mock screen used for calibration test Figure 4.3.2 shows the mock screen and calibration verification points on the corners. After calibration was performed, moving the laser dot within the boundaries produced an (x, y) coordinate on the mock screen. The final tests were performed to check the accuracy of the system. After setting up the projector and webcam and calibrating the screen, we found XFactor and YFactor to be approximately 3.5 to 4.0. This means that at worst, every 20 pixels on the computer screen is clickable: Figure 4.3.3 Grid showing all of the clickable locations on the computer screen (intersections of lines)
It can be seen from Fig. 4.3.3 that all of the icons on the desktop, the start button, and task bar buttons are clickable. Hooking up the wireless receiver and using the clicker verified that the tracking and clicking is accurate. We are very satisfied with the tracking accuracy, low lag time, and overall performance of the device. 4.4 Overall Design Testing The versatility and completeness of each subunit’s testing was such that once final integration was accomplished, the only real test that needed to be passed was whether or not there is a time difference issue between clicking and laser dot capturing. Due to the high frequency of the clicker’s clock and the fast frame rate capture of the webcam, this was not an issue. Once integrated, the project worked just as well as when split into its subgroups.