Author Topic: Interfacing with 3.3V & 5V Logic on the same pins  (Read 1222 times)

0 Members and 1 Guest are viewing this topic.

Offline knapikTopic starter

  • Regular Contributor
  • *
  • Posts: 143
  • Country: au
Interfacing with 3.3V & 5V Logic on the same pins
« on: December 17, 2019, 11:49:55 am »
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)
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14339
  • Country: de
Re: Interfacing with 3.3V & 5V Logic on the same pins
« Reply #1 on: December 17, 2019, 05:27:00 pm »
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.
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3151
  • Country: ca
Re: Interfacing with 3.3V & 5V Logic on the same pins
« Reply #2 on: December 17, 2019, 06:44:59 pm »
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).
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 27137
  • Country: nl
    • NCT Developments
Re: Interfacing with 3.3V & 5V Logic on the same pins
« Reply #3 on: December 17, 2019, 07:11:11 pm »
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 .
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14617
  • Country: fr
Re: Interfacing with 3.3V & 5V Logic on the same pins
« Reply #4 on: December 17, 2019, 11:06:12 pm »
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).

That'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.
« Last Edit: December 17, 2019, 11:10:06 pm by SiliconWizard »
 

Offline knapikTopic starter

  • Regular Contributor
  • *
  • Posts: 143
  • Country: au
Re: Interfacing with 3.3V & 5V Logic on the same pins
« Reply #5 on: December 18, 2019, 01:19:33 am »
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).

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.
 
I 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.

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.

All 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.
 

Offline knapikTopic starter

  • Regular Contributor
  • *
  • Posts: 143
  • Country: au
Re: Interfacing with 3.3V & 5V Logic on the same pins
« Reply #6 on: December 18, 2019, 01:49:07 am »
D'oh! :palm:
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.
 

Offline oPossum

  • Super Contributor
  • ***
  • Posts: 1424
  • Country: us
  • Very dangerous - may attack at any time
Re: Interfacing with 3.3V & 5V Logic on the same pins
« Reply #7 on: December 18, 2019, 01:50:14 am »
https://www.ti.com/logic-circuit/voltage-level-translation/overview.html

Avoid anything with automatic direction control.
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21791
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Interfacing with 3.3V & 5V Logic on the same pins
« Reply #8 on: December 18, 2019, 06:26:20 am »
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
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf