# How to Level Shift 5V to 3.3V

In this tutorial, I show how you can shift a signal from 5V to 3.3V. This is very useful if you want to connect an Arduino (operates at 5V) to an ESP8266 (operates at 3.3V).

The following Figure describesÂ what we want to accomplish byÂ the end of this tutorial.

## Method #1 – Voltage Divider

Warning: This method works for slow signals, butÂ it’s not very reliable. I recommend using Method #2.

A voltage divider is a simple circuit which reducesÂ a large voltage into a smaller one.

Using 2Â resistors and an input voltage, we can create an output voltage that is a fraction of the input. Below you can seeÂ the formula that you need to use to calculate the resistors that you need in your circuit:

Solving the formula above with Vin=5V, R1=1000ohms and Vout=3.3V.

We get R2~=2000ohms.

So, here’s how the final circuit looks like:

## Method #2 – Bi-Directional Logic Level Converter

A Bi-Directional Logic Level Converter (LLC) also reduces the voltage from aÂ signal. This the recommended method to level shift signals that require high speed communication (serial at a high baud rate, I2C, etc…).

You can check this page to find the bi-directional logic level converter module best price.

You simply connectÂ the signal with the High Voltage to the HV pinsÂ and it outputs the signal with the lower voltage on the other sideÂ (LV). With the board shown in the Figure above you have 4 channels available.

Do you have any questions?Â Leave a comment down below!

Thanks for reading. If you like this post probably you might like my next ones, so please support me by subscribing my blog and myÂ Facebook Page.

#### SMART HOME with Raspberry Pi, ESP32, ESP8266 [eBook]

Learn how to build a home automation system and weâ€™ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB databaseÂ DOWNLOAD Â»
Learn how to build a home automation system and weâ€™ll cover the following main subjects: Node-RED, Node-RED Dashboard, Raspberry Pi, ESP32, ESP8266, MQTT, and InfluxDB databaseÂ DOWNLOAD Â»

### Recommended Resources

Build a Home Automation System from Scratch Â»Â With Raspberry Pi, ESP8266, Arduino, and Node-RED.

Home Automation using ESP8266 eBook and video course Â»Â Build IoT and home automation projects.

Arduino Step-by-Step Projects Â» Build 25 Arduino projects with our course, even with no prior experience!

## 18 thoughts on “How to Level Shift 5V to 3.3V”

1. Important information if you need to supply voltage from an Arduino Pro-Mini to an ESP8266.

Reply
• Hi! a simple code example, from esp32 to arduino mega, and from mega to esp32, please? just string form one to the other, bme sensor is too expensive , thanks a lot! If it wasnt for your examples, i would never have build a simple web werser page and home automation! greetings from argentina!

Reply
• “string FROM one the other” (cant edit the post)

Reply
2. …or method 3 – cheaper and more elegant if moving from bread-board to say prototype or strip board – using a couple of resistors and a mosfet.

Schematics here: i.imgur.com/RdGAN6D.jpg

Feel free to use. Enjoy your work – it is a great help for the Arduino beginner. Though (*cough*) I’ve spotted the odd programming error here and there that a C newbie may not be able to fix.

Reply
• Yes, That’s also another method Roy!
Thank you so much for taking the time to help. Have a great day,
Rui

P.S. Can you please submit those errors here? https://randomnerdtutorials.com/contact . I want to fix them đź™‚

Reply
3. In fact, the recommended level converter board is just the same resistor divider, only using 10k and 2x 10k resistors, therefore even slower than your 1k/2k divider due to the RC constant of parasitic capacitances of wires, breadboard etc. Those two transistors are there only to shift up. It is the worst converter board you can find on eBay. You can buy better, bidirectional (suitable for I2S) for the same price.
Will work OK for common UART bitrates, but not good enough for high speed protocols.
For SPI and other higher speed protocols I recommend to use a proper buffer/driver level shifter IC.

Reply
• Sorry, not I2S, but I2C of coruse đź™‚

Reply
• Hi Solipso,
Thank you for your feedback. You are right, that was exactly what I meant.
I’ve posted the wrong link and the wrong Figure.
I’ve updated the post with the bi-directional board and I’ve corrected the text.

Thank you again!
Rui

Reply
4. Extremely clear and helpful. Thanks for maintaining this page.

Reply
• You’re welcome Lucas,
Thanks!

Reply
5. Im using level shifter on a turbidity sensor and esp32. It gave me only 4095 readings. I knew that the sensor is ok because id already try it in arduino uno.. We all know that esp32 only accepts 3 v as input. Whats the problem with the level shifter or how can i fix it?

Reply
6. How to map 5V to respective 3.3V output rather than just level shifting in binary manner. Voltage divider is not efficient as it has a huge tolerance gap. I am using ESP32 and ACS712 sensor for current measurement with a voltage divider and it is not considerable accurate. Is there any other ways to convert it. The main constraint is that i am using it in a PCB which will be fitted behind the switch board. So, do you guys have any suggestions. Thank you in advance.

Reply
• You might need an op amp for that.

Reply
7. Does the logic level divider provide an analog output? I need to use a potentiometer that works well with an ESP32 and when I connect them up the readings are jittery but with an Arduino Uno they are rock solid. Will the level divider work for me?

Reply
8. Same problem here.
It seems LEVEL SHIFTER (board) doesn’t work for analog signals.

Reply
9. I got some 0-5V analog sensors that need to be read by esp32 (3.3V max), and this is the exact solution, thank you!

Reply

## Download Our Free eBooks and Resources

Get instant access to our FREE eBooks, Resources, and Exclusive Electronics Projects by entering your email address below.