0
\$\begingroup\$

I want to interface two MCU's, one is at 3.3V and the other at 5V. The problem is that the 3.3V device is sensitive, and can't handle 5V signals, so I need to step the RX line on the 3.3V device down from 5V to 3.3V. Is it possible to use a voltage divider on a serial line, or another simple way of accomplishing this without using a level converter IC?

UPDATE I haven't tried using a divider yet. I have implemented a TTL converter from Adafruit, and it works, at 9600 baud, but not at higher speeds. I have a certain amount of noise in my system, which I have a hard time getting rid of, and suspect this is the reason. I suspect a divider will be worse in this case.

\$\endgroup\$
  • \$\begingroup\$ you can use a level shifters. eg. cfile30.uf.tistory.com/image/130F9B3F4F35E00F2E948A . \$\endgroup\$ – hassansin Jun 4 '14 at 7:05
  • 1
    \$\begingroup\$ You normally can although it can depend on the speed and particular devices, see the link in the following answer by stevenh: electronics.stackexchange.com/a/8737/17064 \$\endgroup\$ – PeterJ Jun 4 '14 at 7:08
  • 2
    \$\begingroup\$ 3V3->5: nothing to do, 5->3V3 resistor divider. This should work fine. \$\endgroup\$ – Vladimir Cravero Jun 4 '14 at 7:12
  • \$\begingroup\$ Voltage dividers generally respond poorly to high frequencies, but not sure if serial communication which is at the order of microseconds is a problem. I think I'll try diodes. Thanks for the link PeterJ. \$\endgroup\$ – Pål Thingbø Jun 4 '14 at 7:51
  • 1
    \$\begingroup\$ Which are the two MCUs, specifically what is their input voltage range, and the desired frequency of communication between MCUs? That will help decide on a solution \$\endgroup\$ – darudude Oct 14 '14 at 23:32
1
\$\begingroup\$

A voltage divider works fine for converting 5 V signals to 3.3 V signals. I've used 2 kΩ in series followed by 3.9 kΩ to ground for exactly this purpose. In this case the speed was 115.2 kBaud, and the delay introduced by the resistors was small compared to a bit time.

The real problem is the other direction since the signal probably has to be amplified. Unless the 5 V chip has "TTL" input levels, 3.3 V may not be above its guaranteed input high level. Some parts use 20% and 80% of Vdd for the guaranteed levels. If yours does that, the signal must exceed 4 V to be reliably picked up as high. Level converters are small and cheap and exist for just this purpose. Another trick is to use a HCT gate (really any gate with TTL input levels) powered from 5 V to do the conversion. That only makes sense if you have a left over gate, otherwise a deliberate level converter makes more sense.

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

I would use a CMOS gate connected to the 3.3v mcu and a transistor conected to the 5v mcu. You connect the inputs and outputs of the 3.3v mcu to the cmos gates. Then you either drive these gates with a transistor that has the collector connected to 3.3v and a 10k resistor in the emitter lead. The junction of the emitter and the resistor are connected to the input of the cmos gate, The output of the cmos gate is connected to the input of the 3.3v mcu. You connect the base to the output of the 5v mcu.

You drive the 5v mcu by connecting the collector to 5v and you still put the resistor in the emitter lead. You connect from the emitter resistor junction to the input of the 5v mcu and the base connects to the output of the cmos gate. The input of the cmos gate connects to the output of the 3.3v mcu. This is a lot harder to describe than it it is to hook up. This setup will handle several 10s of MHz with no problem.

I would use 2n4401 transistors. The current draw is in the low ma range for each pin. For 8 inputs and 8 outputs you would need 16 transistors and three cmos dips that are hex buffers. This setup is positive logic. By connecting to the emitter resistor junction with the resistor grounded the resistor is pulled all the way to 0 volts if the transistors are good. The high output signal is 5 or 3.3v minus about 0.6 volts. These values are in the specification for a logic low and a logic high. The buffers give you another degree of isolation if something were to go wrong.

\$\endgroup\$
  • 1
    \$\begingroup\$ Welcome to EE.SE! When you use four spaces on Stack Exchange sites to start a paragraph it formats it as code so I've just fixed that up. But if you wanted to add a schematic of what you've got in mind to make it clearer you can press Ctrl-M or press the little circuit icon to launch a browser based schematic editor. \$\endgroup\$ – PeterJ Jun 16 '14 at 14:51

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.