Author Options:

accelerometer based mouse, what happens when tilted Answered

I got a free dual axis low g accelerometer from freescale, the output voltage is proportional to the g forces, I also have a ton of free PICmicro chips with I2C and A/D converters. I want to make a mouse just basically for proof of concept. I was thinking about how to program it, since I want to tell the computer the "movement since last request", I would need to calculate the speed using the g force reading (9.8m/s2 = 1g)
if the mouse is moving at a constant speed, the g force would be 0, and the speed would be the same as the last reading, also, gravity affects the reading if the mouse is tilted slightly, increasing the speed even if it is not moving at all, so I was thinking, if the mouse was tilted, and then balanced again, the speed would remain the same, causing annoyance to the user. this is the problem i would like to solve.
Is there a space efficient way to make a accelerometer not affected by tilt? if not, is there any tricks I can use (such as detecting unusually uniform g force and automatically go into "joystick mode")? I have been thinking about using a thumb button to zero the speed (while held down, the mouse can also do "super precise mode" which means one pixel per half second no mater how fast), is the thumb button the way to go? how about sensor to see if there is contact with a surface? or four IR rangers to detect tilt while above a surface?

side note: does anybody have a datasheet for ata1060xa? its a optical mouse sensor with built in 27mhz RF transmitter made by @lab, and they don't share datasheets.
oh and head on over to cypress for free wireless usb modules (2.4ghz i think, multiple channels) if you are interested in cheap RF, i have two with 50 meter range

info on mouses and keyboard serial interface found here


here's a half baked idea, hack an optical mouse, rewire the buttons to the PIC, do not connect the clock and data line to the mouse, but to the PIC instead, use the LED control pin on the optical sensor to tell the PIC whether the mouse is moving or not too bad the chip needs a delay before sending the "no movement" signal

Although you don't explicitly state it, I assume you want the mouse to be moving around in the air. If the mouse is sliding over a table, tilt shouldn't be a problem. I think that using tilt only would be a better concept, I think it'd be very hard to control a position using left/right and forward/reverse acceleration. I've found this to be the case when using the Wii games, it's OK to slect a direction (ie steer) using translation of the remote, but much easier to control position (ie aim) using tilt.

I was actually thinking of using it on a flat tabletop (i figure your arm would get tired if you held it in mid air), except, you know how sometimes you lift the mouse off the surface to move it somewhere without moving the cursor? if it tilts at all during that moment, the speed would remain and the cursor would be constantly moving in that direction, forever

Surely as soon you put it back flat on the table there will be no acceleration and everything will stop. Of course it may have moved in the meantine, but you can move it back.

if g forces is 0, the speed is constant, so it would move every movement will start and end with the same velocity, if it started from 0m/s, it will end in 0m/s, but if the mouse registered a speed of 1m/s but is really not moving at all, then after you move it and stop again, the registered speed will still be 1m/s, even if the mouse has actually stopped


11 years ago

I've done something similar with AVRs, an ADXL330 accelerometer (analog devices) and Liapac RF modules. Tilting is definitely the easiest approach (gravity can be considered "static acceleration.") As a tilt sensor, they also have 'absolute' positioning.

Not sure you'd be happy with the control from a 2d movement-driven mouse. For one thing, an accelerometer sensitive enough for desktop use is going to jump everytime you touch it. Buttons are an important design consideration: pressing a mouse button sends a physical shock that *will* effect the accelerometer.

It's not impossible, but there will be some serious technical issues (why you don't see a lot of successful products like this on the market--the components are fairly cheap.) A game controller is very do-able, but a precision mouse will be tough...

that's pretty damn sensitive, maybe i can program it to allow for some shock though

Yeah, they are quite sensitive. I reread your orig post, and no--there's no way an accelerometer isn't effected by gravity when tilting. In fact, whichever axis is aligned vertically will be reading 1G (or -1G) at rest. As you tilt away from vertical, it will reach zero G when it's perpendicular to earth's core. AFAIK, all the MEMS accelerometers work like that...

does anyone think using four IR phototransistors and a IR LED bar is a better way? determine movement by judging the difference between voltage levels of each sensor that will bring it's own problems, like what happens when u go off screen it'd be an awesome experiment though