Logic Level Converters for Raspberry Pi

Updated 06 February 2017

So you’ve got your Raspberry Pi, you’ve got your sensors and external components and you’re ready to build a world-conquering robot beyond compare. But hang on a minute, the sensor you have only operates on 5V and you vaguely recall that using 5V with the Raspberry Pi GPIO pins could be bad. Well you’re not wrong, that would be very bad. You see, the Raspberry Pi board, like many other DIY platforms operates on 3.3V rather than 5V. If you’re not sure what we mean talking about voltage levels and other such terms, check out our Analogue Electronics Crash Course to get a handle on how electricity and electronics components all work.

Logic Levels

So what do we mean when we’re talking about logic levels? Simply put, a logic level is the voltage recognised by a system as the typical voltage of a high signal. This voltage level issued used by chips to determine whether the signal is high or low (binary logic) and then can make computations based off that. Traditionally, 5V was the default logic level for most systems, however as silicon chips have gotten smaller and more efficient, 3.3V is now the standard for most microprocessors (higher level processors like those found in modern desktops/laptops can be as low 1.2V).

Digital signal

The issue with this is that for a chip running at 3.3V, if you connect 5V up to its pins, unless it’s specifically tolerant to the higher voltage, you can risk damaging the pin, or the entire chip. Now that damage only goes one-way. If you connect 3.3V up to a 5V pin, you won’t damage it, however 3.3V may not be high enough for it to register a high signal, so it may not work properly. So the general rule of thumb is to match the logic level voltage of external components, shields, modules, or other boards to the board/chip you’re connecting to. Now how can we interface two things that operate on different voltages? A magic piece of hardware called a ‘Logic Level Converter (or shifter)’.

Logic Level Converters

Sparkfun logic level converterOne of our most popular logic level converters is this one from Sparkfun. It’s a four channel, bi-directional converter which is awesome because it means that it will convert from a high to a low voltage, and from a low to a high voltage which makes it so handy to have going between 3.3V and 5V devices. Now don’t think that this board will step-up your 3.3V to 5V by itself. You can see on the board the HV and LV pads which means you need to have 3.3V and 5V lines to connect to it, and then the on board BSS138 FET shifts the signal up or down. You can use this board with voltages other than 5V and 3.3V (the BSS138 is rated for up to 50V) however it’s mostly used for shifting these logic level voltages. Now we know a bit about what logic level converters are, let’s take a look at how to use them to interface 5V devices with our Particle board.

Using Shifter with Raspberry Pi

Let’s say that we’re using an I2C bus to communicate with various devices in a project and we want our Raspberry Pi to be on this bus too, but the logic level of the I2C bus is 5V, well we can use the Sparkfun logic level converter to connect our Raspberry Pi up to it. Bear in mind you can use this to interface with a sensor or output device as well, but because the I2C bus is capable of bi-directional communication, it highlights the bi-directional capabilities of the converter.

Raspberry Pi I2C to Arduino Uno logic level conversion

As you can see, it’s incredibly simple, and we’ve attached ground wires along with voltage taps from each board, then connected the SDA and SCL wires from each board to the converter which will take care of the voltages, and we can use the I2C bus to communicate bi-directionally without any danger of damaging the Raspberry Pi from the 5V.

The Sparkfun converter used in this tutorial is our favourite converter by far and because they’re so cheap, it’s well worth keeping a few on hand for projects of any kind.

Have a question? Ask the Author of this guide today!

Please enter minimum 20 characters

Your comment will be posted (automatically) on our Support Forum which is publicly accessible. Don't enter private information, such as your phone number.

Expect a quick reply during business hours, many of us check-in over the weekend as well.



Please continue if you would like to leave feedback for any of these topics:

  • Website features/issues
  • Content errors/improvements
  • Missing products/categories
  • Product assignments to categories
  • Search results relevance

For all other inquiries (orders status, stock levels, etc), please contact our support team for quick assistance.

Note: click continue and a draft email will be opened to edit. If you don't have an email client on your device, then send a message via the chat icon on the bottom left of our website.

Makers love reviews as much as you do, please follow this link to review the products you have purchased.