How to use Logic Level Shifters

How to use Logic Level Shifters

If you need to use an Arduino that outputs 3.3v logic in a circuit that requires 5v logic signals, you can use a component known as a logic level shifter.

4-channel logic level shifter

I am using this component in circuits controlling addressable LED strips. A NodeMCU ESP8266 chip (which outputs 3.3v logic) can then be used to drive 5v logic signals to the LED strip.

This circuit requires:

  1. A logic level shifter to shift 3.3v logic signals to 5v.
  2. A 3.3v and 5v reference voltage to be applied across its pins.
  3. Which in turn requires a DC voltage converter to splice off 3.3v off of whatever your power supply generates. I only found out recently that the NodeMCU (and Arduinos) have a built-in DC voltage converter. It turns out you can connect any voltage 3.3-12V to the chip’s Vin and GND pins, and the built-in converter steps down the voltage to run the chip! This is great because we do not need our own voltage converter. Using a 5v power supply, we can connect the NodeMCU’s Vin to 5v and the NodeMCU creates a 3.3v voltage across its 3.3v pins. Voltage converter built in! Awesome!

How to wire LLS

The shifter has a high voltage and a low voltage side. LV1, LV2, LV3 and LV4 take in low voltage signals that you want to convert. You can input 4 independent signals to be stepped up to 5v. HV1 to HV4 are the corresponding output pins.

LV and GND on the low voltage side require the expected input signal voltage to be applied to it. In our case you would connect the Arduino’s 3.3v and adjacent GND pins to those pins respectively.

HV and GND on the high voltage side require the “high” potential to be applied to it. In our case that is +5v and ground, respectively.

The component then converts all incoming LV signals to the supplied HV voltage.

As we are working with different voltages here it is easy to mix them up and damage your components. Be very careul about connecting your wires correctly the first time.

How to get around not using LLS

Avoid using logic level shifters if possible. They complicate your circuit and add room for error.

It is a good idea to eliminate having to use a logic level shifter if it can be avoided at all. How? Different ways:

  • If you need to control 5V logic, get a controller that runs on 5v and outputs uses 5v logic on its pins. That way you don’t need to work with different voltages and theres no need to convert logic signals.
  • (for LED controller projects): Use of RGB adapters. These adapters take low voltage PWM signal (say 5v) and a target voltage (12V) on one side and automatically step up the signal to the required voltage. They are essentially compact circuits that integrate the DC voltage converter and transistors. This is a lot easier to use than creating a custom circuit. They are made to step up the PWM signal voltage to control common anode LED strips (which run on 12V). This makes for a much neater and simpler circuit than wiring your own MOSFETS.