Using a Laser Mouse as Position Sensor
Kirk Fraser
Posts: 364
Where can I get details on how to use a Laser Mouse as a position sensor? I see a laser mouse is supposed to be able to track 2000 DPI which should provide more accuracy than a 10K pot such as those sold by DigiKey for position sensors. How do I decode the laser mouse signal in a Propeller? Is there open source laser mouse driver software?
Also, what does one do if one wants to sense motion in the opposite direction? Can a laser mouse sense the change?
Thank you.
Also, what does one do if one wants to sense motion in the opposite direction? Can a laser mouse sense the change?
Thank you.
Comments
My project with it was to use it for odometery which sort of worked and I've been meaning to write up my findings. But I haven't had the chance.
The mouse sensors are not designed for perfect repeatable precision - ie if you are repeating a motion back and forth the absolute value might slip a little depending on the surface roughess etc. This doesn't matter for normal mouse operation as the human compensates based on the position on the pointer, but for your application it may matter.
For absolute accuracy there are other options - you're using a 10k pot so I guess its rotary position you're trying to sense? Or are you using a linear pot? For rotary encoders are a better option, and for linear there are things like LVDT etc. You need to give us more info
http://www.mouser.com/Electromechanical/Encoders/_/N-39xfc?Keyword=rotary+encoder&FS=True
Don't forget to buy a knob to go with the encoder.
Edit: Tubular beat me to it. SparkFun also sells a 200 pulse/rev unit.
I've heard that Arduinos can read a standard mouse pretty easily.
I know there's a metal detector object but when I looked at it was really complicated. A LVDT needs two coils and then you'd need to generate an AC voltage and then monitor the second coil's AC voltage. IMO, this is not a trivial task.
I'd think you'd just want to spend a couple of dollars on a higher quality pot and use a high resolution ADC.
Rotary LVDT do exist.
Magnetic encoder chips are quite cheap and can have crazy resolution.
What is the application? You may find that the methods used in scanning mirror galvos are suitable, they use simple optical or capacitive sensors, quite a bit on the web to be find showing how.
Graham
What do mean by a "magnetic encoder chip"? I use the rotary encoders I linked to earlier, but I'd also like to find a higher resolution solution that wasn't expensive.
Magnetic encoders are available from several suppliers in many forms, assembled like a pot and also as a smt chip and a magnet or as chips mounted on little boards:
http://www.austriamicrosystems.com/Products/Magnetic-Encoders/Rotary-Encoders
http://www.renishaw.com/en/magnetic-rotary-encoders--9801
http://www.avagotech.com/pages/en/motion_control_encoder_products/magnetic_encoders/
The chips alone are the cheapest option but considering the resolution, even the kits (mounted chip and magnet) are an OK price. The housed renishaw units will probably blow the bank though.
They are absolute too which can be a bonus for many applications.
Graham
Right you are.
Thanks for the magnetic encoder links. Those look very interesting.
One fellow suggested digital filtering to improve the potentiometer output but I don't yet know how to correctly do that. Averaging 10 measurements won't work as I've tried that and come up wrong. So it would have to be a filter that detects and rejects outlying results.
If it was a big rotary table like they wrap marshmallow hay bales with, I could stick bar codes around it and use a bar code reader to tell where it was. But with a robot finger (the size of a human finger) there's not much room. I've been trying these two sensors
http://search.digikey.com/us/en/products/SV01A103AEA01B00/490-2400-ND/588421
http://search.digikey.com/us/en/products/EVW-AE4001B14/P12426CT-ND/637165
I'll keep looking at the LVDT, digital filtering, and other options until I find something that works all the time.
You say averaging is not working? You add up 10 measurements and then divide by 10? If that does not improve things you have some very serious outliers!
Graham
That is either the potentiometer or a programming error. But the potentiometer would have to be really bad I would think one measurement would have to be really far off or all quite a long way off.
Graham
Could you discribe your setup a bit more?
What kind of resolution do you need? How are you measuring the pot's position?
I just don't see why a decent pot wouldn't work. I've use pots for lots of things myself and they jump a little but not much. There are also other filtering tricks you could use besides just averaging. You could make sure a certain number of reading all agree within some predetermined threshold before acepting the reading as valid. (I could write a little demo code if you need it).
Are you using an ADC chip or some sort of RC time function to read the pot?
Are the pots you linked to the only ones you've tried?
I'm using a 0.1 cap to get RC time and a MCP3208 to read it into a Propeller. I'm currently on a solderless prototype board with a small aluminum rod providing the shaft and knob function. When I turn it by hand, sometimes it jumps around too much, like 1000 ohms to 8000 in a degree or so turn. I'm hoping for 12 bit but will settle for 10 bit. That makes the Hall Effect devices with 13 bits look good.
The new filtering trick would have to move the threshold along so no value enters that is more than say 10% different from the prior accepted value, unless the appropriate time has passed to make it possibly valid.
I don't understand this. Usually one uses RC time with a cap OR a MCP3208. Not both.
Here's a schematic I copied from one of the MCP3208 objects.
The schematic shows two different pots being used. The wiper from the pot is connected to one of the ADC channel pins.
How does your setup differ?
The line between wiper and chip is connected to ground through a 0.1 capacitor.
I'm not sure, but this might be the source of most of your trouble. This might interfere with the way the MCP3208 measures the voltage. Again, I'm not sure about this but I haven't seen schematics that use a cap this way.
Hopefully someone more knowledgable will jump in to clear it up. Until then, I'd suggest not using the cap (or using it on the Vdd pin if it doesn't already have a cap there).
However, the Hall Effect devices still look worth exploring. Some are even smaller plus another few bits more accurate.
Thanks.
Do you get stable readings from the pot if it just sits there without being moved? If not, it might not be the pots fault.
The unmoved pot readings are stable in the largest two digits for example varies between 8434 to 8454. That's only about 8 bits of accuracy. So the Hall Effect devices are looking better!
I never use a separate Vref myself. Those numbers just don't seem right. It seems like there's some noise causing the touble and not just bad pots.
I will have to experiment on the pulse losses when there is a start, stop or reverse but hopefully they shouldn't be too numerous or random. I will send it back and forth loads of times and check on its return accuracy.
It's possible my math is off. 843 to 845 might be less than 8 bits accuracy. These low accuracy figures have been fairly consistent with any of my pots including brand new pots over several years using Stamps as well as Propellers on different computers. I suppose that's accurate enough for an Abio dog leg but for a human type finger I'd like to see human style accuracy, which I've read can be 1/32K.
I looked at your links for a Hall effect sensor and ordered three from Digi-Key to test. The package arrived sealed with a desiccation package and moisture indicator. This is unusual for electronics I've ordered so I'm concerned what that means. Will I be able to use it in a rainy environment? Or any environment that isn't hermetically sealed and moisture free?
The item ordered was RS5055 which is a good size for small spaces available. However unless you can guide me to confidence in the moisture situation, I'm thinking LVDT is the only way to potentially get more than 8 bits position precision in an outdoor environment.
Thanks,
Kirk