Anda di halaman 1dari 5

rocketnumbernine

Andrew's Project Blog: Hardware, Software, Stuff I find Interesting


5V-3.3V bidirectional level converter
by Andrew on 10 Apr 2009

More and more interesting devices seem to be using 3.3V rather than the usual 5V that micro-controllers run
at. I find that level conversion circuitry often clutters the rest of the circuit and has to be tweaked for the
characteristics of the device being interfaced with. This posting details the research for and construction of a
reusable, plug-n-play power drop and bi-directional level converter for use in prototyping.
By far the easiest solution is to also run the micro-controller at 3.3V, but this can affect maximum frequency
of the device and can complicate interfacing with USB. The alternative is to use a small regulator to down
shift the 5V to 3.3V supply voltage (if not using an Arduino like board which has one built in) and an ad-hoc
level conversion circuit for the logic lines.

Power Conversion
The Circuit below uses a Microchip MCP1700 LDO Voltage Regulator, which is fairly cheap, and available
in a number of output voltages and case styles, the device can provide upto 250mA, but unless cooled I
wouldn't draw more than 10s of mA through it - particularly in the SOT23-3 style case (see here for more).

Logic Level Conversion


Techniques for converting the digital logic levels depends on whether the line is unidirectal - like SPI - where
one side of each line always acts as the output, or bi-directional - like I2C - where both sides can drive the
line. Obviously, a unidirectional converter is much simpler and the specific technique depends on whether

we're shifting up or down (if the driving line is the low or high level respectively).

Unidirectional Level Conversion: Low-to-High


Connecting a 3.3V digital output pin to a 5V input pin is often straightforward. Most devices are fairly
tolerant to the minimum voltage that they will accept as a digital high value. Most Atmel microcontrollers, for
example, accept anything above 0.6Vcc as high, so the 3.3V device must output a level above 3V
(0.65V).
The electrical characteristics section of both devices datasheets needs to be checked (for example). Note,
that the voltage out of many devices will drop if the load current is increased. Most digital devices draw less
than 1A but it may become an issue if the line is also driving something else. For example, the datasheet of
the Color Nokia Knock-Off LCD sold by SparkFun states that the minimum value possible for a high level is
the supply voltage - 0.4V = 2.9Volts. Although this is a minimum and the device is likely to output an
acceptably high value this isn't a kind of error that will be easy to debug in a finished system.

Unidirectional Level Conversion: High-to-Low


Converting 5V to 3.3V is more interesting. Many devices can accept higher voltage inputs than their supply
voltages or an external clamping diode and current limiting resistor can be used to provide the same,
alternatively a simple voltage dividers can be used - (see SparkFun Sensor Interfacing Tutorial) again this will
rely on the characteristics of the circuit and devices being used.
There are also some off the shelf IC bidirectional level converters available, although most appear to be for a
set direction (all high to low or all low to high), for example:
1. HCF40109 - A single 16 pin DIP that can shift 4 lines in one direction.
2. SN741VC425 - bidirectional (although all the same way) 8-way bus shifter.

Bidirectional Conversion
Bidirectional Level conversion is more complex, as either end of the line can be driving the circuit. There are
also some bidirectional IC level shifters available, for example the Maxim Range of level shifters look
interesting but these don't yet appear to be very cheaply priced in small quantities.
The circuit below shows a bidirectional voltage shifter that first appeared in an Application Note by Herman
Schutte at Philips. The technique is unique in that it uses a single MOSFET transistor, is bi-directional, and
can work with a fairly large range of voltages.

The resistors are only required if the lines are open-collector (not connected to GND or +V), which is not the
case on the 5V side if connected to an AVR output pin or an input pin with the internal pull up resistor
enabled). But adding does no harm and allows the circuit to be used in other situations.

Below is a prototype soldered onto vero board, the power shift is electrically separate from the level shifters
allowing an external 3.3V to be used if available.

.
The soldered SMD components aren't pretty but usable until a PCB version is ready.

References
1.
2.
3.
4.
5.
6.
7.

MCP1700 LDO Voltage Regulator datasheet


MCP1700 Thermal issues.
STMicroelectronics HCF40109B Quad Low-to-High shifter
Maxim Range of level shifters
D Holmes on level shifting
MOSFET Bi-directional level shifter Application Note
BSS138 MOSFET datasheet

15 Comments - Add yours hide


Auto Refresh: Off refresh now
Sergei @ 13/8/2009 16:36:23 Reply
A small correction: "Maxim MCP1700 LDO Voltage Regulator" should be "Microchip MCP1700 LDO
Voltage Regulator" (the link correctly points to the web site of Microchip).
andrew @ 14/8/2009 5:55:12 in response to Sergei Reply
Thanks - I've edited the main entry
anon @ 12/3/2010 6:10:47 Reply
Great stuff, thanks! The link to Herman Schutte's article doesn't work, the first result from Google does,
though: http://ics.nxp.com/support/documents/interface/pdf/an97055.pdf Also, I think I've seen Maxim or
someone selling an IC that actually only has a MOSFET and two resistors inside, in this specific
configuration.
andrew @ 13/3/2010 8:46:07 in response to anon Reply
Thanks, looks like philips have moved everything under the NXP domain, I've edited the link. Maxim sell the
MAX3370 single and MAX3372 double (http://www.maxim-ic.com/app-notes/index.mvp/id/3007), but they
don't appear to be widely available or cheap in small quantities.
david @ 30/8/2010 16:53:48 Reply
Is this the same circuit as the Sparkfun Logic Level Converter (
http://www.sparkfun.com/commerce/product_info.php?products_id=8745 )?
andrew @ 31/8/2010 2:51:52 in response to david Reply
Yes (ignoring Sparkfuns voltage convertor for the 5V->3.3V conversion) they're both from Herman Schutte's

application note: http://www.semiconductors.philips.com/acrobat/applicationnotes/an97055.pdf


RMR @ 14/4/2011 19:56:11 Reply
Under the first appearance of "Unidirectional Level Conversion: Low-to-High" the paragraph begins with:
"Connecting a 3.3V digital output pin to a 5V input pin..." Under the SECOND appearance of
"Unidirectional Level Conversion: Low-to-High" the paragraph begins with: "Converting 5V to 3.3V is more
interesting."
andrew @ 15/4/2011 0:54:12 in response to RMR Reply
Good catch, I've updated the original post
irving @ 8/3/2012 19:12:20 in response to andrew Reply
Actually under the SECOND appearance of "Unidirectional Level Conversion: Low-to-High" I think it should
be "Unidirectional Level Conversion: HIGH-TO-LOW" so "5V to 3.3V is more interesting..." was right
andrew @ 9/3/2012 0:26:49 in response to irving Reply
Indeed, changed in the original, thanks
Richard @ 11/7/2011 12:45:05 Reply
What through hole device could be used in place of the BSS138?
Peter @ 2/10/2011 10:51:41 in response to Richard Reply
Try with BS170
andru @ 19/5/2012 13:10:45 in response to Peter Reply
Did this work? I am looking at the 2N7000 - NTE491 as a through hole option.
Reinis @ 23/5/2012 18:24:09 in response to andru Reply
It works for me- I use two of them to interconnect between two MCUs, one running at 3.3V, the other one
at 5V through UART.
japz87 @ 23/7/2012 16:16:14 Reply
Hello everyone... has anybody used the MAX3013 or those others similar to the MAX3370, they are also
level translators that says to be bidirectional, but I don't get it clear if they are useful for an application like an
I2C bus... I need to do the translation for six data lines so I was looking for an IC that packaged this
MOSFET interface for many lines... any idea will be very appreciated!... thanks!!
Tags/Categories: shifter, voltage conversion, 3.3V, 5V, AVR, regulator, LDO, MOSFET, MCP1700,
howto
Previous: Xyloduino: Simple Arduino/piezo organ Next: Using SPI on an AVR (1)
Contact
andrew @ rocketnumbernine.com
Subscribe to RSS
phatIO
Checkout phatIO an IO device that looks like a USB filesystem

Set a pin to 5V by saving "1" to its control file, set it back to 0V by saving "0".
Control LCD and LED displays by writing the data to display to a file.
Communicate with TWI, and SPI and other devices by writing data to a file.

Videos, reference and more at phatIO


Share with others:
Tw eet

Like

Recent Posts
phatIO
Installing AVR GCC on OS X
Automating Gerbers from Eagle
SMT Table Top Reflow Oven (part 3): Final Build
Programming the AD9851 DDS synthesizer
Using the ICM7218 LED driver
Decoding a Rotary Encoder
External Time Capsule Fan
SMT Table Top Reflow Oven (part 2): Controlling the Heater Elements
Using SPI on an AVR (3)
Using the MAX6675 Thermocouple-to-Digital Converter
Bidirectional Level Converter PCB
SMT Table Top Reflow Oven (part 1)
Using SPI on an AVR (2)
Review: The Saleae Logic
Categories/Tags
Howto, Projects, Reviews, Miscellaneous.
arduino, seeeduino, servo, photoresistor, control, piezo, shifter, voltage conversion, 3.3V, 5V, AVR,
regulator, LDO, MOSFET, SPI, Serial, MCP3201, DAC, at90usb162, atmega328, Saleae Logic, USB,
DS1305, RTC, interrupts, SMT, soldering, reflow oven, MAX6675, MCP1700, master/slave,
Thermocouple, relay, LED, AD9851, pcb, eagle, phatIO