Hi, I'm new to electronics, I have an existing system that is reading signal data from an NPN proximity sensor. I'm having difficulty to intercept the signal using Arduino.
The sensor is currently connected to an existing system, cut the sensor cable in the middle, parallel the Brown cable to Arduino's VCC, Blue to Arduino's GND, and Black to Arduino's INPUT_PULLUP. Arduino is turned on but can't read the INPUT_PULLUP signal. The existing system also stopped reading signal data.
JCA34F:
What is the existing system's voltage (brown wire to blue) before connecting the Arduino?
Thanks for the reply.. Existing system's voltage is 15v.
Since you asked I realized I may have wrong understanding of how the NPN sensor works. I checked that when inactive, the black wire output voltage is related to the existing system's voltage, which I guess is well above 5v / Arduino's limit (currently I don't have access to the production system). I think I'm lucky my IOT 33 is still running.
I also noticed that other that INPUT_PULLUP method, I can use analogRead:
/*
TEST CODE FOR PROXIMITY SENSOR
Metal Detection with 3 wire sensor
*/
float metalDetected;
int monitoring;
int metalDetection = 1;
void setup(){
Serial.begin(9600);
}
void loop(){
monitoring = analogRead(metalDetection);
metalDetected = (float) monitoring*100/1024.0;
Serial.print("14CORE METAL DETECTOR TEST");
delay(500);
Serial.print("Initializing Proximity Sensor");
delay(500);
Serial.print("Please wait...");
delay(1000);
Serial.print("Metal is Proximited = ");
Serial.print(metalDetected);
Serial.println("%");
if (monitoring > 250)
Serial.println("Metal is Detected");
delay(1000);
}
I wonder if changing to analogRead will solve the problem. Will try later...
You could use a signal diode to isolate the Arduino from any higher voltages used by the system in question, cathode to Arduino to sensor, anode to Arduino pin. You shouldn't need to affect the sensor's supply voltage.
MarkT:
You could use a signal diode to isolate the Arduino from any higher voltages used by the system in question, cathode to Arduino to sensor, anode to Arduino pin. You shouldn't need to affect the sensor's supply voltage.
I think you mean using a 5v zener diode to limit the voltage?
I'm a bit confused, on a separate thread you said that it is ok not to use limiting diode:
MarkT:
For open-collector NPN output you just connect a pull-up to 5V and the signal to an Arduino pin -
the output can only pull low to ground so no high voltages can get to the Arduino.
If paranoid add a diode inline with the signal to make sure it can only pull down (cathode to
sensor, anode to arduino pin).
You can use internal pull up if you like, its a bit weak for a remotely mounted sensor though.
Try a few k ohms if you have problems with noise.
Regardless, when I parallel the black signal wire to the arduino, will it affect (or get affected) by the reading of the existing system? Attached is my current setup. With an INPUT_PULLUP on Pin D2 both existing system and arduino suddenly stop reading signal. Do you have any suggestion on how to read the signal safely without interrupting the existing system?
What's the type number of that sensor? (no, not going to bother with an unclickable link to a video).
15V to the Vin of the Arduino is of course a terrible idea. Don't do that. Just power the thing off USB or a 5V adapter, just keep the GND connection. If you actually connect the 15V to the Vcc of your Arduino, it's quite certainly done for.
An NPN output doesn't need this diode (which would be a regular diode, not zener, you want to BLOCK the higher voltage). It won't hurt, either.
Wardenoma:
I think you mean using a 5v zener diode to limit the voltage?
Absolute not, I mean exactly what I said. A signal diode isolates the Arduino from the other system's higher voltage by being reverse-biased. When the NPN sensor pulls down, the diode conducts and pulls the Arduino pin down too.
MarkT:
Absolute not, I mean exactly what I said. A signal diode isolates the Arduino from the other system's higher voltage by being reverse-biased. When the NPN sensor pulls down, the diode conducts and pulls the Arduino pin down too.
Got it! Thanks for reconfirming, I didn't know much about diode earlier, but I got the whole thing working now.
wvmarle:
What's the type number of that sensor? (no, not going to bother with an unclickable link to a video).
15V to the Vin of the Arduino is of course a terrible idea. Don't do that. Just power the thing off USB or a 5V adapter, just keep the GND connection. If you actually connect the 15V to the Vcc of your Arduino, it's quite certainly done for.
An NPN output doesn't need this diode (which would be a regular diode, not zener, you want to BLOCK the higher voltage). It won't hurt, either.