Page 1 of 1

Converting

Posted: Fri Jan 12, 2018 3:56 am
by owntheweb
Hello gurus,
I purchased a refurbished coin hopper that sends out a sensor signal when a coin is ejected. For a Pi though, the signal is bit strong:
open collector NPN - active low, maximum sink of 25mA at 35Volt maximum.

I'm thinking the 35Volt max will be lower as I'm using a 12VDC input instead of 24VDC to power the hopper (it offers both options).

I found that I may need a voltage divider. If that is indeed the case, I'm having a difficult time visualizing the diagram as plugged in wires (I know, and it's late). I'm also unsure of what strength of resistors I will need for this.

Do you have an idea of how I would get that signal down to 3.3V, 13mAish(?) so not to blow up my Pi?

Thanks for taking a look! :D

Re: Converting

Posted: Fri Jan 12, 2018 4:13 am
by Jednorozec
If the output is open collector then you can use any voltage that you want there. Just connect one end of a resistor to 3.3V on the RPi and the junction of the resistor and collector to a GPIO pin. 1K might be a good value.

Re: Converting

Posted: Fri Jan 12, 2018 4:18 am
by Heater
"open collector NPN" Means that it is not driving any voltage out.

Rather there is an NPN transistor whose collector is connected to the output. It's emitter is connected to ground and it's base is driven by the internal output signal.

The result of this is that when the internal output signal high the transistor is switched on and the collector is effectively connected to ground. That is the output that you see is connected to ground. A current, of up to 35ma can now flow into the output of the device. The 35ma limit is so as not to blow that output transistor.

When the internal signal is low the transistor is switched off. The output that you see is now not connected to anything, No current can flow into the output of the device. In the condition a voltage of up to 35v can be applied to the input, no current will flow in, above that the output transistor blows.

35v is an absolute maximum. This device is probably deigned to work on 25v.

All that is far more complicated to explain that it is! Have a google for "open collector output" for better explanations and pictures. For example:
http://www.learningaboutelectronics.com ... output.php

I'm sure you can find many others.

Personally I would put an opto isolator on that output. The LED of the opto-isolator being frvn by 5v. You will find circuits and explanations for doing that on google as well.

Re: Converting

Posted: Fri Jan 12, 2018 4:23 am
by scruss
It's an open collector output, so that's the maximum voltage/current it can sink. It's not the voltage you see across it. So you don't need any level conversion.

If you connect it to a GPIO pin with the internal pull-up resistor enabled, the port will read normally HIGH, dropping to LOW when a coin is counted.

Re: Converting

Posted: Fri Jan 12, 2018 3:04 pm
by owntheweb
Hey everyone,
Thanks for the speedy feedback, especially since I posted such a vague post title (it was late).

I'm going to attempt with the internal pull-up resistor enabled. As my current nodejs module I'm using doesn't support setting the pin in this way, I'll start with GPIO pin 3 as it has one hard-wired in.

Kind regards,

Re: Converting

Posted: Wed Jan 17, 2018 3:05 pm
by owntheweb
The plot thickens. See this post as I ponder connecting to the IR sensor directly (not sure how good of an idea this is yet). I'm getting reading, but it's not detecting all coins passing through, maybe less than half. Brainstorming on the next best steps!

Re: Converting

Posted: Wed Jan 17, 2018 3:27 pm
by jamesh
Please continue in the other thread.