hi guys!
i am trying to make a counter which counts pulse produced by op of a inductive proximity sensor.
(as will be apparent in the code the proximity sensor normally ops 24v and when close to an object 0v.)
now though the counter is working fine the working of m/c dependent on this particular proximity sensor op stops working.
this is because the proximity sensor that normally used to op 24v is now op 10v only.
when i disconnect it from digital pin of my arduino it goes back to 24v.
also i am using a 5v zener with a 2.2K current limiting resistor to convert op of the proximity sensor to 0-5v so that it can be fed to digital pin of arduino.
is there any way that the op of the proximity sensor can be maintained at 24v while also connected to arduino?
thanks in advance.
int sensePin=2;
int count=0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode (sensePin, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(sensePin)==LOW)
{
count++;
delay(1000);
}
Serial.println(count);
}
Is this a different sensor? Do you have a part# or link?
Have you checked the adjustment of the sensing distance?
You've described operationally an NPN type sensor, so it would be normal that the signal only outputs 10V when connected to the Arduino, because internally there would be a pullup resistor to 24V. Then when you connect your 2.2K and 5V zener, it pulls this down to 10V on the sensor side and is clamped to 5V at the Arduino input. Will wait for more details...
GolamMostafa:
As suggested by @UKHeliBob in Post-1, you may try the following opto-isolation arrangement.
@ GolamMostafa shouldnt R1 be a bit on the higher side? according to my calculations it comes to around 1K (assuming Vf=1.2v).
I=(24-1.2)/1000~22.8mA which is well below max rated current of 30mA.
anyway thanks a lot for your reply with illustration...as always delightful!
marrc:
@ GolamMostafa shouldnt R1 be a bit on the higher side? according to my calculations it comes to around 1K (assuming Vf=1.2v).
I=(24-1.2)/1000~22.8mA which is well below max rated current of 30mA.
anyway thanks a lot for your reply with illustration...as always delightful!
As per data sheets of PS2501, the forward bias current for the input diode of the opto-coupler is 80 mA. I have assumed the cut-in voltage for the diode 0.7V. Accordingly, the current limiting resistor becomes: 24-0.7/80 mA = 290 ohm ----> 330 ohm.
If diode cut-in voltage is taken as 1.2V as you have said, then the value of the resistor stands as: 24 - 1.2/80 mA = 285 hm ----> 330 ohm.
Hi guys!
I have tried the schematic above( ckt) but the voltage across the proximity sensor falls to 6.6v. with zener it was falling to 10v.
The only change i made to schematic was used R1=1K as in some datasheets on the net i found diode If=30mA. so just to be on the safe side. rest everything same. the part no on my optocoupler is NEC 2501LK646. I have checked its diode shows continuity when anode is connected to positive lead of multimeter and cathode to -ve lead and open on reverse. so no doubt about that.
i also tried connecting a voltage source of 21v to optocouplers ip and it fell to 16.6v. shouldn't it remain at 21v? isnt that the purpose of an optocoupler to provide isolation?
i am confused.
any ips will be appreciated.
As I mentioned earlier, operationally, you're describing an NPN type inductive proximity sensor. That is, the output voltage decreases when a ferrous metal object comes close to the sensor.
The internal circuit of NPN type might look like this (except it may have an internal pullup resistor), so the load wouldn't connect to ground, it connects to the positive supply voltage and the other end gets switched to ground...
Really, it would be awesome to know the part number of your sensor as there are thousands to choose from. Then it would be easy to figure out proper connections.
Post the brand name and model number of the prox switch and / or a link to the seller's web page or the datasheet for the switch.
Which Arduino are you using? What is the prox switch supply voltage?