Author Topic: Very Low Cost Linear Position Sensor  (Read 6936 times)

0 Members and 1 Guest are viewing this topic.

Offline DubbieTopic starter

  • Supporter
  • ****
  • Posts: 1115
  • Country: nz
Very Low Cost Linear Position Sensor
« on: May 13, 2018, 09:17:38 pm »
Hi,

I have a situation where I need a very low cost ($1-2) way to measure the linear position of a drawer type of object.

The amount of movement is about 300mm and I need to detect the position with about 25mm accuracy.
The drawer itself is removable, so it cannot be wired to anything. There are many narrow (50mm) drawers, so a solution that can work without interfering with its neighbor is necessary.

I have looked into many solutions including IR position sensing(large board to hold many IR transceivers too expensive), Sonar (beam too wide, transducers too expensive), Laser rangefinding (actually surprisingly cheap using VL53L0X!)

None of these solutions really hit the pricepoint.

One thing I was wondering about, was is there some way that I could make flexible circuitboards with some sort of coil and measure their offset? Problem is, there may be metal objects inside the plastic drawers.

If anyone has any ideas I'd be interested to hear!

R
 

Offline Gyro

  • Super Contributor
  • ***
  • Posts: 9507
  • Country: gb
Re: Very Low Cost Linear Position Sensor
« Reply #1 on: May 13, 2018, 09:48:55 pm »
A bell crank and an ordinary rotary pot?
Best Regards, Chris
 

Offline branadic

  • Super Contributor
  • ***
  • Posts: 2390
  • Country: de
  • Sounds like noise
Re: Very Low Cost Linear Position Sensor
« Reply #2 on: May 13, 2018, 09:55:41 pm »
Only a few ideas:
- a simple differential, capacitive sensor based on electrodes on a printed ciruit board
- a printed circuit board based LVDT
- optical sensor based on the CCD of an old scanner
- a simple linear potentiometer
- transfer linear movement into a rotation and use a rotary encoder
- use a cheap caliper
- make yourself a linear optical encoder with some black/wite stripes on a paper and a light barrier

-branadic-
Computers exist to solve problems that we wouldn't have without them. AI exists to answer questions, we wouldn't ask without it.
 

Offline DubbieTopic starter

  • Supporter
  • ****
  • Posts: 1115
  • Country: nz
Re: Very Low Cost Linear Position Sensor
« Reply #3 on: May 13, 2018, 10:05:34 pm »
Thanks for the ideas branadic and gyro

- a simple differential, capacitive sensor based on electrodes on a printed ciruit board
This is something I'm interested in. Not 100% how this works.

- a printed circuit board based LVDT
Also interested in this. Again, not 100% on how this would work practically

- optical sensor based on the CCD of an old scanner
I need thousands of these. Surplus is not an option.

- a simple linear potentiometer
None I've found come remotely close to my pricepoint.

- transfer linear movement into a rotation and use a rotary encoder
Too expensive and difficult to design around a removable drawer.

- use a cheap caliper
Got any links for 50c calipers?

- make yourself a linear optical encoder with some black/wite stripes on a paper and a light barrier
This is something I have considered. Some sort of gray code on a sticker and a row of IR TXRX This is probably my leading solution at the moment.
 

Offline sokoloff

  • Super Contributor
  • ***
  • Posts: 1799
  • Country: us
Re: Very Low Cost Linear Position Sensor
« Reply #4 on: May 13, 2018, 10:22:53 pm »
Outside the box: could you treat it as a computer vision problem and sense all the drawers at once using a webcam and Raspberry Pi (or similar price and performance computer)?

Then, you might be able to arrange a target of known size and high contrast on the back of drawers and sense position and size of each target found. Computer vision has come a long, long way in the last couple years.
 

Offline DubbieTopic starter

  • Supporter
  • ****
  • Posts: 1115
  • Country: nz
Re: Very Low Cost Linear Position Sensor
« Reply #5 on: May 13, 2018, 10:48:50 pm »
Good idea sokoloff, One I had considered before.

Unfortunately the physical construction of the cabinet precludes seeing the drawers all at once.
 

Offline Conrad Hoffman

  • Super Contributor
  • ***
  • Posts: 1931
  • Country: us
    • The Messy Basement
Re: Very Low Cost Linear Position Sensor
« Reply #6 on: May 14, 2018, 12:15:11 am »
Can you do anything to the drawers? I'm thinking paint the back sides some consistent light color, or put a sticker on them. Then do a photo detector based on nothing more than return signal. There was the old Polaroid sonic distance sensor, and you can buy the necessary transducers, but I think cost might be an issue. It can be done with a single transducer too, basically sonar. Ping it and look for the reflection. If you have access to the sides or bottom, convert the long motion to something short with a wedge, then sense that with any number of things, maybe an optointerruptor, a cam follower on a pot, an inductive sensor (needs a metal wedge) or even capacitance. For any of the optical methods, modulate it and use IR so ambient light doesn't interfere.
 

Offline DubbieTopic starter

  • Supporter
  • ****
  • Posts: 1115
  • Country: nz
Re: Very Low Cost Linear Position Sensor
« Reply #7 on: May 14, 2018, 01:35:48 am »
Yes, I can put a sticker on the bottom of the drawer.

I'm thinking of using 5bit grey code and a row of 5 IR phototransistors. I think I may be able to use probably two IR LEDs for illumination so long as the receivers are shielded somehow.

This board could run from one side of the cabinet to the other but only be 10mm wide so would be relatively cheap. The challange will be driving and reading all the diodes for under the budget. I'm thinking sharing a single $2 uC between 10 drawers and doing all the driving and reading on that. I could use some sort of serial to report to the main controller all the positions.
Something like the STM32F058R8H6 would do.
 

Offline Conrad Hoffman

  • Super Contributor
  • ***
  • Posts: 1931
  • Country: us
    • The Messy Basement
Re: Very Low Cost Linear Position Sensor
« Reply #8 on: May 14, 2018, 02:29:10 am »
That should work. You can usually find flat phototransistors molded in black IR transmitting plastic. Just don't design it for 5 bits and later discover they wanted it just a tiny bit better. It happens every time.
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14206
  • Country: de
Re: Very Low Cost Linear Position Sensor
« Reply #9 on: May 14, 2018, 04:28:59 pm »
300 mm with 25 mm resolution is just 12 positions. This might work with a simple analog intensity coding after a learning / adjustment (e.g. with drawers all the way in). So on could get away with a single graded gray reflector.

The capacitive sensing is also still an option. Some µC (e.g. some PICs) have hardware for detecting capacitive keys or similar sensors. There are several options to make the drawer to change a capacitance in the 10-50 pF range, or cross capacitance in the 1-10 pF range.
 

Online 2N3055

  • Super Contributor
  • ***
  • Posts: 6662
  • Country: hr
Re: Very Low Cost Linear Position Sensor
« Reply #10 on: May 14, 2018, 04:50:13 pm »
Photointerrupter or reflective sensor and linear gray code line (reflective or transparent or comb one). It can be absolute encoder.
Also begin and end sensor and relative encoder. You can use encoders used for wheeled mice....
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Very Low Cost Linear Position Sensor
« Reply #11 on: May 14, 2018, 05:06:54 pm »
I like the capacitive sensor idea. Essentially you attach one plate to the drawer and the other plate near it. The further the thing is opened, the less the plates overlap and the lower the capacitance. Think of it as an old style variable capacitor as used to tune a radio but stretched out into a line.
 

Offline DubbieTopic starter

  • Supporter
  • ****
  • Posts: 1115
  • Country: nz
Re: Very Low Cost Linear Position Sensor
« Reply #12 on: May 14, 2018, 09:32:02 pm »
I'm going to play around a bit with the STM32 touch functionality.

Thanks to everyone for their contributions.

R
 

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9018
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Very Low Cost Linear Position Sensor
« Reply #13 on: May 15, 2018, 03:15:28 am »
Read a little about how digital calipers work and then design an easy to DIY, less precise version?
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3360
  • Country: nl
Re: Very Low Cost Linear Position Sensor
« Reply #14 on: May 21, 2018, 08:07:09 am »
I would also start experimenting with a capacitive sensor.
If you want the drawer to be "removable" I assume this means you do not want wires connected to it.

You can glue a big piece of aluminimum foil in the bottom or side of the drawer.
Then use two wide conductive strips for your "electrodes".
One couples the signal into the alu foil, the other coples the signal from the alu foil back into your "electrode".

Then measure the capacitance of these 2 capacitors in series.

Note: The capacitance will also depend a lot on the distance between the electrodes, not only on the "overlap".
Therefore the bottom is better suited than the side of the drawer, gravity will take up your slop.

Alternatively, you can use a row of short sensor electrodes on one side.
Then the capacitance of each of these sensors will increase if the drawer is closed.
This is becoming a bit similar to how capacitively coupled callipers work.

What kind of reliability are you looking for?
You could use some push pins and something that rubs over it to make a row of mechanical switches.

« Last Edit: May 21, 2018, 02:05:40 pm by Doctorandus_P »
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6264
  • Country: fi
    • My home page and email address
Re: Very Low Cost Linear Position Sensor
« Reply #15 on: May 21, 2018, 06:06:10 pm »
a linear optical encoder with some black/wite stripes on a paper and a light barrier
If you used four channels, with 0000/1111 reserved for "completely outside", you'd have 15 positions for 300 mm, or 20mm per position. If you used US Letter printable sticker paper, with about 10mm margins, you have 260mm of printable length, so 18mm per position, or about ±9mm accuracy.

Perhaps you could use a common sample/latch signal, and each set of IR/optical sensors tied to a shift register, so you'd simply trigger the common sample/latch to latche all optical sensors, then shift them one bit at a time? You'd need just three data lines (two outputs: sample/latch, and clock; and one input, data), one latching parallel to serial shift register and up to eight optical sensors per drawer. Maybe 74HC165 series? The optical sensors seem to be the most expensive part. Might have to do your own using a LED and fototransistors?

If you do the drawers in pairs, with 15 positions (with 0000 or 1111 reserved for "out", depending on which pattern you get when there is no strip detected at all), you could use a single 8-bit shift register per pair of drawers, and halve the number of cycles needed to shift all the bits to the microcontroller.

At 500 kHz clock rate (I have no idea whether that is realistic!) you could then read 62500 drawers per second.  Something like a Teensy 3.2 which has 64k of RAM, could remember the positions of each drawer, and only provide the changes to the consumer (and all states if requested, or at specific intervals, like once every few seconds).

This would be what I'd try, with no guarantees of it working.
 

Offline DubbieTopic starter

  • Supporter
  • ****
  • Posts: 1115
  • Country: nz
Re: Very Low Cost Linear Position Sensor
« Reply #16 on: May 21, 2018, 07:11:30 pm »
Good idea regarding the shift register!
I will try that. I have had good success using a phototransistor with led illumination for the reading. Because the channels are adjacent, it’s easy to find the 1/0 levels as long as there is at least one zero or one.
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3785
  • Country: de
Re: Very Low Cost Linear Position Sensor
« Reply #17 on: May 21, 2018, 07:20:06 pm »
Guys, don't over-complicate things.

Just pick one of these:
http://www.st.com/en/imaging-and-photonics-solutions/vl53l0x.html

Or a simple ultrasonic ranger - modules can be had for a buck or two in the usual places,
e.g.:
https://www.aliexpress.com/item/US-015-Ultrasonic-Module-Distance-Measuring-Transducer-Sensor-Detector-Ranging-Module-DC/32811614766.html

If the accuracy needed is only 25mm, then these would be even an overkill - but the advantage is robustness, it is simple to interface (serial output) and being contact-less/wireless (no need to install anything on the moving part).

« Last Edit: May 21, 2018, 07:27:52 pm by janoc »
 

Offline JohnnyMalaria

  • Super Contributor
  • ***
  • Posts: 1154
  • Country: us
    • Enlighten Scientific LLC
Re: Very Low Cost Linear Position Sensor
« Reply #18 on: May 21, 2018, 07:28:19 pm »
Tapered reflective strip down the side of the drawer and an LED and photodiode at a fixed position on the cabinet. The output from the photodiode will be proportional to the width of the strip and, hence, position. (I designed an optical guitar pick-up with separate sensors for each string using this concept. It was stupidly cheap.)
 

Offline metrologist

  • Super Contributor
  • ***
  • Posts: 2213
  • Country: 00
Re: Very Low Cost Linear Position Sensor
« Reply #19 on: May 21, 2018, 07:30:48 pm »
I got an easy solution, unless I missed a requirement... It even has redundancy  :-+

 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6722
  • Country: nl
Re: Very Low Cost Linear Position Sensor
« Reply #20 on: May 21, 2018, 08:13:54 pm »
I doubt you will be able to beat reflective gray code sensing for ease of engineering and cost.

That said, the main problem with sonar seems to me the width of the beam ... piezo discs cost next to nothing. I wonder if you could make some kind of passive backscatter modulator. That way the sender wouldn't be listening for a reflection (which could come from the sides) but for the modulated response from something attached to the drawer.
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3785
  • Country: de
Re: Very Low Cost Linear Position Sensor
« Reply #21 on: May 21, 2018, 08:17:09 pm »
I doubt you will be able to beat reflective gray code sensing for ease of engineering and cost.

That said, the main problem with sonar seems to me the width of the beam ... piezo discs cost next to nothing. I wonder if you could make some kind of passive backscatter modulator. That way the sender wouldn't be listening for a reflection (which could come from the sides) but for the modulated response from something attached to the drawer.

The width of the beam of these cheap sensors is about 15-30 degrees. If you mount in the middle, there is little chance for it to get confused by another echo.
 

Offline DubbieTopic starter

  • Supporter
  • ****
  • Posts: 1115
  • Country: nz
Re: Very Low Cost Linear Position Sensor
« Reply #22 on: May 21, 2018, 09:03:24 pm »
thats an intriguing idea regarding the backscatter modulation. although I worry that if you have one drawer at say 30% position, and the other at 100% open, the closer one (they are only 50mm wide remember) will overwhelm the far one. The drawers are made of plastic.
 

Offline janoc

  • Super Contributor
  • ***
  • Posts: 3785
  • Country: de
Re: Very Low Cost Linear Position Sensor
« Reply #23 on: May 21, 2018, 09:22:23 pm »
Well, why don't you buy one of those sensors and test it? They cost next to nothing so even if it doesn't work, you didn't waste money.

The optical time of flight sensor from ST I have linked would work for sure, with no interference. There are breakouts for it available on AliExpress and elsewhere too if you don't want to make your own board (it is a PITA to solder).
 

Offline DubbieTopic starter

  • Supporter
  • ****
  • Posts: 1115
  • Country: nz
Re: Very Low Cost Linear Position Sensor
« Reply #24 on: May 21, 2018, 09:45:25 pm »
I will buy one.

I bought the laser sensor from ST to test.
It's a bit fiddly to set up but it works fine. It's just a bit more expensive than I would like.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf