<< Click to Display Table of Contents >>

Navigation:  Bits and PCs Blog - 2025.11.19 >

5V to 3.3V Logic Level Translator using a 74HC4050 - 2025.06.07

Previous pageReturn to chapter overviewNext page

Many microcontrollers run with 5V logic, like the Arduino Uno and the ATMEGA 2560, but these days most chips and modules use 3.3V. Unless the 3.3V device has '5V tolerant' inputs, you cannot connect a 5V device to these 3.3V inputs because they can be damaged. To connect these together you need a logic level translator to drop the signal's voltage from 5V to 3.3V.

Sometimes you may have a digital or on/off signal which is up to 15V and you want to read this safely with your 5V or 3.3V controller. A logic level translator can be used here too.

When going the other way round, connecting a 3.3V output to a 5V input, you don't usually need a logic level translator because the 5V input will see a '1' from a 3.3V logic level.

A chip that's commonly used for this is the 74HC4050 Hex non-inverting high-to-low level shifter. This converts up to 6 inputs from a higher voltage to a lower voltage. For example, 5V->3.3V, or 12V->5V, or 9V->3.3V etc. To use this chip, connect the VDD pin (1) to the lower voltage of the device to receive the inputs, e.g. to 3.3V.

The inputs are Schmitt triggers, making the switching very fast and less prone to noisy signals.

mm74hc4045n

The 74HC4050 chip is no longer manufactured in a DIP-16 package (0.1inch/2.54mm pins), but you can still buy them online until stocks run out - on Ricardo.ch, ebay and Amazon. Experimenters and developers prefer the old DIP package because it's easy to use them with a breadboard. Whereas the tiny SOIC-16, SSOP-16 and TSSOP-16 versions must first be soldered onto an adapter board, which is difficult to do.

There are other ways to do logic level translation, even using a basic resistor divider, but these affect the signal and may not work for the high frequencies needed by SPI communications.

74HC4050 Data Sheets

DIP-16 version
MM74HC4050N-National-Semiconductor.pdf <= these are for sale on Ricardo, search for '74HC4050'

The modern (tiny) version
https://www.nxp.com/docs/en/data-sheet/74HC4050.pdf

 

Logic Level Translator Block Diagram

level-shifter-1

 

DIP-16 74HC4050 Pinout

74hc4050-pinout

Example Circuit

This is the circuit of a 3.3V SD Card Reader which uses this chip to interface it to a 5V microcontroller. The 74HC4050 chip has VDD connected to 3.3V.
The MISO output signal does not need conversion. The same circuit can be used to connect any 3.3V SPI device to a 5V controller.

sd-card-interface

This circuit is used in many 3D printer boards, like this Creality 3D V2.5.2 motherboard.
(I have reverse-engineered this undocumented Creality board and written new C++ code for it to control a coil winding machine.)

creality-3d-v2.5.2-board

 

For those wearing anoraks, here's the include file that defines the pins on this board:
  Pins_Creality_3D_V2_5_2.h   [Click to expand]

 

This is a typical SD card interface for a 5V Arduino:

arduino-sd-card-interface

 

Here's a SOIC-16 version of the 74HC4050 chip soldered onto a 0.1" adapter board with a bypass capacitor, but these are hard to find.
This one has 5V marked on it - that's just the lower voltage - it can be 5V or 3.3V.

74hc4050-module

 

Using a MOSFET

Here's a really simple solution using any cheap N-channel MOSFET with a Vgs(th) of 2V or a bit lower, e.g. BSS123 (an N-channel logic level enhancement mode field effect transistor). This works in both directions, but you must ensure that the higher voltage (5V) is connected to the MOSFET's Drain, and the lower voltage (3.3V) to the Source.
<never get your source and drain mixed up, especially if it's your water supply - ed>

https://www.onsemi.com/download/data-sheet/pdf/bss123-d.pdf

Here's my test circuit...

mosfet-logic-level-translator

 

Other chips you could use...

TXB0108 8-Bit Bidirectional Voltage-Level Translator with Auto-Direction Sensing
https://www.ti.com/lit/ds/symlink/txb0108.pdf

SN74LVC4245A Octal Bus Transceiver and 3.3V to 5V Shifter With 3-State Outputs
https://www.ti.com/lit/ds/symlink/sn74lvc4245a.pdf

SN74LVC245A Octal Bus Transceiver
https://www.ti.com/lit/ds/symlink/sn74lvc245a.pdf