Main > Main Forum
12 volt coin counter with I-Pac/4
clhug:
EDIT: If you're just looking for the solution, save yourself a lot of reading and skip to the last 2 posts in the thread for the final circuit that worked.
I'm converting a cabinet into MAME. The cabinet I bought has a fully functioning coin door which I intend to use, and it also has a coin counter. I know there's no real reason to, but as long as I have it, I'd like to wire up the coin counter. I have already searched the forums and found some info on hooking up coin counters with the I-Pac. I've found TheNasty's diagram and that will give me the basis for what I need.
However, everything I find assumes a 5 volt counter that the I-Pac is able to directly feed. The counter that came with the cabinet is 12 volt. I found a few messages asking about hooking this type of setup up, but no definitive answers.
The only thing I can think of is to use a relay. Basically replace the counter in TheNasty's diagram with the trigger side of the relay, and feed 12 V the other way through the relay for the counter. I've found two 5 volt relays at Radio Shack and I'm wondering if somebody can tell me if this should work.
Catalog # 275-240
http://www.radioshack.com/product/index.jsp?productId=2062480&cp=2032058.2032230.2032277&pg=2&parentPage=search&origkw=relay&kw=relay&parentPage=family
Catalog # 275-232
http://www.radioshack.com/product/index.jsp?productId=2062478&cp=2032058.2032230.2032277&pg=2&parentPage=search&origkw=relay&kw=relay&parentPage=family
My main concern is, I want to make sure neither of these will draw too high a current and potentially eventually fry either the I-Pac or the USB port it's plugged into. I know USB has a maximum rating. The first relay (cat #275-240) says it has a coil rating of 90 mA and 55 ohms. The 2nd, smaller, relay doesn't list it's coil current rating, but says it's 150 ohms. Based on that, would somebody be able to tell me if I should be okay driving either of those relays from the I-Pac plugged into a USB port?
Thank you!
MonMotha:
Just use a transistor. If you have an output high from your device, use an NPN with the output from your device hooked up to the base via a small (say 100 ohm or so) current limiting resistor, ground the emitter, and hook the collector up to your counter. Hook the other end of the counter up to 12V. A small signal transistor such as a 2N2222 or a 2N3904 should be fine.
If you'd like to use a relay, you can also drive the relay (either 5V or 12V) using the same method: just replace the coin counter with a relay coil.
That said, the coil on the second resistor will suck 33mA. That's a bit more than I'd like to pull from even a CMOS device (and don't bother with TTL). You can calculate that using Ohm's law: V=IR. Solve for I=V/R=5/150=33mA.
If your device you want to drive the counter with is active low, you can use a PNP hooked up to your 12V rail with the collector pushing current into the counter - ground the other end of the counter.
clhug:
Thanks for the info. Somebody in one of the threads I found in my search mentioned transistors but didn't give enough detail and I don't know enough about transistors to know what specific ones to use myself.
Now, my question is, I want to drive this off my I-Pac per TheNasty's diagram.
http://free.hostdepartment.com/T/Thenasty/byo.htm
Can anybody tell me, per MonMothma's info about which transistor to use (NPN or PNP), whether the I-Pac is an active high, or active low?
MonMothma, if I do need a PNP due to active low, can you give me specific transistor to use for that. and how would I hook that up?
Also, one thing I'm not sure of is, with a relay, the 12 V signal side to drive the counter is completely isolated from the 5 V that drives the relay. With the transistor there are only 3 pins, so I assume the 5 V and 12 V will share a ground? This isn't going to cause problems? It won't feed 12 Volts back through the I-Pac's ground, which is of course tied to ground on the USB port, which I'm not sure it could handle the 12 V since it is a 5 V device? One thing I should mention, the 5 V and 12 volt sources come from different power supplies so they don't share a common ground normally. The 5 V comes strictly through the I-Pac which of course gets its power from the PC. The 12 V is coming from a completely separate power supply I have in the cabinet to drive the lights on the coin door (behind the coin reject buttons). Since that PS came with the cabinet I bought and it was already wired up for the coin lights I decided to just use it rather than pull a separate 12 V source off my PC and have to rewire the lights.
One last question. The more I thought about this, with TheNasty's original diagram we're driving the counter directly from the I-Pac which still a coil in an electromagent. Essentially no different from the relay on the coil side. So should I be okay with the relay (not burning out the USB or I-Pac) or does the coil in the coin counter probably have a higher resistance than these relays so they don't draw too much current?
I don't necessarily "want" to use a relay, it was just the only thing I knew how to wire up on my own. I'm definitely open to the transistor thing. I just want to make sure I'm not doing something that will fry my I-Pac or my PC's USB port no matter which way I go.
Thanks again!
MonMotha:
It's MonMotha (no stray extra m) - no relation to the star wars character :)
From that diagram, your device would appear to have an active high output, so any small signal NPN transistor should do (doesn't have to be one of the ones I mentioned). You'd have to common your grounds for that to work though, as otherwise the current from one place or the other (depending on which ground you pick) won't have any place to go. Current must be able to flow from both the base and the collector to the emitter.
If you'd like to drive a relay, you can. I'm not sure what the relative current draws are of a coin counter vs. a relay as I don't know what your average coin counter pulls. You can safely pull about 50-75mA from most CMOS devices if you don't mind the power (aka heat) dissipation (TTL tends to not be able to source as much as CMOS), but I like to keep things below 10mA if possible. Of course, for low duty cycle situations (such as driving a relay coil), that may not matter. Just watch out for inductive switching transients across the coil. A reverse biased diode across the coil terminals will clamp these to something safe. Using a transistor as a switch will isolate the chip from such nasties.
In this case, you could use the NPN transistor to switch a 5V relay, and then you would not need to common your grounds, but that seems like an awful lot of work (and parts). Just watch the current draw from USB: it must remain below 500mA no matter what. Is there a reason you're not wanting to common your grounds? If you do decide to tie them together, make sure you do it at the frames or actual ground output from the PC PSU, not just off the USB ground.
clhug:
I apologize for getting the name wrong. You're right, I just had it my head. :)
Thanks again for all the info. I think I've just about got it. I wanted to make sure though. Hopefully TheNasty will forgive me for reusing his diagram, but I've taken it and modified it to what I think you're indicating with the transistor. I've tried to attach it to this message. Can you take a look and make sure I've got it right? I've tried to attach the picture to this message so hopefully it worked. This is the first time I've tried to include a picture in a post.
This is assuming that I will use the 12 volts from PC's own power supply rather than the separate power supply so the ground should be common between the 5 V and the 12 V.
Couple more quick questions.
What's the purpose of also tieing the ground back directly to the PC power supply ground rather than through the ground built in to the I-Pac? Is that just because we'll still have 12 volts coming through there and we don't want 12 V going through the ground on the I-Pac, and thus through the USB port, so by grounding directly to the power supply in addition to the I-Pac we divert the 12 V that way?
Also, what's the purpose of the 100 ohm resistor? The I-Pac shouldn't need it. Normally the ground is connected directly to the input on the I-Pac through a NO switch (so when the switch is closed that specific input on the I-Pac is connected directly to ground). Or is it to keep from frying the transistor?
On a side note, I stopped at Radio Shack on the way home tonight to pick up the parts. I looked at that mini relay. It's actually 250 ohm coil with a 20 mA current draw. I'd think that should be low enough to not cause any damage if I decide to go that route. It is only a very brief momentary contact every time a coin is inserted. I suppose for people using coin buttons (which may be most) somebody could hold down the coin button but I don't think that would happen very often.
And last question (for now), what do you mean about inductive switching transients across the coil if I use the relay? Does that cause it to trip when I don't want to, or not trip when it should? What does the diode do to stop this, and can you suggest a specific diode (hopefully something I can get at Radio Shack).
I apologize if I'm being a bother. I understand the basics of what a resistor, diode, and transistor all do, but I don't know enough to know details of what specific items fit for what purposes.