User avatar
owntheweb
Posts: 24
Joined: Tue Jun 16, 2015 1:51 am
Location: Colorado, USA
Contact: Website

Converting

Fri Jan 12, 2018 3:56 am

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
Worlds to explore. Worlds to create.

User avatar
Jednorozec
Posts: 809
Joined: Sun Nov 24, 2013 2:17 pm
Location: Deposit, NY

Re: Converting

Fri Jan 12, 2018 4:13 am

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.
The most important leg of a three legged stool is the one that's missing.
It's called thinking. Why don't you try it sometime?

Heater
Posts: 13371
Joined: Tue Jul 17, 2012 3:02 pm

Re: Converting

Fri Jan 12, 2018 4:18 am

"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.
Memory in C++ is a leaky abstraction .

User avatar
scruss
Posts: 2489
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Converting

Fri Jan 12, 2018 4:23 am

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.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.

User avatar
owntheweb
Posts: 24
Joined: Tue Jun 16, 2015 1:51 am
Location: Colorado, USA
Contact: Website

Re: Converting

Fri Jan 12, 2018 3:04 pm

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,
Worlds to explore. Worlds to create.

User avatar
owntheweb
Posts: 24
Joined: Tue Jun 16, 2015 1:51 am
Location: Colorado, USA
Contact: Website

Re: Converting

Wed Jan 17, 2018 3:05 pm

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!
Worlds to explore. Worlds to create.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23708
Joined: Sat Jul 30, 2011 7:41 pm

Re: Converting

Wed Jan 17, 2018 3:27 pm

Please continue in the other thread.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

Return to “General discussion”