Circuits guide series

Logic level shifting

Digital electronics operate at specific voltages. For example, the Arduino Uno operates at 5V. The Arduino Due operates at 3.3V. How can we connect electronic components that operate at different voltages?

Many Arduino boards, like the Arduino Uno, operate at 5V. This means that they are designed to receive and transmit signals at the 5V level.

Other Arduino boards, such as the Arduino Pro and the Arduino Due, operate at the 3.3V logic level. These boards are better suited to mobile applications because they are more efficient.

Many peripherals, like sensors, displays, and integrated circuits, are operate at the 3.3V level. This means that even if they implement a communications protocol that the Arduino supports, you still have to consider how to connect them electrically.

Connecting a 5V device to a 3.3V device

Connecting a 5V signal from an Arduino to a 3.3V input of a sensor like the LSM303 magnetometer integrated circuit will most likely damage the IC (unless it is tolerant of the higher voltage).

Similarly, a 3.3V signal from the sensor to the Arduino Uno may or may not be read correctly. Any fluctuation below the 3V level will bring the signal too low to be correctly interpreted as HIGH by the Arduino.

For a 5V Arduino, the 3V is essential. As per the datasheet, any voltage above 0.6*Vcc is interpreted as HIGH. If your Vcc is precisely 5V, then any signal above 3V is HIGH. If your actual Vcc is a bit lower, then the cutoff voltage is affected accordingly. 

Logic level shifting methods

There are a few ways to deal with interfacing 3.3V and 5V devices.

A common method is the use of resistors configured as voltage divider. If you follow this path, you must be careful to accurately calculate the proper value of the resistors for the target voltage.

I think that the best way to go about this is to use bi-directional level shifters. These are devices specifically designed for this objective. They come assembled as breakouts, like this one from Adafruit.

Or, you can go with a standalone integrated circuit, like the 74LVC245 from Texas Instruments (datasheet).

Both options have two rows of pins, one for connecting to the 3.3V device and the other for the 5V device. Both are also designed to work with signals at the 1.8V and 2.8V levels. They simplify the circuit layout and take care of the details. 

You can use these level shifters to connect the Arduino to 3.3V computers like the Raspberry Pi and the Beaglebone Black. In general, these devices are more likely to be damaged if you connect their I/O pins to an incorrect voltage, so having a few logic level shifters around can save you money and time.

The Tech Explorations Subscription program

Subscribe and access all of our video courses immediately.

With a catalog of 25+ premium video courses (and growing), this subscription gives you an amazing resource to boost your learning.

New to the Arduino?

Arduino Step by Step Getting Started is our most popular course for beginners.

This course is packed with high-quality video, mini-projects, and everything you need to learn Arduino from the ground up. We'll help you get started and at every step with top-notch instruction and our super-helpful course discussion space.

Tech Explorations Arduino intermediate level

Done with the basics? Looking for more advanced topics?

Arduino Step by Step Getting Serious is our comprehensive Arduino course for people ready to go to the next level.

Learn about Wi-Fi, BLE and radio, motors (servo, DC and stepper motors with various controllers), LCD, OLED and TFT screens with buttons and touch interfaces, control large loads like relays and lights, and much much MUCH more.

We publish fresh content each week. Read how-to's on Arduino, ESP32, KiCad, Node-RED, drones and more. Listen to interviews. Learn about new tech with our comprehensive reviews. Get discount offers for our courses and books. Interact with our community. One email per week, no spam; unsubscribe at any time

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}