While working on his masters degree in controls and robotics, Hack-A-Day reader [Kenn Sebesta] developed a cheap method for digitally reading analog gauges. This method was necessitated by needing to take over 3000 measurements using a dial indicator during his thesis work. The system is implemented in Matlab and uses a webcam to take a picture of the gauge. Once picture is taken it goes through several steps: First, it is reduced to a single color. Then, edge extraction is used to find the lines. Next, the lines are thickened. Finally, the Hough transform is applied to find the longest line: the needle. All that is left to do is measure the arc back to the zero point and match it to your scale. Using this method Kenn’s laptop can take 4 measurements per second.
interesting… well played lol
Nice hack, but there are digital dial indicators available for under $30, sometimes under $20 on sale. This one also has a port to connect it to your computer.
http://www.harborfreight.com/cpi/ctaf/displayitem.taf?Itemnumber=93294
It seems to me like you can do some really intersting things in matlab, i’ve never tried it.
The student version is $100, which is reasonable. Does anybody have any comments on matlab and its usefulness?
Matlab is a fantastic program. I use it a lot at school (working toward mechanical engineering). I would recommend it strongly. After playing around with it you will find that it is very useful for things you hadn’t even considered before. However, the learning curve is pretty steep so be prepared for that.
“Nice hack, but there are digital dial indicators available for under $30, sometimes under $20 on sale.”
Hey, thanks for the find! I’ll have to look into buying one of these. However, I still think the matlab script can be really useful as A) only Americans have a harbor freight right next door, god bless its souless corprate soul, and B) once you start dealing with specialty equipement such as 10cm dial indicators, you don’t want to have to dish out hundreds of dollars again.
Even better, you can use this to measure any kind of dial gage whatsoever. Need a cheap telemetry system for your car on SCCA weekends? Webcam!
Just want to second matlab’s usefulness. If you’re familiar with programming in general the learning curve isn’t that bad, and it’s benefit is how quickly way complex mathematical analysis can be scripted (for example, fouier transforms and laplace transforms are included method) (it doesn’t generate “efficient” code though, no biggie)
also, we did this digital reading project as undergrads at UC Riverside , cool.
GNU Octave (http://www.octave.org) is a Free Matlab work-alike.
By itself, it doesn’t have all the libraries that Matlab comes with, so get octave-forge (http://octave.sf.net) which has many useful libraries.
I used Octave for my thesis work. It works well.
talk about analog to digital conversion!
That’s nice if you have to integrate a computer with some legacy analogue system.
Uh…how is “one color” both red and yellow?
“Uh…how is “one color” both red and yellow?’
There’s only one color there, what you’re seeing at is just a false-color image. With matlab, you can set the colormap to be use number of ranges, for instance colormap(gray) will show increasing values as lighter shades of gray, whereas colormap(jet) will show low values as blue and high values as red. So this was probably colormap(hot), which shows things on a reddish-yellowish scale.
This functionality is also in the IMAQ Vision Toolkit for LabVIEW (maybe CVI, too) from National Instruments. It’s pretty automatic. Unfortunately, it’s very not free.
That’s redic. There’s clearly an area in the example image where there is a ring of black that only the needle passes through, all that needed to be done was to find the bright pixels in this ring…no “longest line” “thickening” “edged extraction” were needed, unless it is just to show off for the prof.
He said he gets 99% acuracy by reading the gague just like it is now. My thought is that if you used an opaque tape and made a disk that would cover the innermost graduated scale and the short needle, then a second ring to cover the outermost scale it might reduce the number of errors?
You would then only have one set of lines to measure and they would always be those of the main needle.
Just a thought {:?D
“That’s redic…”
While that might be true for this one image, remember that you’re looking at about the best image I had. Many others are *not* so clear, and with a reflection in the glass, you could quite easily have another area of “mass”, which would give you a false positive.
In fact, a better, more robust algorithm would incorporate your idea, using a barycenter to double check the accuracy of the hough transformation. I didn’t incorporate it out of sheer laziness on my part. The hough transformation is exactly one line in matlab. What you propose is much more complicated, believe it or not.
What’s surprising about computer vision is that it’s incredibly hard for the computer to do what we do so naturallly. A slight shift in light can totally cripple your image analysis program. feel free to improve upon the program and send me your comments.
I have to say it would have been much easier to just purchase an LVDT instead of using a dial indicator “connected” to the computer.
“if you used an opaque tape and made a disk that would cover the innermost graduated scale and the short needle, then a second ring to cover the outermost scale it might reduce the number of errors?”
And a good thought it was! in fact, I did almost exactly this for another experiment, when the face wasn’t quite so big, the light wasn’t quite so good, and the background was green instead of white. We just took the lens off, painted the background white, and put everything back together. Helped out enormously.
Maybe I’m missing something – wouldnt it’ve been simpler to use a DTI with a Red needle, and chroma-extract it, then apply its angle using sin to a fixed profile of the dial?
Not to be picky! I love overcomplicating hacks too!
Analogue gaugue and LCD/LED digit reading is definitely something there should be dirt cheap rf devices for. But I suppose there are a lot of things there should be dirt cheap devices for :-)