Make your own free website on Tripod.com
  
Mostek Electronics - BE Project training in Electronics
Computer Software Consultants & Electronic Circuit Designers 
ELECTRONICS - INFRARED WIRELESS MOUSE

BE/CS -ECE /EIE / EEE FINAL SEMESTER PROJECT

CONVERTING A NORMAL MOUSE TO AN INFRARED MOUSE

INTRODUCTION

Cordless mouse have recently been introduced in the market and they basically work on IR principle or radio waves. IR ( Infrared is more popular) The advantage of this mouse is that it does not have a "TAIL" - no wires connected to the PC and convenient to handle. The IR rays fall on a small receiver that is connected to the PC's mouse port kept near the PC in front of the mouse . The wireless distance is within 12". 

Serious mouse users like CAD/CAM / GRAPHIC designers prefer the cordless mouse for its convenience. 

PROJECT

This project is aimed at converting a normal mouse into an IR one using a bread board and a few ICs to simulate the concept of an IR mouse and to see how it really works. If necessary you make a small PCB to fit it into the mouse enclosure and a small 9/12 V battery inside the mouse. (ie. if you have the necessary skills in soldering and making a very small PCB and finding enough place for a battery also inside the mouse enclosure) 
 

BLOCK DIAGRAM

For testing purpose , we are going to connect the mouse to a bread board using an IR LED beam, the mouse sends signals to a receiver diode again on a BB ( Bread board) which is connected to the PC com-1 mouse port. In this method the mouse is not damaged and concept can be made to work as a demonstration. 

                        ----------                ---------
  |----\                |        |                | bread |
 |      \   mouse cable | bread  |=)> infrared   )| board |  cable
 |mouse  \==============+ board  |=)> LED        )|       |==========PC
 |       /              |        |                |       |          COM-1
  |-----/               |________|                |--------
                                                 PHOTO DIODE
                                                  RECEIVER

                                  <---  12"  --->
                                 wireless distance

INSIDE THE MOUSE

Opening a mouse is very easy , just look under the mouse for 2 or 3 screws - open them and click open the mouse body. Remember to remove the rubber track ball before opening the mouse. 

You will find about five wires from the mouse cord connected to the mouse PCB, two rollers connected to two slotted wheels that rotate when the mouse is moved. Two switches that get clicked when you press the left / right mouse button. (These are ordinary micro switches) 

Along side the two slotted wheels (approx 0.5 inch dia) you will find two opto-couplers that detect the pulses generated when the wheel is rotated. In the opto -coupler one side is a LED and the other end is a Photo detector Diode. Whenever the beam is broken a pulse is generated which indicates movement of the mouse. Normally you will find two o/cs (opto -couplers) for each wheel for detecting the direction of rotation. 

Some mouse have one o/c with two receiving diodes to detect the direction of rotation. Besides these mechanical parts you will find on the PCB a few diodes, resistors and a dedicated IC which handles all the o/cs and switches to send info to the PC. 

A bit surprising is that there is no battery inside the mouse !

Then where does the IC and other electronic components inside the mouse get their power supply from ? 

POWER SUPPLY

A little bit of reading old mouse manuals and some research got us the information. A few years back when the mouse was introduced, they used to be connected to COM1 ( serial port -1) on the PC and a short cable from the connector used to go to a "T" connector to the PC KEYBOARD socket. The mouse used to get its power supply through the KB connector. But recently , there is no such direct supply. 

A quick test revealed the secret. We connected the mouse to the PC and switched ON the PC and checked for any DC Voltage on any of the mouse 5-wire cable. We found on two wires +10v marked as DTR/RTS . On close examination of the mouse PCB, we also found that two IN4148 diodes were "OR" connected to pins-4 & 7 (DTR & RTS) trying to pull out power from any one of these pins to supply the voltage to the Mouse PCB and its components. Probably the mouse manufacturer is using a LSI IC CMOS version that just draws a few milliamps and decided to take the power from the serial port itself. Nowadays , ICs draw very little current. On examination , we found that about 5ma was consumed, not a heavy drain on the serial port. 

SERIAL PORT

The mouse cord ends in a MALE 9-pin "D" connector as it is popularly known which plugs into the PC's COM-1 ( RS 232 port -1) (com-2 is normally used for a modem) 

A quick check on the ports available on the PC will give you more information. 
The ports available are:- 

1- comm1 rs232 9pin or 25 pin (normally 9-pin used by a mouse) 
2- comm2 rs232 -do- (normally used by a modem) 
3- LPT1 printer port 25 pin (printer) 
4- LPT2 printer -2 port ( normally does not exist ) 
5- VGA output port (connected to the monitor) 
6- Keyboard port ( to keyboard) 
7- Game port (joystick) 

PIN CONFIGURATION

The pin configuration of this port:- (COM-1) (as mentioned in the IBM PC technical reference manual) 
pin function signal direction <-- --> 

(9-pin) IN OUT
----------------------------
1 CD carrier detect <---
2 RXD Receive data <---
3 TXD Transmit data --->
4 DTR Data terminal ready --->
5 Ground Common line
6 DSR Data set ready <---
7 RTS Ready to send --->
8 CTS Clear to send <---
9 RI Ring indicator <---

These are international standards and are the same in any PC from a 286 to a Pentium or even on any other brand. If you check the IBM PC Technical reference manual, you will find this information and much more on the functionality of the pins. 
 

9-pin "D" connector showing the five wires in the mouse cord
 

          /-----
         /     |
        |    1 |DCD-------NOT USED
   DSR  | 6 ---|----------NOT USED
        |    2 |-RXD------------------------------USED
   RTS  | 7 ---|----------------------------------USED
        |    3 |TXD-------------------------------USED
   CTS  | 8 ---|----------NOT USED
        |    4 |DTR-------------------------------USED
    RI  | 9 ---|----------NOT USED
        |    5 |GND-------------------------------USED
        |      |
         \     |
          \-----
 

While testing the mouse (OPEN) with a PC , there were erratic problems and we found that is was due to the Photo diodes receiving ambient light to be the cause. No wonder, no one made a transparent mouse like the IMAC-PC.

THE INTERFACE

What type of signals are generated when you click a mouse button or move it on the mouse pad in different directions? 

Unless we know this , we cant send these signals through an infrared beam. Since there are five wires , do we need five beams? 

A little more research gave us some useful information. 

Since the mouse is connected to the serial port ( RS-232) it may be sending standard protocol data in serial form at a particular BAUD rate. (BITS PER SECOND) To test if this was true, we plugged in a new mouse into COM-2 after removing our modem and ran a software called "serial port watcher". 

This software merely displays on the screen whatever it receives from COM-2. You can also write one in "C" - just read from port COM-2 and display the byte on the screen and get back into a loop. 

After running this program, we clicked a mouse button , double clicked it, moved it north/south/east/west and all we got was JUNK on the screen - nothing consistent. 

Atleast we know knew that clicking buttons and moving the mouse created data flow FROM the mouse to the PC and the mouse steals a little current from the PC serial port.

We were looking for proper data to come from the mouse , like 
left click should send "L" 
right click - "R" 
or something like that. 

We reset the PC and ran the program again -

We dint touch the mouse and nothing came on the screen. Click a button and we got junk again. 

A quick recollection of our data communication programs reminded us that the baud rate of our software could be wrong. In the software there was an option to change the baud rate from 300 baud to 19200 baud and it was set to 9,600 baud. The parity was "NO" and STOP BITS was 1. Looked to us like our modem communication software we normally use 9600-N-8-1 a popular standard in data communication. 
where N=no parity 8= no of data bits 1= no of stop bits and 9600= bits per second. 

We surely had a slow mouse with us , so we reduced the speed to 4800 and then to 2400 but still we got junk. 

Luck at last when we tried at 1200 baud.

We got some meaningful data on the screen. Left mouse click generated 3 bytes of data on the screen 
and releasing the button generated another 3 bytes of data. We carefully clicked and released the left mouse button and noted the data- it was consistent. So did the right mouse button but different data. 

It was always three bytes at a time. Moving the mouse also generated a 3 byte stream of different data for different directions. 

This was the break we had wanted. We finally realised that the mouse was just sending RS232 standard data at 1200-N-8-1 to the PC's serial port and the mouse drivers job was to read this info and pass it on to the application running on the PC.

From experience we also realised that the 3 byte stream of data must have some international standard because we often pull out and plug in a different brand mouse on a PC and the mouse still works. So the mouse driver software still recognises the new mouse. 
 

WIRELESS

Back to the beginning, we now have to send this data through' an infrared beam to the PC. 
Our block diagram now seems to work in theory - send the serial data through' a beam instead of wires. The mouse seems to be a one way com device and a simple circuit can convert the serial pulses of current to pulses of IR light and the receiver diode detects this IR pulses about 12" away and converts it back to electrical pulses and sends it to the PC. 

Sounds too simple - anyway we started our design and prototype - 

thought we could finish it within an hour.....

How wrong we were... 

it took us 3 days....! 

PROBLEMS we never thought of

1 The mouse is NOT a one way device 
2 How do you supply power to the breadboards without leaking current into the PC and damaging it ? 
3 Serial ports of different PCs give a voltage from -/+9 to -/+12 
4 Since the mouse is not connected to the PC now, we have to provide a power supply to it - 
   at what voltage ? should it be stabilised ? 
5 Photo diode receivers also respond to natural and room lights besides IR. - tube lights flicker at 100hz - 
   it appears as though this concept may work only in total darkness!
6 Our demo mouse had three buttons.

but we solved all the problems finally 

this is how we did it- 

to be contd......in part-II 

AN EXCELLENT PROJECT ON PCB FOR BE-ECE STUDENTS

OR FOR BE-CSE STUDENTS USING BREADBOARDS.
 
 

  Back to previous page

Hits: 

 
about us   |   resources   |   experience   |   packages   |   electronics   |   live projects   |   clients
 our plans   |   login   |   downloads   |   locate us   |   contact us   |   links

Site best viewed at 800 x 600 resolution with IE 5+ or NN4+
 Copyright  ©  Mostek  Electronics 2005  


www.mostek.biz   Email: mostek@pobox.com
www.mostek.biz   Email: mostek@pobox.com