Interfacing with 3.3V & 5V Logic on the same pins - Page 1
Forum section: electronics / general

author: knapik
author_rank: Regular Contributor
timestamp: December 17, 2019, 11:49:55 am
content: Hello, I had a a project idea to try interface arcade cabinets with various old video game consoles. I would like to have a plug and play system using a microcontroller with 5V tolerant inputs to read arcade button inputs, and then translate that to the various console controller protocols.However I believe I'm going to have an issue as some consoles will use 5V I/O and others will use 3.3V I/O. I can't just use a bidirectional level shifter from 3.3V to 5V as I would need to be able to able to turn off the level shifting and allow a pass through option. I would like to use the same pins on the microcontroller, but if all else fails I guess I can just duplicate the I/O lines necessary. Another idea I had is that I might be able to use an analog multiplexer & demultiplexer, but that's a bit more complicated.Anyone have any ideas for a sensible design? (I'll apologise up front, as I'm usually pretty poor at explaining thoughts)

author: Kleinstein
author_rank: Super Contributor
timestamp: December 17, 2019, 05:27:00 pm
content: At the low end there are µC that can run with 3 V or 5 V (e.g. PIC16,PIC18, AVR, some 8051,...). So one could have the same circuit and just change the supply to the µC according to the System. I would expect the cabinets to be either 3 V or 5 V but not mixed.Inputs are easy with 5 V tolerant pins at a 3 V powered µC. The difficult part are outputs. One can use SPDT analog switches (like 1/3 of 4053) to do level conversion to a target system with variable supply. This is used in some programmers for µCs, so they can support something like 2 to 5 V system voltage.

author: NorthGuy
author_rank: Super Contributor
timestamp: December 17, 2019, 06:44:59 pm
content: Many level shifter ICs have two sides which are powered by different voltages. So, you power your side with 3.3V and run you circuit on 3.3V. You power the other side with the cabinet voltage, which can be either 3.3V or 5V (or whatever else the level shifter supports).

author: nctnico
author_rank: Super Contributor
timestamp: December 17, 2019, 07:11:11 pm
content: As said: inputs are easy. A series resistor may already do the trick especially if you are interfacing buttons for which the timing isn't (nanosecond) critical. If the 5V logic is TTL levels compatible then you can drive inputs from 3.3V directly because for TTL the high level is >1.4V .

author: SiliconWizard
author_rank: Super Contributor
timestamp: December 17, 2019, 11:06:12 pm
content: Quote from: NorthGuy on December 17, 2019, 06:44:59 pmThat's what I was going to say as well. No need to bypass anything. You just need to pass the target's logic supply to your circuit.A bit of warning regarding those bidirectional level shifters though: some, if not most, have a requirement for the maximum rise/fall time of input signals to function properly, which may be a problem here if you typically deal with mechanical buttons.

author: knapik
author_rank: Regular Contributor
timestamp: December 18, 2019, 01:19:33 am
content: Quote from: NorthGuy on December 17, 2019, 06:44:59 pmQuote from: Kleinstein on December 17, 2019, 05:27:00 pmI had only done some preliminary research on available level shifters and I assumed that I could only get unidirectional level shifters with two separate IO voltage pins, seems I was wrong. From what I understand, I should probably use level shifters with one VIO side tied always to 3.3V for the microcontroller, and the other with an analog SPDT to switch between 5V and 3.3V IO levels for output to a console.Quote from: SiliconWizard on December 17, 2019, 11:06:12 pmAll of the mechanical buttons are going to be read via a microcontroller with 5V tolerant IO, so slew rates shouldn't be an issue in this circumstance.

author: knapik
author_rank: Regular Contributor
timestamp: December 18, 2019, 01:49:07 am
content: D'oh!I just realised that console controller ports have a pin with the IO voltage already there, so I'll just connect that to the level shifter rather than messing around with any switches.

author: oPossum
author_rank: Super Contributor
timestamp: December 18, 2019, 01:50:14 am
content: https://www.ti.com/logic-circuit/voltage-level-translation/overview.htmlAvoid anything with automatic direction control.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: December 18, 2019, 06:26:20 am
content: CD4050? 74HCT? Any of the, uh, 74LVC or ABT or whatever level translators? Use the latter carefully, they're stinking fast (easy to get EMI problems), and, I forget how many of them are 5V compatible versus nominal. (LVC is 5V compatible input, though I'd prefer not to supply it with 5V.)Should have no timing problems using CD4000 family here, and much easier to avoid EMI problems.Mind that old TTL/NMOS systems have V_OH ~ 3.5V, so aren't a problem on a 3.3V receiver. It's only 5V CMOS you need to worry about.Tim