How to Convert 5V to 3.3V

Last Updated on March 5, 2025

When Interfacing Sensor with microcontrollers like the ESP32, STM32 and RP20240 etc., We face voltage level shifting problem, because these microcontrollers and some development boards GPIO pins operates in 3.3V that is it gives and receives maximum voltage level of 3.3V. While many sensors operates in 5V and gives 5V level Analog Signal or Digital output. Applying these 5V signal directly to an ESP32 or STM32 GPIO pins exceeds its maximum voltage rating and makes damage to the pin or the entire chip.




To solve this problem, we have to convert 5V signal from sensor output to 3.3V without changing the characteristics of sensor output signal. Here is the methods for converting 5V sensor to 3.3V.

  1. Voltage Divider
  2. MOSFET based Logic Level Shifter
  3. Dedicated Level Shifter IC

Voltage Divider

Voltage Divider is the simple passive method to step down 5V sensor output to 3.3V for slow analog signals. Connecting two Resistors in series divide the input voltage (here the input voltage of this voltage divider setup is Sensor Output Signal).

To find the exact value of R1 and R2 use the following Voltage divider circuit calculator. Here Input voltage is 5V (from sensor) and our required output voltage is 3.3V, and randomly choose R1 as 1KΩ, now you get R2 value from the calculator. (make it round value, because there will be tolerance in Resistor).

Voltage Divider Calculator

Voltage Divider Calculator

So we get R1 = 1KΩ and R2 = 2KΩ (Tolerance adjusted).

This is suitable for slow change signals, and not suitable for bi-directional protocols.

MOSFET based Logic Level Shifter

This is Bi-Directional Logic Level Shifter, It is ideal for digital sensor signals and communications., For communication between 5V logic development board and 3.3V development board (I2C or SPI) we can use MOSFET based bidirectional logic level converter. Mostly made with N-Channel MOSFET and pull up Resistors. BSS138 based breakout boards are available in the market with multiple channel support.

In this circuit you can see LV (Lower Voltage Side) and HV (Higher Voltage Side) just connect LV to 3.3V required boards and HV to 5V boards. Now voltage level shifting happens through MOSFET.

Dedicated Level Shifter IC

For multiple channels and High reliability, we can built logic level converter by using dedicated level shifter ICs. Like TXS0108E (8 Channel full duplex) or 74LVC245, these dedicated ICs comes with multi channel support, output enable, bi-direction & uni-direction communication.

You can use any of these method to make your 5V output sensor to communicate with 3.3V Logic GPIO pins.




Leave a Reply

Your email address will not be published. Required fields are marked *