Final Project Report
Session: 2005/2006
Supervisor: Dr. C. Trayner
Project Number: 108
Assessor: Dr. V. Postoyalko
ELEC 3892
Project Title: Optical Mouse-based Odometry Name: Michael-Melhan Wijetunge de Silva SID No: 010016293
ELEC3852/3882/3892 Final Project Report 2005/2006
The University of Leeds School of Electronic & Electrical Engineering
Declaration of Academic Integrity Student Name:
………………………………
[Block Capitals]
University ID Number:
………………………………
Programme of Study:
………………………………
Module:
………………………………
Module Leader:
Professor Michael J Howes
Plagiarism in University Assessments and the Presentation of Fraudulent or Fabricated Coursework Plagiarism is defined as the copying of ideas, text, data or other work (or any combination thereof) without permission and/or due acknowledgement. Fraudulent or fabricated coursework is the production and submission of such work, particularly reports of laboratory or practical work, to satisfy the requirements of a University Assessment in whole or in part.
Declaration: • I have read the University Regulations on Cheating and Plagiarism[1] and state that the work covered by this declaration is my own and does not contain any unacknowledged work from other sources. • I confirm that any mitigating circumstances or other matters which might have affected my performance and which I wish to bring to the attention of the examiners/markers have been submitted to the Secretary of the Director of Learning & Teaching [Lyn Cookman R166a, School of Electronic & Electrical Engineering]. Signed………………………………… Date………………………… [1] http://www.leeds.ac.uk/students/handbook/SECTION5.htm#cheating
Abstract An autonomous search-and-rescue robot known as RABOTA uses an adaptation of the technology currently seen in optical mice to measure the distance travelled as it attempts to locate derailed trains inside tunnels.
In loving memory of my Father, Nilhan de Silva (1939 - 2002).
Acknowledgements “The most beautiful thing we can experience is the mysterious. It is the source of all true art and science.” — Albert Einstein I would not be where I am today if it wasn’t for my Mom and Dad as they have always believed in me, recognised my talent and helped me improve myself and therefore given my life meaning. Since the passing of my Dad it is my Mom who has given me the strength to continue chasing my dreams. Since my first year at University there has always been someone I could rely on for advice and help and that is my personal tutor Dr. A. Hughes. I would like to thank him for his words of wisdom over the years and useful suggestions for this report as well. I would like to express my gratitude to my supervisor Dr. C. Trayner, who has given me an extremely exciting project and I am forever grateful for his advice and support. I would also like to thank Dr. V. Postoyalko for taking the time to read both the interim and final reports of this project. Unlike most individual third year projects, I was given the opportunity to work together with Mischa Altman, Amjad El Nayal, Dave Wheatley, Shueb Ahmed and Aditya Soni in designing and developing RABOTA. I would like to thank them for their dedication, inspirational engineering abilities and objective criticism. Last but not least I would like to thank my friends (in no particular order) Thomas Ramsay, Michael Peel, Bob Clough, Jonathan Weerasuriya (and his parents), Xu Xin and my cousins Cheryl Alles and Dinesh Warusavitharana for being there for me and assisting in proof reading this document.
Contents 1 Introduction
1
2 Optical Mouse Operation & Communication
3
3 Adaptation of Current Optical Mouse Technology
6
3.1
Brief Overview of Optical Physics . . . . . . . . . . . . . . . . . . . . . . . . . . .
6
3.2
Lens Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
3.3
The Optical Mouse CMOS Sensor . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
4 Internal Communication via I2 C
10
5 Design
11
5.1
Development Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 5.1.1
5.2
5.3
Programming the microcontroller . . . . . . . . . . . . . . . . . . . . . . . 12
Software Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 5.2.1
Development Language and Compiler for the Target Architecture . . . . . 13
5.2.2
Development Language for Displaying and Processing of Information on a Personal Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Development of I/O Sub-systems . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 5.3.1
The RS-232 Interface for Debugging & Error Reporting . . . . . . . . . . . 16
5.3.2
Serial EEPROM Data & Error Logger . . . . . . . . . . . . . . . . . . . . 17
5.3.3
The LCD Interface for Status Reporting . . . . . . . . . . . . . . . . . . . 18
6 Development 6.1
19
Design on Breadboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 i
6.1.1
Testing Mouse Communication . . . . . . . . . . . . . . . . . . . . . . . . 20
6.2
Prototyped PCB of the Optical Mouse-based Odometer . . . . . . . . . . . . . . . 23
6.3
Prototyped PCB of the Serial EEPROM Data & Error Logger . . . . . . . . . . . 24
6.4
The Completed Optical Mouse-based Odometer . . . . . . . . . . . . . . . . . . . 25 6.4.1
Interfacing the Sensor with RABOTA . . . . . . . . . . . . . . . . . . . . . 26
7 Interpretation of Movement Data
27
8 An Overview of Alternative Odometry Systems
28
8.1
Shaft Encoder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
8.2
Inertial Guidance System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
9 Future Directions
30
10 Conclusion
30
11 The Appendices
34
11.1 Appendix A - Technical References . . . . . . . . . . . . . . . . . . . . . . . . . . 35 11.2 Appendix B - Flowcharts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 11.3 Appendix C - Firmware Source Code . . . . . . . . . . . . . . . . . . . . . . . . . 59 11.4 Appendix D - PCB Schematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 11.5 Appendix E - Datasheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
ii
1
Introduction
An Optical Mouse-based Odometer (henceforth, “odometer”) was implemented as one of the sensors built into RABOTA, a MEng group project involving the design of an autonomous railway search-and-rescue robot, so as to measure the distance travelled by the robot. The optical mouse will be used to scan the surface of the centre of the track in order to ascertain total displacement from the starting location. RABOTA will travel into a tunnel in search of a train in trouble and once it has located the train it will relay telemetry back to the controlling computer. The location of the train, with up to a maximum of ±50m error, is crucial, as search-and-rescue personnel wearing breathing apparatus can travel ∼950 m on one cylinder of air and therefore they would have to turn around just before they travel 0.5 km into the tunnel. As most of the tunnels in Europe are longer than 1km [1] it is apparent that the role in searchand-rescue carried out by RABOTA is extremely important in the quest to protect the lives of passengers on-board trains. Two separate communication networks are in operation aboard RABOTA [2], as illustrated in Figure 1. A wireless 802.11b/g network is used to interface RABOTA with the remote control terminal while an I2 C (Interconnecting Integrated Circuits (IIC or I2 C)) master, which handles communication with a host of on-board sensors and sub-systems via the I2 C-bus, is connected to the mainboard via a serial link, thereby bridging both communication networks together.
Figure 1: Illustration of communications taking place inside RABOTA. The odometer uses a microcontroller as a means of interfacing with the optical mouse and the I2 C-bus as well. An overall system diagram of the odometer is illustrated in Figure 2.
1
Figure 2: System diagram of the Optical Mouse-based Odometer. The odometer includes an interface to display text on an LCD, which would allow for quick troubleshooting of the odometer while the robot is in operation or being tested. A serial communication interface has also been included for debugging and error reporting purposes. The ‘design’ for a Serial EEPROM Data & Error Logger has been included in this report as an optional tool towards troubleshooting possible issues with the odometer. As per the project specification, the work carried out in the first semester involved researching the operation of optical mice and the various communication protocols, thereby designing required sub-systems to aid in implementing a completed odometer. During the final semester a communication protocol was implemented so as to communicate with the mouse along with a study into increasing the sensing distance of the ‘mouse’ by means of a lens, thereby allowing the odometer to be used from a far greater height, which is suitable for use with RABOTA. Finally, the completed sensor was fabricated and tested for implementation in RABOTA.
2
6 6.1
Development Design on Breadboard
The final prototype was developed on a breadboard as shown in Figure 14. The circuit included a LM7805 +5V voltage regulator and a ∼100µF capacitor to de-couple the power supply and smooth out any interference caused by stray capacitances between the tracks of the breadboard.
Figure 14: The complete circuit being developed on a breadboard. As RABOTA features a regulated power supply, a voltage regulator will not be required in the final design, thereby resulting in a smaller Printed Circuit Board (PCB). The implementation of ICSP can be clearly seen in the image above, where the thick 6-core white cable connects the programmer to the microcontroller.
19
6.4
The Completed Optical Mouse-based Odometer
R The finalised PCB was soldered using a Metcal MX-500S Soldering/SMT Rework System with quality components, such as the turned pin IC sockets, for a robust and reliable sensor.
The design is not only mechanically but also electrically sound due to the fabricated double-sided PCB with Plated Through Hole (PTH) and 1/16” FR4. 1 oz. copper along with the immersion silver plated contacts and soldermasking on both sides.
Figure 21: The LCD indicates that the sensor is online. R The odometer was tested with a Logitech MX 500 USB optical mouse connected via the supplied USB to PS/2 adaptor. A backlit 2 × 16 HD44780 compatible LCD was used to verify that the LCD interface was functioning correctly, and the movement packets were recorded in a terminal session via RS-232.
25