Distance optical sensor

Hi guys

For a university project i have to programm and design an Arduino based distance sensor for picking up data in a beginner physics experiment involving spring. Basically i have to measure the distance of a metal plate attached to a spring as it goes up and down every set amount of hertz (the capture rate in Hz will be configurable). It this prototype works it will be replicated for each of the 25 workstation of my laboratory, so price is an important factor for the sensor. I was thinking of using a optical sensor but I have no idea of where to start, because this is my first experience with Arduino.

Thanks for the advice!

Try and google these:

HC-SR04

This is a Ultrasonic sensor that measures from2-400 cm. This is a fairly cheap one. Think of any animals near your project though, for ultrasonic sensing in action might spoil their appetite.

and

Sharp GP2Y0A02YK

is a InfraRed sensor that measures from 20-150 cm. because i have objects at 0-20cm in my project, this sensor is not my favourite today. It works very easy though.

the capture rate in Hz will be configurable

What capture rates do you require?

Relign:
Sharp GP2Y0A02YK

is a InfraRed sensor that measures from 20-150 cm. because i have objects at 0-20cm in my project, this sensor is not my favourite today. It works very easy though.

There are more versions of this sensor, such as the GP2Y0A41SK0F for 4-30 cm and the GP2Y0A51SK0F for 2-15 cm. I've been looking at these for a water level project; they seem pretty accurate (I'm looking for 1 mm or better within a 4-5 cm range - it seems the GP2Y0A41SK0F can do this).

No info in the data sheet on how fast it is - as in, how fast a movement it can follow with its output.

Questions for OP:

  1. required sample rate
  2. required distance range (peak/peak of your vibrating plate)
  3. required resolution

Sampling rate for the Sharp distance sensors is given here: https://www.pololu.com/category/79/sharp-distance-sensors

wvmarle:
There are more versions of this sensor, such as the GP2Y0A41SK0F for 4-30 cm and the GP2Y0A51SK0F for 2-15 cm. I've been looking at these for a water level project; they seem pretty accurate (I'm looking for 1 mm or better within a 4-5 cm range - it seems the GP2Y0A41SK0F can do this).

No info in the data sheet on how fast it is - as in, how fast a movement it can follow with its output.

Questions for OP:

  1. required sample rate
  2. required distance range (peak/peak of your vibrating plate)
  3. required resolution

The experiment is very basic (it is meant to be done by first year student) so the sample rate doesn't have to be extreme. Something around the millisecond is ok. As for the range the height of the spring can be adjusted and peak to peak won't exceed 20 cm. In reality I was thinking of letting the students decide for the sample rate and the resolurion, as this experiment is didactic.

Something around the millisecond is ok

You will have great difficulty finding anything that works at that rate. Sonar certainly won't work, but IR sensors might.

If you do find something, let us know about it.

1 ms per sample, that's 1,000 Hz sampling rate. The IR sensors mentioned above do 60 Hz. Ultrasound sensors you may push to 10 Hz or so.

You didn't specify resolution but at 20 cm peak-peak a resolution of 1 mm sounds OK. That's totally doable. Adafruit has some such sensors on offer, check them out - see whether those are suitable.

But if you're moving a metal plate on springs over a distance of 20 cm, what kind of frequency do you really get there? Sounds like a pretty slow moving system.