Using optical mouse to measure distance

By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up. For my device moving above the surface railway tracks I need to be measuring the distance traveled. So far I have been using a wheel with IRC incremental rotary sensor.

To simplify it I would like to use some kind of optical sensor that scans the surface. I have seen some ideas using optical mouse sensors for the distance measurement, however, it is not clear to me where this would take the reference for determination of the actual distance by which the sensor has moved over the surface.

It is called optical flow sensor. There is a also a free source community not sure that develops and sells such device. For example you could mount the camera on top of the railway wagon with known distance from ground and illuminate the surface with LED lamp if you wish to measure at low light.

Such setup will be more precise if the surface isn't flat, all you have to do is to use lens with more magnification. A displacement sensor will need a fixed reference point to measure off of to gather repeatable data. If you've only got a linear track this could work, but I expect that's not the case. A common way to approach this is an encoder.

An optical rotary encoder mounted to one of the wheels would work well, is inexpensive, and robust. An alternative is a linear encoder. These are used when you want to remove any sources of error when converting from the rotational measurement to actual distance traveled.

Instead of having a grid that's measured each rotation, you measure against a linear grid that's along the entire path of travel. These are extremely accurate and also quite a bit more costly. That gives you an amount of pixel displacement. From that pixel displacement, with the fixed distance between camera and surface, it's easy to infer a travelled distance. Now, for railway tracks, I'd expect you have some variance in the distance between optical sensor and ground.

That should be easy to build using two cameras mounted at a fixed distance next to each other, and really common image processing libraries OpenCV comes to mind, which is free and pretty much a de-facto standard in its discipline. The two cameras will give you depth information, and you can then use the camera imagery and the tools for calculating optical flow between successive images to measure the distance travelled.

If you're already familiar with OpenCV, and have two webcams lying around, sounds like a two-day project to come up with a proof of concept. Getting two cameras to be perfectly synchronous and fast enough, in an enclosure rugged enough for railway usage, also containing the computation platform, and with suitable illumination, on the other hand, sounds like fully fledged product development task.

If you can't, for mechanical reasons, have two cameras, one camera might be enough, if you know the width of the rails — you can use that width in the images to continously calibrate the camera's height, and then use the calculated height to the pixel displacement to real-world distance relation.

You might, also, just use something like a hall sensor mounted close to the rail or the wheels, and infer speed from the signals you're observing with that, or rather, from the derivative of them, really easily. Sign up to join this community. The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered. Optical odometer Ask Question.

Asked 2 years, 11 months ago. Active 2 years, 3 months ago. Viewed times.

using optical mouse to measure distance

Is there any such optical sensor? Or could the tracks themselves be relied on to provide a consistent reference such as the seams between rail segments or some other feature which pre-exists in the rail fabrication?This website uses cookies to deliver some of our products and services as well as for analytics and to provide you a more personalized experience.

Click here to learn more. By continuing to use this site, you agree to our use of cookies. We've also updated our Privacy Notice.

Click here to see what's new. This tutorial reviews various noncontact optical sensing techniques that can be used to measure distances to objects, and related parameters such as displacements, surface profiles, velocities and vibrations.

The techniques that are discussed and compared include intensity-based sensing, triangulation, time-of-flight sensing, confocal sensing, Doppler sensing, and various kinds of interferometric sensing with both high- and low-coherence sources.

Alfalou and C. Brosseau Adv. Connie J. Chang-Hasnain and Weijian Yang Adv.

Subscribe to RSS

Martin S. Heimbeck and Henry O. Everitt Adv. Jason Geng Adv. Alzahrani, D. Burton, F. Lilley, M. Gdeisat, F. Bezombes, and M. Mezzapesa, L. Columbo, M. Brambilla, M. Dabbicco, A. Ancona, T. Sibillano, F. De Lucia, P. Wang, G. Brambilla, Y. Semenova, Q.A Developer. An Eweek. Remember Me? Advanced Search. Results 1 to 12 of GeForce GTX Windows It is on the Scrolling tab. Do you have that option?

If so, the pointer speed should be in there. If not, then you may need to find some drivers from the mouse manufacturer. If it's optical and your desktop or where ever you use the mouse isn't real smooth, you don't need the mouse pad.

Remove it and see if that helps any. And if it is optical, a dirty old mouse pad will work just fine.

using optical mouse to measure distance

A shiney surface throws things for a loop. My sister had an optical and her mouse wasn't moving right because her DH said she needed it. I removed the pad and now her mouse acts as it should. Only reason I mentioned this for zeszut. Posts 21, Did you install the software that came with it and or the software on their web site?

Originally Posted by Steve R Jones. Feedback Doctor's Lounge. All times are GMT I have the Windows XP version Which should be the firsts steps to do something like that?

United States. Turn on suggestions. Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type. Showing results for. Search instead for. Did you mean:. Mouse for measuring distance. Hello everyone! Any advice? Message 1 of 5. Re: Mouse for measuring distance. For something like this you'd most likely have to delve into operating system calls, since an application would only see what the OS passes to it, and in the case where the mouse is pegged at the top of a monitor and the user keeps moving it up, the app would not see a change in Y coordinates.

The OS, on the other hand, would see the messages coming from the mouse and basically "clamp down" on the Y coordinate.

What operating system are you using? Message 2 of 5. Thanks mercutio! Message 3 of 5. You can also try Google to see if anybody has done something similar. Message 4 of 5. Thank you mercutio, I will get into it, and see what happens Message 5 of 5.An LED is used to light the surface beneath the sensor, typically at a very low angle to help highlight any surface roughness so the sensor still works on rough, but solid-colored, surfaces such as paper.

Many of these sensors allow you to read out the raw image, too. Videos: Absolute microposition sensing using image recognition Relative position sensing i. Naked mouse cam and lens wired to a microcontroller. Fortunately, standalone SPI sensors are still alive and well. Of course, you will still need a cheap optical mouse to steal the lens off of or maybe an old CD player, etc. If you want to be all lame and boring, you could use this mouse camera as, well, a mouse.

Since you are only reading 2 registers, you can read this information at very high speed. But if you want to dig deeper, a builtin diagnostic feature lets you bang some other registers and return the entire image under the camera. A few things worth mentioning before you go further, though: this IS meant as a diagnostic feature only; they sell these things as mice and not cameras after all, and this feature is not the best implemented. Also, your maximum full-image rate is only a couple images per second.

Following are some demos of monochrome and color image acquisition, surface identification and micro-position sensing down to the um range. Circuit: The ADNSxx parts only require a couple external components: an oscillator and a couple capacitors to stabilize its power supply and internal reference voltage.

The oscillator frequency about 20MHzMHz is not critical; any cheap ceramic resonator will work fine here. So your complete parts list is:.

using optical mouse to measure distance

See below for some more. Or use my Arduino library. See here for a demonstration where someone combined the image and position readouts to use the mouse as a crude handheld scanner. I assume not very well, otherwise mouse companies would have already enabled frame-grabbing on USB mice and tried to sell it as combination mouse and biometric ID thingy.

Color imaging: The grayscale sensor can be used as a crude color imager by replacing the standard red lighting with an RGB LED, and taking one frame with each color lit in turn.

I assume like most photodiode technology the mouse cam pixels are most sensitive to the red-IR range, but the LED I used had a pretty weak red, so it was kind of a wash. In this method, you create a known optical pattern in this example I used Gray Code and apply it to the surface whose position you want to measure.

Then aim the camera at it so that it looks at a small subset of the optical pattern at any given time. Now you can identify the unique pixel pattern under the sensor and match it its position in the full optical pattern. In a project at work, we needed to know how far a visual indicator pin on a piece of machinery was extended at any given time, and whether its position was in tolerance reducing human observation error in dark and foul weather conditions.

Since the sensor could not be permanently attached, we also wanted to be able to measure slop or shifting of the sensor itself relative to the pin, which would produce an incorrect reading.

The small space, large pin travel and need for sensor cross-checking made common 1-D proximity sensors less attactive. By performing this 2-stage lookup find region grid offset on pixel grid, match region grid to known optical patternsthe total computation time is reduced by mainly working with only a small subset of the pixel data the region gridand the positioning resolution is at least region size and at most pixel size.

Working with only the center pixel of each region, to the extent possible rather than e. So all the pixels toward the edges of the region will tend to dilute the reading.

Position is resolvable generally to 1 pixel, in this case measured at about 2.By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. Engineering Stack Exchange is a question and answer site for professionals and students of engineering. It only takes a minute to sign up. I am trying to build an optical sensor for my old school, state property, standard french watt-o-meter.

The higher the wattage, the faster a tiny disk turns. Now the disk can be read by eye, so here is my question: why not use a hacked optical mouse to gather data?

What optical system do I need to read half milimeters from 15 milimeter distance using a classic optical mouse?

The focal distance of the laser lens and the distance from the target i. You ask for the former, but it seems that you want the later. To answer the question that you asked : Every mouse is different, but you can expect on the range of millimeters.

If you can remove the lens from the mouse, then hold it with pliers and move it closer and further from a white sheet of paper under the sun. The height at which the sunlight makes a point on the paper is the focal distance. On a cheap mouse laser lens that I tried, I got about half a centimeter judging by eye. To answer the question that you meant to ask : Every mouse is different, but you can expect on the range of millimeters to just a few centimeters.

My nice modern Microsoft Curve wireless mouse fails to work at more than millimeters above the mousepad. My Logitech G works a good centimeter above the mousepad, and I remember when optical mice first came out how I could hold the mouse a good 5 cm above the desk and still have it detect the motion.

I recommend trying to get the oldest optical mouse that you can, the sort with the bright red laser. By my own testing, these seem to work furthest from the targeting surface. Sign up to join this community. The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered.

What is the focal distance of an optical mouse? Ask Question. Asked 5 years, 2 months ago. Active 4 years, 11 months ago. Viewed times. The contraints are: can't open the gig the wheel is 1. Can anybody help me calculate the correct lenses for this, or point me in the right direction? Trilarion 2 2 silver badges 13 13 bronze badges.

Martin Martin 3 3 bronze badges. Is this what you're looking for? Callibrate by dividing the sum over specific time by such a factor that the result is the same as on the wattometer.This Laser gaming sensor is in pin integrated chip-on-board COB package.

It is designed to be used with ADNS small form factor SFF gaming laser lens to achieve the optimum performance featured in this document. These parts provide a complete and compact navigation system without moving part and laser calibration process is NOT required in the complete mouse form, thus facilitating high volume assembly. The sensor is based on Laser technology, which measures changes in position by optically acquiring sequential surface images frames and mathematically determining the direction and magnitude of movement.

The IAS acquires microscopic surface images via the lens and illumination system.

Optical Mouse Hacks: 2D Micropositioning using cheap mouse cameras

These images are processed by the DSP to determine the direction and distance of motion. Did you use this instructable in your classroom? Add a Teacher Note to share how you incorporated it into your lesson.

Now Connect Your Arduino to Computer. If you are removing LCD please edit code to display distance that sensor has traveled. I'm working on this code now for days but I cant get it to work properly. I want to see my traveled distance in cm in the serial monitor.

Is there anyone who got it all working and wants to share his or her conde with me? Hi Gigi - I'm trying to use this to monitor the speed of movement. At first blush everything seems to be working, but xydat[0] seems to always be -1, 0 or 1 instead of a byte showing the distance moved since the last reading so it's really inaccurate unless you're moving really slowly. Any idea what could be causing this? Reply 5 years ago on Introduction. Hi GIgi, I am having a similar issue.

Is there a way to change the resolution of the ADNS? However, this doesn't appear to solve this issue. Make sure you normalize by the CPI to get the distance. JasonC11, can you please post your code? I applied Gigi's fix, but still no luck. It appeared to change nothing.

Hey JasonC11, can you explain the math you're doing on the xydat[0] and xydat[2] in this line? I see the 2. The comes from the CPI, which is set at line I'm not really sure why I set it tobut you should be able to tweak it for your application. Reply 4 years ago. Hi, just a question, What is mean with the FS value u are using? I get many Data from my sensor and i really try hardly to get the traveled way out of it Thanks for the explanation! Thanks, but I can't get your code to work either.


thoughts on “Using optical mouse to measure distance”

Leave a Reply

Your email address will not be published. Required fields are marked *