2
\$\begingroup\$

How can I interface this sensor with a microcontroller? It has a normally open output and it will work @ 24V. If I feed the BK contact from the sensor to a pin of the microcontroller through a voltage divider, would that be a good design?

\$\endgroup\$
2
  • \$\begingroup\$ Wouldn't the input be floating if it's normally open? \$\endgroup\$ – NickHalden Jul 20 '11 at 14:40
  • 1
    \$\begingroup\$ @JGord - Yes, and that's why you need a pull-down resistor, just like you would need a pull-up for the more common NPN open-collector. \$\endgroup\$ – stevenvh Jul 20 '11 at 14:47
3
\$\begingroup\$

An open collector PNP is a bit uncommon, but nothing to worry about. When the PNP is switched on (the switch in the diagram) V+ is switched to BK, so then the level will be +24V DC. If the transistor is off, BK would be floating (it's an open collector) so you'll have to place a pull-down resistor to ground.
If you place two resistors in series here, you'll have the voltage divider you need to reduce the 24V signal to e.g. 5V. For a 5V microcontroller the top resistor can be 18k\$\Omega\$ and the lower 4.7k\$\Omega\$ (that's the ratio anyway).

If you want isolation between the flow sensor and your microcontroller you'll have to use an optocoupler, like the CNY17. Make one of the resistors a 1k\$\Omega\$, and replace the other one by the optocoupler's LED. It doesn't matter which one goes where, but pay attention to the LED's orientation.
The collector of optocoupler's output transistor goes to your microcontroller, with a 10k\$\Omega\$ pull-up resistor to the microcontroller's power supply. The emitter goes to ground.

\$\endgroup\$
3
  • \$\begingroup\$ Also, how does this gokhanelektrik.com.tr/download/2506100.pdf sensor works? It's slightly different from the above one.. \$\endgroup\$ – m.Alin Jul 20 '11 at 15:10
  • \$\begingroup\$ I updated my answer. \$\endgroup\$ – stevenvh Jul 20 '11 at 15:14
  • 1
    \$\begingroup\$ The other sensor has a change-over contact instead of a normal-open. The resistors drawn are the pull-down resistors you need, like I mentioned in my answer. \$\endgroup\$ – stevenvh Jul 20 '11 at 15:17

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.