Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Guides
  3. ›Prototyping & Wiring
  4. ›3.3 V vs 5 V Logic
Step 6 of 14 in Raspberry Pi and PicoPart of a learning path.
Next

How-to · Intermediate · 4 min read

3.3 V vs 5 V Logic

How to Level Shift Safely

By Geekobot Learning Team · Updated 24 Oct 2026

On this page
Short answerWhy 3.3 V and 5 V logic do not always mixWhich level-shifting method should you use?Build a 5 V to 3.3 V voltage dividerWire a BSS138 bidirectional level shifterWhich common modules need a level shifter with an ESP32 or Pico?Try itCommon mistakesFAQsParts and next steps
Short answer

You need level shifting when a 5 V device sends signals to a 3.3 V board such as an ESP32 or Raspberry Pi Pico, because 5 V on their pins can damage them. For one-way signals a two-resistor voltage divider works. For I2C use a BSS138 bidirectional shifter. For fast one-way data such as WS2812B LEDs, use a 74AHCT125 buffer.

Key specs at a glance

5 V boards
Arduino Uno, Mega, Nano (classic)
3.3 V boards
ESP32, ESP8266, Raspberry Pi Pico, Raspberry Pi 4 and 5
Divider for 5 V to 3.3 V
1 kΩ (series) + 2 kΩ (to ground) gives 3.33 V
BSS138 shifter
Bidirectional, good for I2C up to 400 kHz
TXS0108E
8-channel auto-direction, push-pull signals
74AHCT125
Fast one-way 3.3 V to 5 V buffer
01

Why 3.3 V and 5 V logic do not always mix

A digital pin sees "high" or "low" by comparing the voltage to thresholds set by its own supply. Two problems appear when you mix supply voltages:

5 V into a 3.3 V pin

exceeds the absolute maximum (about 3.6 V on ESP32 and RP2040) and can damage the pin over time or instantly.

3.3 V into a 5 V pin

usually safe, but may not count as "high". An ATmega328P needs at least 0.6 x VCC = 3.0 V, so 3.3 V works with little margin. A WS2812B needs 0.7 x 5 V = 3.5 V, so 3.3 V is out of spec and may glitch.

02

Which level-shifting method should you use?

MethodDirectionSpeedBest forAvoid for
Voltage divider (2 resistors)5 V to 3.3 V onlyUp to a few hundred kHzHC-SR04 echo, UART RX, 5 V sensor outputsSignals that go both ways, 3.3 V to 5 V
BSS138 MOSFET moduleBidirectionalUp to about 400 kHzI2C, slow UART, buttonsFast SPI, LED data
TXS0108E moduleBidirectional, auto-sensingUp to tens of MHz push-pullSPI, parallel busesI2C with strong pull-ups, long wires
74AHCT125 / 74HCT2453.3 V to 5 V onlyVery fastWS2812B data, 5 V shift registers5 V to 3.3 V
Do nothing3.3 V out to 5 V inAnyMany TTL inputs that accept 2 V as highInputs that need 0.7 x VCC (WS2812B, CMOS)
Voltage divider (2 resistors)
Direction:
5 V to 3.3 V only
Speed:
Up to a few hundred kHz
Best for:
HC-SR04 echo, UART RX, 5 V sensor outputs
Avoid for:
Signals that go both ways, 3.3 V to 5 V
BSS138 MOSFET module
Direction:
Bidirectional
Speed:
Up to about 400 kHz
Best for:
I2C, slow UART, buttons
Avoid for:
Fast SPI, LED data
TXS0108E module
Direction:
Bidirectional, auto-sensing
Speed:
Up to tens of MHz push-pull
Best for:
SPI, parallel buses
Avoid for:
I2C with strong pull-ups, long wires
74AHCT125 / 74HCT245
Direction:
3.3 V to 5 V only
Speed:
Very fast
Best for:
WS2812B data, 5 V shift registers
Avoid for:
5 V to 3.3 V
Do nothing
Direction:
3.3 V out to 5 V in
Speed:
Any
Best for:
Many TTL inputs that accept 2 V as high
Avoid for:
Inputs that need 0.7 x VCC (WS2812B, CMOS)
03

Build a 5 V to 3.3 V voltage divider

Connect the 5 V signal to a 1 kΩ resistor, then from the far end of that resistor connect a 2 kΩ resistor to ground. Take your 3.3 V signal from the joint between them: 5 V x 2 / (1 + 2) = 3.33 V. A 2.2 kΩ and 3.3 kΩ pair (giving 3.0 V) also works. Use resistors in the low kilohm range so the signal edges stay sharp.

04

Wire a BSS138 bidirectional level shifter

  1. 1
    Connect HV to 5 V and LV to 3.3 V. Both supplies must be present.
  2. 2
    Connect GND on both sides to a common ground.
  3. 3
    Connect the 5 V device's signals to HV1 to HV4 and the 3.3 V board's matching signals to LV1 to LV4.
  4. 4
    For I2C, wire SDA through one channel and SCL through another. The module's onboard 10 kΩ resistors act as pull-ups on each side.
05

Which common modules need a level shifter with an ESP32 or Pico?

ModuleNeeds shifting?Why
HC-SR04 ultrasonicYes, on ECHOEcho output is 5 V. Or buy the 3.3 V HC-SR04P.
PIR HC-SR501NoOutput is already 3.3 V.
WS2812B LED stripUsuallyData input needs 3.5 V. Often works without, but not reliably.
16x2 LCD with I2C backpackRecommendedBackpack pull-ups go to 5 V.
5 V relay moduleSometimesSome modules will not switch on at 3.3 V input.
DHT22NoRuns on 3.3 V directly.
SSD1306 OLEDNo3.3 V native, modules accept 3.3 to 5 V.
HC-SR04 ultrasonic
Needs shifting?:
Yes, on ECHO
Why:
Echo output is 5 V. Or buy the 3.3 V HC-SR04P.
PIR HC-SR501
Needs shifting?:
No
Why:
Output is already 3.3 V.
WS2812B LED strip
Needs shifting?:
Usually
Why:
Data input needs 3.5 V. Often works without, but not reliably.
16x2 LCD with I2C backpack
Needs shifting?:
Recommended
Why:
Backpack pull-ups go to 5 V.
5 V relay module
Needs shifting?:
Sometimes
Why:
Some modules will not switch on at 3.3 V input.
DHT22
Needs shifting?:
No
Why:
Runs on 3.3 V directly.
SSD1306 OLED
Needs shifting?:
No
Why:
3.3 V native, modules accept 3.3 to 5 V.
06

Try it: Voltage divider calculator

Change the values and the diagram and results update as you type.

07

Common mistakes to avoid

  • !Using a voltage divider on a bidirectional line such as I2C SDA.
  • !Using a TXS0108E on an I2C bus with 4.7 kΩ pull-ups; its auto-direction sensing misbehaves. Use a BSS138 module or PCA9306 instead.
  • !Forgetting to power both the HV and LV sides of a shifter module.
  • !Not connecting the grounds of both boards together.
  • !Assuming a 3.3 V board is safe because it worked once; 5 V damage can be gradual.
08

Frequently asked questions

Is ESP32 5 V tolerant?

No. ESP32 GPIOs accept up to 3.6 V. Shift any 5 V signal down before connecting it.

Can I connect a 3.3 V output to an Arduino Uno input?

Usually yes. The Uno reads anything above about 3.0 V as high, so 3.3 V works, though with little noise margin. It is never harmful.

Which level shifter is best for I2C?

A BSS138-based bidirectional module or a dedicated I2C translator such as the PCA9306. They handle the open-drain lines correctly.

Do I need a level shifter for WS2812B with an ESP32?

For reliable results, yes. Use a 74AHCT125 powered from 5 V, or power the first LED slightly lower through a diode so 3.3 V meets its threshold.

Can I use a voltage divider instead of a level shifter?

For one-way signals from 5 V to 3.3 V, yes. It cannot raise 3.3 V to 5 V and does not work for bidirectional lines.

Parts for this guide

  • 4-Channel Logic Level Converter (BSS138)
    ₹20View
  • TXS0108E 8-Channel Level Shifter
    ₹74View
  • Resistor Assortment Kit (30 Values)
    ₹33View
Shop Interface Modules

Calculators

Voltage divider calculator

Terms in this guide

Logic levelThe voltage that represents a digital high: 5 V on classic Arduinos, 3.3 V on ESP32, Pico and Raspberry Pi.Voltage dividerTwo resistors in series that output a fixed fraction of the input voltage.Open-drainAn output that can only pull a line low; a pull-up resistor makes it high. Used by I2C.Pull-up resistorA resistor from a signal line to the supply that keeps the line high when nothing pulls it low.GPIOGeneral-purpose input/output: a microcontroller pin that your code can read or drive.

Projects that use it

Put this into practice: 2 step-by-step builds in our project library use parts from this guide.

Intermediate · 2 hoursColour TFT weather dashboardView projectBeginner · 1 hourBig-digit room climate displayView project
Browse all 2 projects

Keep learning

Component guideBeginnerESP32 GuideThe ESP32 is a low-cost 3.3 V microcontroller from Espressif with built-in Wi-Fi and Bluetooth, used for IoT devices, smart-home controllers and web dashboards.5 min read · Boards & MicrocontrollersComponent guideBeginnerRaspberry Pi Pico GuideThe Raspberry Pi Pico is a low-cost 3.3 V microcontroller board, not a computer: it runs one program and has no operating system.4 min read · Boards & MicrocontrollersConcept explainerIntermediateI2C ExplainedI2C is a two-wire bus that lets one microcontroller talk to many sensors and displays using a data line (SDA) and a clock line (SCL).4 min read · Electronics FundamentalsComponent guideBeginnerHC-SR04 Ultrasonic SensorThe HC-SR04 measures distance from about 2 cm to 4 m by sending a 40 kHz ultrasonic pulse and timing the echo.3 min read · SensorsHow-toIntermediateWS2812B Addressable LEDs (NeoPixel)WS2812B LEDs (often called NeoPixels) contain a red, green and blue LED plus a tiny controller, so each LED on a strip can be set to any colour from one data pin.3 min read · Displays & LEDs

Sources

  • BSS138 datasheet (onsemi)
  • TXS0108E datasheet (Texas Instruments)
  • SN74AHCT125 datasheet (Texas Instruments)
  • ESP32 Series Datasheet (Espressif Systems)

Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

On this page
Short answerWhy 3.3 V and 5 V logic do not always mixWhich level-shifting method should you use?Build a 5 V to 3.3 V voltage dividerWire a BSS138 bidirectional level shifterWhich common modules need a level shifter with an ESP32 or Pico?Try itCommon mistakesFAQsParts and next steps
Need a hand?Ask Geeko AI which part fits your project, or talk to the Geekobot team.Ask Geeko AIHelp & support

Parts for this guide3 items · ₹127

4-Channel Logic Level Converter (BSS138) · TXS0108E 8-Channel Level Shifter · Resistor Assortment Kit (30 Values)

Ask the Community

Ask a question