Using a Level Shifter With the Raspberry Pi GPIO


The Raspberry Pi GPIO pins work with 3.3V logic levels and are not 5V tolerant. If you apply 5V to a GPIO pin you risk permanently damaging it. However, you can easily use 5V sensors or modules if you convert their 5V outputs to 3.3V using a level shifter. This ensures the GPIO pins on the Pi only see a maximum of 3.3V. The shifters are usually bi-directional so they can also be used to allow the Pi to trigger a 5V input with it’s 3.3V outputs.

Typical Level Shifter Module

A level shifter (also known as a logic level converter) will take 5V signals and convert them to 3.3V. This allows the Pi to read outputs from sensors that are only happy being powered from 5V. The modules are cheap and often provide 4 or 8 channels.

Logic Level Shifter Module

The channels consist of a pair of pins labelled HV1/LV1, HV2/LV2 etc. The “HV” stands for “high value” and “LV” stands for “low value”. Channel 1 consists of LV1 and HV1, Channel 2 is LV2 and HV2 etc. There are also two pins which must be provided with reference voltages so that the module understands what our high and low values are.

Example Level Shifter Circuit

In the example below a 5V sensor is connected to one channel on a 4-channel level shifter. The other 3 channels could be used for other sensor inputs.

Level Shifter Example Circuit

The level shifter is connected to both the Pi’s GPIO and the sensor output :

Level ShifterPi GPIOSensor
HVPin 2 – 5V
LVPin 1 – 3.3V
GNDPin 30 – GND
LV1Pin 32 (GPIO 12)

The sensor is powered from the Pi’s 5V supply with the output going to the first HV pin on the level shifter.

SensorLevel ShifterPi GPIO
GNDPin 34 – GND
5VPin 4 – 5V

Although I used GPIO12 you could use any of the Pi’s GPIO inputs. Similarly you can use alternative 3.3V and ground connections. Take a look at the Pi GPIO reference diagram to check what is available :

Raspberry Pi 40 Pin GPIO Header

Raspberry Pi 40 Pin GPIO Header

Multiple Channels

The level shifters provide multiple channels as they are often sold to be used with I2C or SPI devices where you would need to convert multiple signals per device.


When to use a level shifter :

  • You want the Pi to read logic levels that are above 3.3V
  • You are using a 5V module that doesn’t work properly using 3.3V and you have no choice but to use 5V

When you don’t need to use a level shifter :

  • The device is powered from 3.3V as its logic outputs will be 3.3V
  • The module is 5V but only takes inputs. The Pi’s 3.3V pins are usually fine for triggering devices that use 5V logic as they usually trigger with anything above 3V


In order for the circuit above to function correctly you need to make sure that :

  • the high-level (“HV”) side of the module is only ever connected to the 5V power or signal pins
  • the low-level (“LV”) side of the module is only ever connected to the 3.3V power or signal pins
  • the HV, LV and GND pins are connected to the 5V, 3.3V and Ground pins on the Pi’s GPIO

Buy a Level Shifter

You can buy level shifter modules from The PiHuteBay or Amazon for only a few £/$.

Look out for multiple packs. Given their low price you might as well buy 3-5 and keep some spares in your electronics box.


Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.