1
\$\begingroup\$

I need to replace mechanical switches with some kind of digital switch. Specifically I want to sent control inputs to various arcade games that use standard JAMMA inputs, which are basically switches to ground for each button/joystick. The inputs will come from a 3.3V microcontroller, but most games use pull-ups 5V so a buffer is required.

The obvious solution is to use open drain outputs. I'm trying to decide what type is best. The two candidates I have are the SN74LVC07 hex buffer and a ULN2003 or similar Darlington array. The SN74LVC07 is MOSFET based with open drain outputs and rated up to 5.5V, where as the ULN2003 will accept higher voltages (arcade systems do use 12V, although I doubt any use it for control inputs) and is probably a bit more robust.

Any comments on which of these would be best, or would some other option entirely be better? What about unused buttons? I can't see any issue with leaving those outputs disconnected and the datasheets don't say anything.

Thanks.

\$\endgroup\$
  • \$\begingroup\$ What's the maximum current allowed through the 5V pullups? \$\endgroup\$ – EM Fields Jun 4 '14 at 10:52
  • \$\begingroup\$ It depends on the particular arcade game. I imagine most of them are very low, I can't see why they would pump much current through the mechanical switches in the joysticks and buttons. Less than a milliampere. \$\endgroup\$ – user Jun 4 '14 at 16:00
  • \$\begingroup\$ Please add specifications to your question. What value are the pull-up resistors? What voltage is classified as an input-low signal on the arcade system? Without more information all you will receive is poor answers. \$\endgroup\$ – horta Jun 12 '14 at 20:22
  • \$\begingroup\$ Each arcade board is different. The pull-ups will vary, the voltage will vary. Most are 5V or 3.3V, but there are no guarantees. The mechanical switches are usually rated for 12V or more. \$\endgroup\$ – user Jun 12 '14 at 22:21
3
+50
\$\begingroup\$

Since you'll be driving the switches with an MCU, the 2003's inversion won't matter, so it looks to me:

                 Vce   Vcc    IC           $/pkg   $/dev
                  V     V     mA   n/pkg   DKEY1   DKEY1
              |------|-----|-----|-------|-------|-------|      
     ULN2003     50     0    500     7     0.59    0.084
     74LVC07     6.5   6.5    50     6     0.45    0.075 

like the extra penny per device for the 2003 is well worth its extra robustness and versatility.

Here are the data sheets for the ULN2003 and for the 74LVC07.

\$\endgroup\$
  • \$\begingroup\$ Thanks. More to the point though, would the ULN2003 be suitable to replace mechanical buttons? In other words, will the arcade board notice any difference at all? My understanding is that the Darlington arrangement should be suitable, but can you confirm that? \$\endgroup\$ – user Jun 12 '14 at 14:14
  • \$\begingroup\$ It depends on what voltage the circuit being driven by the switch considers to be a logic 0. for instance, with the switch made the voltage out of the pullup will be, essentially, zero volts, while Vce(sat) out of the ULN2003 will be somewhere in the range of 0.6 to 0.7V, according to TI's data sheet. So, if the circuit the switch is driving considers something higher than, say, 0.7V to be a logic 0, everything will work just fine. \$\endgroup\$ – EM Fields Jun 12 '14 at 18:11
  • \$\begingroup\$ After thinking about it for a while, and reading Dirceu's post, it becomes apparent that unless the machine is to be run autonomously by a microcontroller, then its (the microcontroller's) inputs most come from somewhere... If the buttons are still to be there, plus maybe some other stuff, then a cheap, effective way to interface to the µC would be with parallel-in serial-out shift registers for the buttons, etc. and serial-in parallel-out shift registers for the outputs to the machine. Total cost to the micro would be 4 I/Os, I believe. I'll post the circuit as soon as I can get to it. \$\endgroup\$ – EM Fields Jun 12 '14 at 18:35
  • \$\begingroup\$ I am already using GPIO extenders that are basically shift registers. That isn't the problem, it's as you say the fact that the ULN2003 isn't equivellent to a physical switch to GND and so might not offer complete compatibility with all games. I imagine 99.9% will work, but I was hoping for something better. \$\endgroup\$ – user Jun 12 '14 at 19:36
  • \$\begingroup\$ The 74LS07 looks like it might be the best option. More expensive but the outputs are rated up to 30V. It should work well with older TTL logic. \$\endgroup\$ – user Jun 12 '14 at 20:18
2
\$\begingroup\$

The simplest method is to simply replace (or bypass) each button with a single NPN transistor. Connect the ground of your controller to the ground of the target device, pull down the base of the NPN with a 10KΩ resistor, and drive the base from your controller's IO port via a 470Ω resistor. When you drive HIGH the NPN will turn on connecting the device's signal to ground. No need for fancy chips.

\$\endgroup\$
  • \$\begingroup\$ I have to switch 30 lines, so I want to use arrays instead of individual transistors. That's why I asked about arrays. \$\endgroup\$ – user Jun 12 '14 at 14:31
  • \$\begingroup\$ That's fair enough then. The ULN2003 (or ULN2803 for more elements) does the same job as the NPN transistors. They're just made for higher currents (being darlington pairs), so are somewhat overkill. If you can find just an array of straight NPN transistors that'd be ideal. BTW, you can get NPN in SMD with built in resistors (called digital switching transistors) that save space. They must be available as arrays cheaper than darlington pair arrays I'd have thought. \$\endgroup\$ – Majenko Jun 12 '14 at 14:37
  • \$\begingroup\$ The cheapest array I can find is a ULN2003 at 8.6p per IC. As I mentioned in the bounty I'm looking for references or personal experience though, so I can only vote you up for now. \$\endgroup\$ – user Jun 12 '14 at 15:50
  • \$\begingroup\$ Let me just throw you a curve ball in the form of a completely different option. Since you're driving 30 signals, you'll probably be using 30 IO ports on your MCU. That's a lot of wires. How about SPI or I2C IO expanders, such as the MCP23017 or MCP23S17 that give 16 IO ports per chip, which can be configured to be open drain. Two chips, 3 or 4 wires from your MCU. Each chip is more expensive than a ULN2003, but you get big benefits elsewhere. \$\endgroup\$ – Majenko Jun 12 '14 at 16:05
  • \$\begingroup\$ I am using the 23S17 for some outputs, yes. I could put in level translation to let it run at 5V I suppose, but it seems wiser to install a buffer designed for the task. \$\endgroup\$ – user Jun 12 '14 at 19:33
1
\$\begingroup\$

Firstly, thanks to EM Fields for talking this out. That conversation lead me to the answer.

The SN74LVC07A looks like the best option. It will handle the required voltages and have a low VOL at 3.3V supply. Sadly the datasheet doesn't have any curves but the numbers given suggest it will be okay.

Another option would be the classic 2N3904 NPN transistor, which is available in a quad as either the MMPQ2222A or MMPQ3904. Alternatively the LM3046 also looks similar and suitable. At low currents in the tends of milliamperes range they have a Vce(sat) of only 0.2-0.3V, which should be low enough for almost any type of logic down to 3.3V. The down side is that they will require base resistors and only come in quad or quintuple packages.

\$\endgroup\$
0
\$\begingroup\$

Since you stated that integration is an important requirement (at least 30 lines should be available), I recommend you get rid of these older integrated circuits and move to a more modern and effective solution. For example, use one of the following "GPIO expanders":

  1. From Microchip - MCP23016 (16 bit \$I^2C\$)
  2. From Microchip - MCP23017/MCP23S17 (16 bit \$SPI\$)
  3. From ST - STMPE2401 (24 bit \$I^2C\$)
  4. From NXP - PCA9505/06 (40 bit \$I^2C\$)

The main advantage is the great saving of microcontroller I/O pins, which remains also using more than one of them. In addition, there are other unique features - the pin behavior is totally programmable, like open drain outputs, PWM outputs (in some part numbers), interrupt capability, capture register (see the datasheets for the details). If you do not have \$SPI\$ or \$I^2C\$ pins available on your microcontroller, that can always be emulated by software - the bonus is that can be done on any MCU, since the speed is not a limiting point (remember that you are dealing with buttons).

\$\endgroup\$
  • \$\begingroup\$ That wasn't the question. As it happens I am in fact using the MCP23S17 for some of the outputs already. What I need is a buffer because the arcade boards are mostly 5V, and my micro is 3.6V max. I could do level translation and run the I/O extender at a higher voltage, but it would be simpler just to use cheap buffer chips that have well protected open-drain outputs. Also, it isn't clear if something like the MCP23S17 will be able to drive its outputs low because of the per-pin current limit, and although it's unlikely to be an issue the arcade board is basically an unknown quantity. \$\endgroup\$ – user Jun 12 '14 at 19:39
0
\$\begingroup\$

This is a pretty simple problem. Either of those chips will work. Why you'd want to use a buffer over a standard open drain is beyond me. It's not like you need the buffer driving your signals high fast unless you have not added in the pull-up resistors. As long as the devices can sink as much current as your pull-ups provide, anything will work.

You can use a MOSFET in open drain topology, BJT in open collector topology, or a Darlington pair in the same config. If you wanted to remove the pull-up resistors from the circuit, you could use a buffer. Otherwise, that just feels like overkill.

A mux chip would save you pins on your MCU. Others have recommended expanded IO chips.

I also wonder why you haven't gone a different route entirely. Obtain a similar version of your MCU that can handle 5V with lots of IO pins to handle your 30 lines. Then you don't need an extra chip(s) at all.

Alternately, you could look into analog switch arrays. Here's one for instance. If you were to actually use that chip, you would have to add a single level shifter because it's a 5V chip.

\$\endgroup\$
  • \$\begingroup\$ I'm not providing pull-ups, the arcade board is. When you say "either of those chips will work", do you speak from experience? How about the fact that the ULN2003 will not drive right down to GND? Are you sure ever arcade system will be okay with that? There is no version of the MCU that supports >3.6V, and I don't want to switch to another platform when an 8p buffer IC is all I need. That would be dumb - throw out experience and an excellent IDE for no reason. \$\endgroup\$ – user Jun 12 '14 at 19:41
  • \$\begingroup\$ @MoJo If 0.7 Volts low-signal isn't good enough for a 5V supply/signal, then I'm not sure what would be. I doubt anyone here has experience with such a specific topic as "most arcade systems". It will take more than 1 chip to accomplish 30 pins, but you're right, it will work. I was throwing ideas out there, if they don't work for your particular case, they don't work. No need to be nasty about it. \$\endgroup\$ – horta Jun 12 '14 at 20:18
  • \$\begingroup\$ @horta: I fully agree with you. User "Mojo" shows little respect with the participants. He proposes a very basic question and offers +50 points for it. Then he vote down in our contributions. We spend our time working in a proper answer for this? The administration should take some action. \$\endgroup\$ – Dirceu Rodrigues Jr Jun 12 '14 at 22:24
  • \$\begingroup\$ I can't help it if you didn't read the question. \$\endgroup\$ – user Jun 13 '14 at 8:02

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.