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:
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.
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?
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.
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
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.
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."
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
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
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