0
\$\begingroup\$

I am using this proximity sensor with a raspberry pi. the sensor outputs a 24V signal when triggered, which I need to step down to 3.3V using a voltage divider so as to not blow out the pi. The datasheet shows that I need a pull-up resistor between the output signal and the 24V power, but I'm wondering how this would change the calculations for figuring out the right resistor values to use.

Not considering the pull up resistor, I'd pick 100ohm for R15 and 680ohm for R14 but I'm not sure how to factor in the pull up resistor (would it change the values or R14 and R15?) or how to find the right value for it.

enter image description here

enter image description here

\$\endgroup\$
8
  • \$\begingroup\$ please add a circuit diagram \$\endgroup\$
    – jsotola
    Nov 5 at 17:02
  • 2
    \$\begingroup\$ pull-up resistor between the output signal and the 24V power ... try putting the pullup resistor between the output signal and 3.3 V instead \$\endgroup\$
    – jsotola
    Nov 5 at 17:05
  • 1
    \$\begingroup\$ Looks like open collector NPN or PNP output with a max VCE of 1.0V. What is your part number? \$\endgroup\$
    – vir
    Nov 5 at 17:05
  • \$\begingroup\$ it's the E1-D version for npn, e2-d for pnp \$\endgroup\$
    – JohnC1642
    Nov 5 at 17:07
  • \$\begingroup\$ @LilMamiChula Well which one you have, NPN or PNP? \$\endgroup\$
    – Justme
    Nov 5 at 17:15
0
\$\begingroup\$

So you are using the NPN output version.

You don't have to pull up the output to 24V.

So if the output is really just an NPN open collector output then you don't even need any resistors at all, just enable internal pull-up in software.

EDIT: It seems there are internal pull-ups or the sensor is not NPN type. It is also unclear how much current the device can sink or source. But according to your measurements it might have PNP output.

As the datasheet does not say how it works and how much current it can sink or source, to be on the safe side, the current should be kept below 1mA.

Just calculate a simple divider that divides 24V to 3.3V when 1mA flows through the divider. 1mA at 3.3V is obviously 3.3kohms and 1mA at 20.7V can be rounded to a resistor of 21k or 22k.

\$\endgroup\$
7
  • \$\begingroup\$ the output is 24V with no resistors I need it to be 3.3 for the pi to read \$\endgroup\$
    – JohnC1642
    Nov 5 at 17:22
  • \$\begingroup\$ @LilMamiChula If it has an NPN output then it should not be 24V but either open or grounded. How did you measure it? \$\endgroup\$
    – Justme
    Nov 5 at 17:23
  • \$\begingroup\$ with a multimeter between the output wire and ground \$\endgroup\$
    – JohnC1642
    Nov 5 at 17:24
  • \$\begingroup\$ @LilMamiChula That's unfortunate, the datasheet you linked to does not mention anything about this. Are you sure about the part number? What if you put say 10kohm resistor to ground, what is the output voltage then? Maybe without load there is some leakage via some built-in snubber diode? \$\endgroup\$
    – Justme
    Nov 5 at 17:26
  • 1
    \$\begingroup\$ Assuming you have the PNP version, I would use higher value resistors than the ones in your original post. 780 ohms on 24V is 30mA which is within the datasheet limits but much more than you really need. Just multiply everything by 10 and go with 6k8 over 1k. Since the output is "open circuited" when the sensor is off, the 1k resistor acts as the pull-down. \$\endgroup\$
    – vir
    Nov 5 at 17:45
0
\$\begingroup\$

The proximity switch has an NPN open-collector output.

It's to be wired as show below.

enter image description here

The Raspberry Pi input will normally be high and go low when the proximity switch senses.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.