Connecting an Optical Speed Sensor with Pulse Output to Arduino Mega

Hi,

I am planning to connect an NPN optical speed sensor(link and info below) to an Arduino Mega to measure RPM data from a motor spinning at 24,000RPM. The optical speed sensor has the following key characteristics:

VLS5/T Optical Speed Sensor: VLS Optical Speed Sensors with an NPN Pulsed Output. Visible or Laser Light Sources Available. (omniinstruments.co.uk)

Optical Range: 50 - 1000mm, up to 250,000rpm.
Power Supply 5vDC.
NPN Pulse Output - 1.5m 4-core cable.
Power Requirements VLS5/versions = 120mA@ 5vdc

Based on this I have the following queries:

  • As this is a 4-core cable -> The required ports to Arduino would be Ground, Power(5V), Common (also to Ground) and Data Output (Analog). Will a pull-up Resistor be required to the Analog Pin, and how is the value of this resistor determined?
  • The Arduino provides a maximum of 40mA to each Pin, but the power requirement of the Sensor is 120mA, is this an issue? What would be a possible work around?
  • Is there a resource that explains how to read NPN pulse outputs using an Arduino?

Would appreciate guidance regarding the above, or any feedback. Cheers.

A separate, suitably sized, power supply dedicated to the sensor. Don't forget to connect the grounds between sensor and Arduino.

image

Are analog and NPN outputs mutually exclusive?

What is this?
image

Cheers, I'll obtain an external power supply, and wire as suggested.

I might have been initially incorrect, NPN pulse outputs should logically be digital, hence the digital pin should be used. Would like to know if there is resource to learn about this?

Appreciate your guidance.

I came across this, and ended up in a bit of a conflict, as the website specifies a 5V Power Supply for this sensor, but the Datasheet mentions an Ext. Power input, as shown in the image.

I believe the highlighted specifications (as in the image) would be the right ones to follow, given the current(mA) requirements for the sensor.

Appreciate your input.

There does seem to be a discrepancy
I have no idea which is right.
Also if it is an NPN output you probably need a pullup resistor connected between the output and 5V.
No good info in the datasheet

Indeed, the datasheet lacks complete information. For my knowledge, how is the value of the pull-up resistor decided? Appreciate your responses.

If the data sheet stated the maximum sinking current for the output you would select a resistor so that the max current was not exceeded. However since we don't know the max, we make a guess and see if it works.

I think that the safest thing to try, would be to power the device with 5V and connect a 10K resistor between the output and 5V and see if it works.

That helps.

Would like to confirm the wiring set-up, based on how I've interpreted your comments:

Would this be accurate?

I can't comment because I don't see anything in the datasheet about connections.
How do you know which wire is which?
Is common the same as GND/shield?

I'm basing this off the current optical speed sensor I have, which is a 4-wire sensor with a (Power, Signal, GND and Common(used as GND)). The website specification for the VLS5/T Optical Speed Sensor also mentions a 4-wire connection. Hence I believe the connections should be similar.

My main goal was to confirm whether I am understanding this part of your comment accurately:

"I think that the safest thing to try, would be to power the device with 5V and connect a 10K resistor between the output and 5V and see if it works."

Have I represented those connections correctly?

Yes you have them correct but I would disconnect the GND/Shield from the Arduino and see if it works. If it does work OK then connect the shield to ground and see if it still works OK

Many thanks, I'll try this out.

let us know if it works

Hi,

Wasn't able to procure the optical sensor mentioned. However, managed to procure a similar one: Remote Optical Laser Sensor ROLS24-W. Datasheet available at this link: Remote Optical Laser Sensor with 8 ft. Cable - Monarch Instrument

Wiring connection specified on the data-sheet as:
Brown -- Positive Power Supply 24 V dc ±10%
Blue -- Common Com
Black -- Signal (+ V to 0 V dc pulse) Sig
Shield -- Housing Ground Gnd

Key DataSheet Parameters:

The Sensor was wired up using an external power supply and using prior comments/guidelines as follows:

I used the following code to determine the pulse inputs initially to test the set-up ( the aim is to obtain RPM readings):

int pin = 6;
unsigned long duration;

void setup() {
  Serial.begin(9600);
  pinMode(pin, INPUT);
}

void loop() {
  duration = pulseIn(pin, HIGH);
  Serial.println(duration);
}

However, with this I obtain random readings on the serial monitor (when the sensor is directly aimed at the reflective tape for the whole duration), which look like the following:
[0 0 0 0 0 0 20 34 55 0 0 0 90 200 430 0 0 55 65 91 0....]

I believe both my set-up and code have a fault. Would appreciate guidance on this.

It's a good thing you connected it wrong because you may have fried your Arduino.
According to the datasheet the SIG voltage can be as high as 20V and that will certainly burn out any Arduino
Do not connect SIG directly to the Arduino

Cheers for pointing that out. Overlooked the "Voltage minus ~5 V" line in the datasheet.

Any possible workaround to this? Would a voltage divider have to be implemented?

Have any transistors handy?

Yep, have those available..

What are the part numbers?