|
|
I Make Projects . com On the right project, some bad rust looks better than some good paint. |

This is an older site. For my professional site and contact information, visit AE Innovations. You can also visit my new site at It Came From The Workshop.
|
|
The Seeing-Eye-Mouse
What It Is Short Version To put it concisely, the Seeing-Eye Mouse (like a seeing-eye dog) is a piece of logical "glue" - it gives you a simple interface to a computer mouse for whatever purpose you may want.
Slightly Longer Version The Seeing-Eye Mouse is a chip (made by programming a PIC) that allows you to use any PS/2 (or USB) mouse as a sensor, allowing you to easily read information such as direction and speed (relative a surface, like the floor) in various useful and interesting ways. It has been purposefully designed to allow for a wide range of interface modes so it's easy to hook up to any electronic project. Plug in a mouse, and it reads the mouse movements and turns that movement into digital pin outputs and (optional) RS232 data, to be used in any way you like. For example, when attached to a robot it works as a navigational aid (detecting relative direction and speed). But you can use it in other ways, too. I originally made it to be an additional sensor for my Mini Sumo Robot. (More on that later in the page)
Some Words About Why Hardware hackers in general and robot-makers in particular are pleased by using things in elegant and unusual ways. And the Seeing-Eye Mouse pleases me. The mouse really is a nice little elegant piece of hardware and capable of quite a lot. And they are cheap. It's a shame to use them only for controlling a mouse pointer on a screen. In fact, especially for robotics the Seeing-Eye Mouse fills a sensor void - being able to detect actual motion in a easy, simple, cheap, and meaningful way. I originally conceived of the idea for use in Sumo Robotics as a way for my robots to detect whether or not they were being pushed by their opponent. But it's really useful for anything else that might tickle your fancy. What It Does It is a man-in-the-middle between you and the mouse, and takes care of all the protocol, state tracking, etc. It then presents the data in various easy-to-read, easily interfaced formats. If you can read simple HI/LOW pin outputs from a chip, you can use the Seeing-Eye Mouse. (Optionally higher functionality is available by RS232 serial output, too.) There is even a mode that drives regular R/C servos directly with PWM output. How It Works Whenever the mouse is moved, it does some low-level hardware stuff to determine some basics about the motion and other events (such as button pushes/releases). It sends this data -- X/Y change from last position -- to the host (usually a PC, or in this case the Seeing-Eye Mouse chip) which then interprets it in order to take some kind of action. With a PC, that data is used to move the mouse pointer and perform button click actions. The Seeing-Eye Mouse reads the mouse's raw data and handles all the protocols, state tracking, and calculations (including remembering past data) required to provide you with simple, meaningful results that anyone can understand and use. Bare-Bones Operation Action Shots The prototype board pictured below demonstrates the most basic of operation modes: mouse movement direction.
Advanced Capabilities It is possible to configure both the sensitivity (movement detection threshold) of the Seeing-Eye Mouse as well as the mode of operation. These are all set by hardware (tying configuration pins high or low). No software configuration required. These other modes include output data such as:
Advanced Capabilities It does not emulate a mouse (it cannot control your PC's mouse pointer). It does not make the low-level operation of the mouse available to you. So you cannot use it to turn your mouse into an optical scanner like this one (http://sprite.student.utwente.nl/~jeroen/projects/mouseeye/). It reads the mouse's output protocol just like your computer does. It does not provide access to the low-level operations of the mouse circuitry. It is a black box that speaks "Mouse Language" and processes/interprets for you, not an interface into the guts. Uses, and What I Used It For I put it on a mini-sumo robot as a navigational sensor. Unlike wheel or shaft encoders (which sense movement of the wheels) the Seeing-Eye Mouse tells me whether the robot is ACTUALLY, physically in motion. This is important information for a Sumo robot. (But so far as I know all current ones are "blind" in this regard.) In normal robots, movement in a direction other than what is intended is usually indicative of a gross malfunction or other error. In Robotic Sumo Wrestling, it happens all the time - the whole point is to muscle the other robot around! So it is of obvious significance in situations such as robotic combat, or useful for other feedback - to detect wheel slippage, poor traction, track or wheel failures, actual speed changes (due to going up/downhill), etc. When attached to a robot the Seeing-Eye Mouse, as a sensor, can answer:
It can even move an unmodified R/C servo in proportion to the mouse speed in the X and/or Y axes (this makes an easy head-control that "looks" left-right in the direction a robot is moving.) Of course, you don't have to attach the mouse to a robot. You can also have the mouse stationary over something that moves (like a belt, wheel, track, etc) or move the mouse with your hand as an input device -- it all generates the same kinds of data in the same easy-to-read ways. Stuff it can not do:
What Does a Functional Seeing-Eye Mouse Consist Of? The core pieces are: - The Seeing-Eye Mouse chip (consists of a PIC16F628A microcontroller) See the Downloads section below for the source code. - A mouse (PS/2 or USB) Note: all PS/2 mice should work but I have found at least one USB mouse (a Microsoft one) that did not work when plugged into a USB->PS/2 adapter. - A regulated +5V power supply. What is the Simplest Way to Make it Work with the Fewest Parts? Here is how to hook up the Seeing-Eye Mouse with no external components other than 4 LED indicators (with 4 resistors for the LEDs) for absolute bare-bones operation (you do need to provide +5V though, and a 0.1uF capacitor across the power to the PIC would be nice):
Once a mouse and power is supplied to the Seeing-Eye Mouse, it can communicate in several different ways, including: - Digital
I/O (pin outputs for Forward, Back, Left, Right) The Seeing-Eye Mouse is intended to be used mainly as an output device. Full details of the communication modes are in the documentation - see the Downloads section below. Configuration The mode of operation (as well as some basic sensitivity) can be set by pin I/O (setting pins high or low) on the Seeing-Eye Mouse chip. No programming or software configuration is necessary. Just some jumpers or some DIP switches. Full details of the operation modes are in the documentation - see the Downloads section below. If customization is desired, the source code is available for you to tweak the source code and re-program the chip. You should be familiar with PIC programming before you consider doing such a thing, however. Other Possible Uses
The Seeing-Eye-Mouse Used in my Mini-Sumo Robot "Tricksy"
Mini-Sumo robots are up to 10cm x 10cm in size, and up to 500 grams in mass. The object is for one robot to push the other robot out of the ring (the ring is the raised black disc with a white edge). Unfortunately, I fell ill the night before and could not travel. Then, in 2005 I was unable to attend due to a time conflict. So... sadly, as of Feb 2006 it has never seen action outside of my basement. Tricksy's "edge" would be the ability to tell in what direction it was physically moving. As explained in the previous on this page, this information is of obvious use to a Sumo robot. I used a modified Solarbotics Sumovore kit as the base for "Tricksy". The guts of an optical mouse are on the bottom (where 4 AA-cells used to be) and a custom daughterboard along with the Seeing-Eye-Mouse prototype PCB has been added. Would Tricksy with a Seeing-Eye-Mouse defeat "plain" sumovores (which are formidable opponents in their own right)? I hoped so.
So what did I do with the Seeing-Eye-Mouse on a sumo robot? Gave the robot a secret "Escape" move, of course! Side note: Normally I would design a Sumo Robot under the principle that the best defense is a good offense. Weight, power, and resources spent on a defensive aspect are just resources that aren't allocated to offense. Or put another way, the opponent can't push YOU if you've already found and are pushing THEM. So I can't really explain why I took this route with Tricksy other than I think it was neat, and I wanted to take Sumo robots in a direction that I have not (yet) seen explored. The robot already had good offense (thanks to the excellent kit by Solarbotics, it is no entry-level beginner's dud - the kit makes a highly effective competition robot), so I tried to give it an "edge" on top of that. The concept for attaching the Seeing-Eye-Mouse and interfacing it to the Sumovore is straightforward. The basic Sumovore has a discrete "brain" built in to govern its behaviour. So I made a daughterboard that is like a breakout box. Instead of the motor signals going directly from the discrete brain to the motor drivers (to control forward, back, turn left, turn right) the signals go to my daughterboard which can pass them (unchanged) through to the motors, or optionally override them. Mostly, the daughterboard simply passes the signals through to the motors so the robot's basic behaviour is unchanged.... except for when it's losing a shoving match! When the motors should be going forward but the robot is moving backwards, the daughterboard overrides the discrete brain's commands as needed - governed by what the Seeing-Eye-Mouse is telling it about detected movement.
So, to explain further let's digress a little to Sumo Robots and how they work and what happens in matches. Modern sumo robots with IR sensors are pretty good at detecting their opponents. When the match is on, the robots plow forward, heading for the other robot (the only other object in the ring). If they are lucky, they catch the other robot on the side or the rear, and easily shove them out of the ring. But often, a match comes down to a head-to-head pushing match. Both robots plow (mostly dumbly) ahead, hoping to be the victor in this brute-force showdown. What "Tricksy" uses the Seeing-Eye-Mouse to do is detect if Tricksy is losing this shoving match. If the discrete brain is telling the motors "Full Speed Ahead" but the Seeing-Eye-Mouse tells Tricksy that the optical mouse stuck under it has detected that it is in fact moving backwards -- then Tricksy is losing the shoving match! And as anyone who has watched or competed in Robotic Sumo wrestling knows, once you start to lose traction you tend to KEEP losing it. Once one robot in the head-on "gives", it's usually a goner. So I am losing the shoving match - what do I do about it? Well, first I need to get out of the way. Then I need to counterattack. If I just keep plowing ahead I am as good as eliminated! Steps: 1. Get out of the way. Or in other words, break contact and retreat. This consists of overriding the motor signals so that we back up and turn out of the way to the side, while still keeping our opponent in front of us -- like doing a fish hook maneuver but while moving backwards. The idea here is to get a little room to maneuver to get out of the direct line of fire and end up pointing more or less in the direction of the opponent. 2. Counterattack. This is nothing more than allowing the built-in "instincts" of the Sumovore to once again take over. In other words, we're finished overriding the signals from the discrete brain. It will once again home in and charge at anything detected by the object sensors. (Which should include the opponent which we have kept in sight while retreating.) Ideally we re-engage the opponent, but this time from the side or rear. I had to do a lot of tweaking for times, angle to turn, etc but I think I got it mostly right. This isn't a get-out-of-jail-free card for the robot, however. A fast robot with good sensors may just stick nose-to-nose with you like glue throughout your attempt to break contact. But if you do what Sumo Robots always do when they are in a push-losing situation (i.e. nothing) then you're DEFINATELY a goner. At least this way there's a chance; you are probably at least in a somewhat better position than before, and if nothing else you might keep your traction this time around when you re-establish contact. There is surely plenty of room for improvement all around, but I think it is a good first implementation. Video of "Tricksy"
In the video I push the robot back so that the Seeing-Eye-Mouse senses backward movement when it knows the robot should be moving forward. This triggers the "Escape" move. The robot then does the fishhook-reverse to escape - we pretend the inert "opponent" still charges angrily ahead meanwhile - and then the regular behaviour of my robot takes over for a counterattack. Possible Improvements It would be really neat if a lens could be added to an optical mouse in order to allow it to work without needing to be so near to a surface. (April 2008 - I used to have a link to another person's project that did exactly that here, but it is no longer valid.) Downloads and Resources To Make Your Own Seeing-Eye Mouse Seeing-Eye-Mouse-v1.0-Documentation.txt - Text file technical documentation on operation, pins, and protocols used. Seeing-Eye-Mouse-v1.0-PIC_CODE-20041114.zip - All source code (ps2.c, ps2.h, servo.h) for use with the CC5x compiler. With the compiler and these files you can make a HEX file to program a PIC16F628A PIC and make your own Seeing-Eye-Mouse version 1.0 chip. Does not include precompiled .hex file. Seeing-Eye-Mouse compiled HEX code for PIC16F628A - Pre-compiled HEX file for programming your PIC with any suitable PIC programmer. If you need them, the programming options are: WDT off, Powerup Timer On, MCLR on, Brownout reset on, Low voltage programming off, CPD off. Don't forget to also set it to use INTRC (internal oscillator).
A note about the RS232: The Seeing-Eye-Mouse uses noninverted RS232 at TTL levels, meaning that to hook it up to a PC's serial port you need a few extra parts as shown in the graphic above. I made it this way because as-is it is easier to wire up to another PIC or BASIC STAMP with no additional parts. To read the RS232 data with a BASIC STAMP for example, wire the RS232 out (pin 8 on Seeing-Eye-Mouse) to a pin on the BASIC STAMP and use SERIN mode T9600 (TTL True, 9600 baud) to read the data. See the documentation for details about the protocol. |
![]() |
Main | Projects | About | Contact and Services
Original Content - Copyright 2010 (Except where specified)