Main > Main Forum
12 volt coin counter with I-Pac/4
clhug:
Okay, thanks for the info. Let me make sure I get this right on figuring the resistor I need.
According the package the resistor came in, H_FE is listed as 100 (min.).
I'm going through 1 transistor and 1 diode, so voltage drop would be about 1.4 V, leaving me with about 3.6 V.
So I take the required counter current and divide by 100, right? Let's call that result X. (I have no idea if there's a technical representation for this.)
Then I take the 3.6 V and divide that by X to get the resistor size?
The only question I have then is, how do I know how much current is required to fire the counter? Or is that the 12 volts divided by the 129 ohms of the counter coil? That would give me 93 mA.
So then I divide the 93 mA by 100 to give me .93 mA (maybe round off to 1 mA)?
And 3.6 V divided by 1 mA is 3.6 KOhms? So maybe I want to use a 3.0 KOhm resistor to have a bit of headroom to ensure the base of the transistor triggers?
So, and I correct that the current required to fire the counter is the 12V / 129 ohm coil resistance, and then do I have the rest of the math correct?
Also, would it hurt anything to use an even smaller resistor allowing higher current? What if I just use a 100 ohm resistor which would allow about 36 mA? Will that cause any harm?
One last thing. Again, to prevent the 12 V from hitting the I-Pac inputs, what about putting a 2nd set of diodes directly on the inputs to prevent back current into the inputs? Sounds like it may not be necessary from what you said but it can't hurt can it? It may not matter with switch down, but what about with switch up? Or is the 12 V prevented then because the base of the transistor isn't firing so no 12 V is flowing?
MonMotha:
Your math is correct. I'd probably use a 2.2k or 1k resistor since I've got tons of those sitting around and 3.3k might be pushing it. Basically, just keep your base current reasonable (the datasheet should list a maximum rating for base current).
You could add such diodes if you like, but they are not needed. With the switch up, V_BE will be 0 since the pull-ups on the IPAC will float it to 5V and the base with no current will float to 5V. V_CE (collector to emitter) is never known until you solve pretty much everything else. The base voltage sets the emitter voltage, not the collector voltage. If the diodes make you feel more safe about it, put them in. We've established that the IPAC will reliably sense a low at 0.7V, and diodes are cheap.
Also, if you wanted to, you could use 4 transistors and get rid of the diodes that you have shown. the base-emitter junction of the transistor will take care of everything. You could get by with a single resistor on the combined bases then if you're sure only one switch will be triggered at once - otherwise it's best to just use 4 resistors too in that case (resistors are CHEAP).
clhug:
Awesome, thanks again!!
Looking at Radio Shack's web site I see 2.2 K or 3.3K so I'll start with the 2.2k and see how that goes. The only current rating listed on the package for the transistor is I subscript C as 200 mA. Sounds like we're well under that no matter what (short of using no resistor at all).
Oh, I also see on RS's web site that the resistors come in 1/2 watt or 1/4 watt. Same price. Does it matter for this purpose?
I might look at the 4 transistor method. However, a package of 2 diodes cost the same as the single transistor so from a cost standpoint the diodes seem cheaper (though I know we're only talking a dollar or two overall here), and I think less complicated for wiring. I couldn't guarantee that no more than one coin would ever fire at the same time. While improbable that they'd be exactly at the same time, it's entirely possible.
I'll probably go ahead and add the diodes to the inputs as well. It may not technically be needed but I'd just feel safer with my brand new $65 board.
I'll have to pick up the resistors at Radio Shack on my way home from work tomorrow so I'll let you know how it goes.
clhug:
Picked up the 2.2 K resistor tonight and it didn't work. Input detected on I-Pac but counter wouldn't fire. Does that mean the resistor is too high of a value? Try maybe a 1 K, and keep dropping down until it works?
On a side note, I hooked up the relay using this new method and everything worked great! I'm tempted to just go this route since I know it works. Is there a big reason I should try to get the transistor method working vs. the relay? As long as I put that diode backwards across the coil of the relay should I be safe with that?
MonMotha:
You can safely make that base resistor a LOT smaller (in fact, on the 2N3904, you can maybe eliminate it entirely - it'll just blow up the transistor if it doesn't work, nothign else would get damaged). Again, measure the voltages I mentioned above (especially V_BE and V_CE). V_CE should be very small, about 0.25V or thereabouts so that the voltage across the counter is as near to 12 as possible.
Of course, if you already have the relay and that works, you can just do that, sure. I try to avoid relays after assembling an entire security system using nothing by relays for logic: they're power hungry, loud, big, and unreliable, but they certainly can have their place.