Author Options:

<5mm distance sensing, <100micron accuracy, GUI, RasPi or Arduino? Answered

Hi there,

I am trying to keep my hardware/ coding skills alive and spruce up my bicycle wheel truing stand. I need to figure out the required hardware + software for the following:

I want to build a non-contact distance measurement sensor system and get the output "into" my computer for display in a graphical user interface. I know I could omit the latter step with going directly onto a mini-LCD screen, but trying to use this a learn-another-programming-language learning experience (I've coded Matlab galore, pondering Python for this project).

General system components:
Sensor - [something - RasPi or Arduino I guess] - laptop (running debian) - GUI displaying continuous sensor reading

I've web-searched the hell out of this, but not finding anything quite answering my questions. I want to continuously measure the distance from the sensor to a bicycle wheel rim braking surface. Material is aluminium, shiny, though not smooth. Biggest problem with the web-search is being swamped by proximity sensor results (on/off) rather than a distance proportional output signal and much lower resolution projects. I rule out IR or optical sensing, now stuck between ultrasonic and inductive sensing, though tending to the latter for a faster response/adjustment to change time.

Sensor criteria (other than reasonable $$):
- total sensing range: ca.5mm
- sensing accuracy 10 to 100micron/ 0.01 to 0.1mm - don't ask if that's needed, a bit of overkill, I know, but a bit of OCD doesn't do any harm, eh?
- fast-ish sampling rate (so that when I turn the wheel, the number on the screen updates nice and fast, guess >25Hz is sufficient).

[Something - RasPi or Arduino]:
I know that I could omit the laptop GUI part (mini-LCD, LED array, etc), but keen to learn/ practice a little Python with this project, so I guess I am tending to the RasPi, but I am open minded. All I want is the analogue sensor out to end up as a digital reading "inside" my computer to be passed to my GUI as a reading. Essentially a mini A2D converter. Not fussed whether the output is in actual distance units or in arbitrary units/ current units (I guess the sensors put out a proportional current signal?).

Depending on the above, how do I best get the signal "into" a Python program? A moderate fast sample rate >25Hz should suffice. 

Any help with this would be greatly appreciated!



With the accuracy and precision you want, I think you want to build something like a digital micrometer or caliper. Truing a bike wheel is an art so I don't think you would really need something to have micron tolerance. Other than using laser sensors or feeler pins/rollers on mechanical sensors to gauge when the rim breaks the plane, you might need a very sophisticated or complex sensor arrangement to do noncontact determination. The Raspberry Pi would be a good choice to use if you want to use Python and interface it with the real world. Good luck.

Hi there,

thanks for the input. I've built a few wheels, so I am aware that a fancy system isn't a necessity. As I said, thinking of this more as a training exercise for myself.

Re measurement: I have a normal mechanical dial gauge that is sensitive down to 10micron, but the spring in it is strong enough to lob the wheel side-ways = senor affecting measurement = no good. I am certain that there are both inductive and ultrasonic sensors that can measure down to the 10s of microns with a reasonable sampling frequency, just need some help finding which one that is.

Tending to the RasPi for Python-reasons as you mention.


did you have any luck finding a sensor for this? I'd like to get ~10um distances measure with an ir laser or similar and have only found this at a reasonable price (http://www.robotshop.com/en/sharp-gp2y0a21yk0f-ir-range-sensor.html)

Problem is accuracy and feasability.
Sensors for this type of accuracy exist but at a very high price.


Downside is that the more accuracy you need the shorter the distance needs to be.
For example measuring a change of 10µm if a measuring distance of 4 or 5mm is required will be next to impossible.
In this region physical measurements are usually the way to go.
The actual gauges can still be digital though.
Gauges like this can be used for all sorts of things, I used them to get my arrows straight....


I know that this probably wouldn't help but why not just go to a highly experienced bicycle shop? theyll be perfect with out needing those sensors...

If there is no need to measure the problems on the wheel, maybe a laser is easier?

If the laser is directed at a slight angle on the rim the reflection going out will show nicely any problems.

Pice of white paper with markers behind the wheel and without any fancy and expesinve equippment you can see if the wheel is straight....

In general, you aren't interested in absolute position, only that the wheel is wobbling ??

Have a read here:


Finding a suitable sensor might not be easy unless you can settle for something that operates at short distances.

Getting an accurate output as you require with a sensor distance of more than 1 or 2mm will be hard.

If extreme precision is needed, this one might be your choice:


I am sure there others out there, even laser based with good accuracy, it is just a matter of reading product specifications.

You can also get bare sensors (sensor on a chip) for cheap prices that require you to provide a suitable enclosure if needed and to program something to feed and read the sensor.

Cheers for those links!

1-2mm would be fine. I know that aluminium scales quoted working distance down to 40%.

What I've found hard to find is a sensor with a distance-proportional output rather than a on/off high/low, i.e. a proximity sensor.

Taking the first one from the Balluff sight you sent:


Do I read specs correctly that the output current is proportional to the sensed distance?

Looking over that entire list - there is options for voltage signal change and current signal change - which one is "easier" to get digitised via a Pi or Arduino an "into" a Python program?

Makes no real difference if it has voltage or current output.

For the current output you just add a shunt bridge of suitable size and measure the voltage drop along it.

I would prefer the ones with a voltage output as you use the signal directly which means less chance of error.