## Mixed Voltage Systems: Interfacing 5V and 3.3V Devices

Post here to teach people how to do something.

Moderators: Chuckt, Garth, bitfogav

Chuckt
I practically live here!
Posts: 1127
Joined: Sun Mar 28, 2010 1:36 pm

### Mixed Voltage Systems: Interfacing 5V and 3.3V Devices

Mixed Voltage Systems: Interfacing 5V and 3.3V Devices
Eight methods for interfacing 5V and 3.3V devices will be described.
http://www.savagecircuits.com/content.p ... 3V-Devices

Posts: 2567
Joined: Fri Mar 26, 2010 10:30 pm

### Re: Mixed Voltage Systems: Interfacing 5V and 3.3V Devices

Fantastic article Chuck. In-fact, I have a circuit right now that has both 3.3V logic and 5V logic circuits!

Garth
I practically live here!
Posts: 204
Joined: Wed Jan 16, 2013 1:17 pm
Contact:

### Re: Mixed Voltage Systems: Interfacing 5V and 3.3V Devices

Good article. I would add however that passive pull-up or -down resistors make for very slow transitions since the capacitance to charge up on the line is not 0. For example, with a 10K pull-up resistor and 20pF of capacitance on the line, the pull-up time constant is 200ns, which is very, very slow by digital standards. In some of the circuits, a compensating capacitor can be added; for example, in figures 1 & 2, put a 10pF across R1 [Edit: Correction: see my next post below]; in figure 3, you could put it put it across the diode if the trr of the diode isn't already long enough or its capacitance enough; and in figures 4, 7, and 8, putting it across R1 will help turn the transistor off and on faster but will not help raise the collector voltage any faster when the transistor turns off.

I show using an LM339 (quad) or LM393 (dual) comparator for voltage translation at http://wilsonminesco.com/6502primer/pot ... HI_V_LOGIC, but this is not for very high-speed logic. I've used it primarily for 5V-to-12V logic, like 5V to 4000-series which isn't very fast anyway but can go up to 15V. I've used the 4000-series stuff primarily for analog switches, the 4066, 4051, 4052, and 4053, for controlling audio circuits that use a 12V power supply.
Last edited by Garth on Thu Sep 18, 2014 5:23 am, edited 1 time in total.
http://WilsonMinesCo.com/ lots of 6502 resources

Chuckt
I practically live here!
Posts: 1127
Joined: Sun Mar 28, 2010 1:36 pm

### Re: Mixed Voltage Systems: Interfacing 5V and 3.3V Devices

Garth,

I wouldn't have known that without an oscilloscope, some kind of test measurement equipment, doing some kind of test or hearing from you.

Thank you.

Chuck

Garth
I practically live here!
Posts: 204
Joined: Wed Jan 16, 2013 1:17 pm
Contact:

### Re: Mixed Voltage Systems: Interfacing 5V and 3.3V Devices

I was in too big of a hurry earlier, and I goofed. With a hypothetical (but realistic) 20pF capacitive load on the 3.3V line, the capacitor across R1 (which drops only half as much voltage) should be more than that, not less. I was thinking less impedance, but that comes from more capacitance. The capacitor across R1 should be twice the 20pF load, not half; so it needs to be 40pF, not 10. Realistically, it might be hard to accurately predict or even measure the load capacitance, but you don't have to be very accurate. In this case I might put in 47pF as it's a lot more common than 39. ICs' data sheets usually specify a maximum input capacitance, not typical; and then you have to add that of the socket (if any), and of PCB traces which may be negligible.
http://WilsonMinesCo.com/ lots of 6502 resources

Posts: 2567
Joined: Fri Mar 26, 2010 10:30 pm

### Re: Mixed Voltage Systems: Interfacing 5V and 3.3V Devices

Some very useful info added there Garth.

On a similar note, I had a little bit of a hard time with some analog inputs on a project I was helping a friend with. Basically we were reading the output from a voltage divider consisting of a 10M resistor and a photodiode (this circuit was repeated a number of times and then each circuit was connected to it's own analog input of a PIC micro controller.)

Long story short, the huge resistance resulted in a massive time constant so when we were scanning though each of the analog input pins, each input would have an effect on the other because the internal capacitor used in the ADC circuit did not have anywhere near enough time to discharge before measuring the net input.

So it was time to start looking at adding an opamp in-between then photodiode voltage divider and the analog input pin

Garth
I practically live here!
Posts: 204
Joined: Wed Jan 16, 2013 1:17 pm
Contact:

### Re: Mixed Voltage Systems: Interfacing 5V and 3.3V Devices

Brad, is the photodiode a current device? If so, you can use the op amp to convert current to voltage, and there's no real time constant because the inverting input's voltage theoretically does not change, so the minute capacitance on the line is not getting charged and discharged. The non-inverting input goes to a voltage reference, the photodiode goes directly to the inverting input with no resistor, and you'll have a feedback resistor from the op amp's output to the inverting input. The output voltage then is the feedback resistor times the input current, negated. (I might not be telling you anything you don't already know, but maybe it'll be helpful for other readers.)
http://WilsonMinesCo.com/ lots of 6502 resources