Logic level converters are used when one part of a project uses 5V logic and another part uses 3.3V logic. This is common when connecting older Arduino UNO-style boards to modern sensors, displays, ESP32 modules, RP2040 boards or XIAO modules.
Two common level-shifting approaches are BSS138 MOSFET-based bidirectional level shifters and TXS0108E automatic bidirectional level shifter modules. They may look similar in purpose, but they behave very differently. Choosing the wrong type can cause unreliable I2C, SPI or UART communication.
Why Logic Level Shifting Matters
A 5V microcontroller output can damage or stress a 3.3V device input if the input is not 5V tolerant. A 3.3V output may also not always be recognized reliably as HIGH by a 5V device, depending on the input threshold.
- 5V Arduino boards often use 5V logic
- ESP32, RP2040, RP2350, nRF52840 and many modern sensors use 3.3V logic
- I2C pull-ups must go to a safe voltage for all devices on the bus
- SPI and UART often need directional level shifting
- Power supply voltage and signal voltage are not always the same thing
Level shifting protects devices and improves signal reliability when different logic voltages are connected.
BSS138 MOSFET Level Shifter
The common BSS138 level shifter circuit uses a small N-channel MOSFET and pull-up resistors. It is widely used for bidirectional open-drain signals such as I2C.
- Simple MOSFET-based circuit
- Works well for I2C in many hobby and modular systems
- Bidirectional without direction-control pin
- Uses pull-up resistors on both voltage sides
- Good for slower open-drain communication
- Not the best choice for very high-speed push-pull signals
BSS138 level shifters are especially useful for I2C because I2C devices pull the bus low and release it high through pull-up resistors.
TXS0108E Automatic Level Shifter
The TXS0108E is an 8-bit automatic bidirectional level translator. It is often sold on modules as a general-purpose level shifter. It can be useful in some cases, but it is not a universal solution for every digital interface.
- 8-channel automatic bidirectional level translator
- No direction-control pin needed for each channel
- Can be useful for some low-drive bidirectional logic signals
- Can be sensitive to loading, pull-ups and cable capacitance
- Can cause problems with some SPI and I2C circuits
- Not a drop-in answer for all level shifting problems
TXS0108E modules are sometimes disappointing in real projects because automatic direction sensing and edge accelerators can interact poorly with certain buses, wiring and loads.
Main Comparison Table
| Feature | BSS138 MOSFET Level Shifter | TXS0108E Module |
|---|---|---|
| Typical circuit type | Discrete MOSFET plus pull-up resistors | Automatic bidirectional translator IC |
| Common channel count | Often 2, 4 or 8 channels depending on module | 8 channels |
| Direction control needed? | No for open-drain style signals | No, automatic direction sensing |
| Best for I2C | Good choice | Can work in some cases, but often less predictable with bus pull-ups and capacitance |
| Best for SPI | Not ideal for fast SPI; directional level shifters are usually better | Not always reliable for SPI, especially with heavier loads or longer wires |
| Best for UART | Can work at modest speeds, but simple resistor divider or directional shifter may be better | Can work, but not always the best choice |
| Main advantage | Simple, robust and well suited for I2C | Many automatic bidirectional channels in one IC |
| Main limitation | Pull-up based, not ideal for fast push-pull signals | Can be unreliable when used as a universal level shifter |
I2C Level Shifting
I2C is the classic use case for BSS138-style MOSFET level shifters. I2C lines are open-drain or open-collector style: devices pull the line low, and pull-up resistors bring it high.
This matches the BSS138 level shifter circuit very well.
- SDA and SCL can be shifted bidirectionally
- Both voltage sides have their own pull-ups
- Works well for many 5V-to-3.3V sensor and module connections
- Good fit for modular I2C systems
- Bus speed, pull-up values and wiring length still matter
For I2C, a BSS138-based module is often the practical and predictable choice.
SPI Level Shifting
SPI is different from I2C. Most SPI signals are push-pull and have fixed directions.
- MOSI goes from controller to device
- SCK goes from controller to device
- CS goes from controller to device
- MISO goes from device to controller
Because SPI signals have known directions, directional level shifting is usually better than automatic bidirectional level shifting. A buffer, translator or simple resistor divider may be more appropriate depending on speed and direction.
BSS138 level shifters can be too slow or too soft-edged for fast SPI. TXS0108E modules can also be unreliable with some SPI loads because automatic direction sensing is not always ideal for fast push-pull buses.
UART Level Shifting
UART signals are also directional. TX from one device connects to RX of the other device.
- 5V TX to 3.3V RX often needs level reduction
- 3.3V TX to 5V RX may work, but depends on the 5V input threshold
- A resistor divider can be enough for one 5V-to-3.3V UART line at modest speed
- A proper level shifter is better for reliable or higher-speed designs
For UART, the simplest correct solution is often a directional one. Automatic bidirectional level shifters are not always necessary.
Open-Drain vs Push-Pull Signals
The key concept is whether the signal is open-drain or push-pull.
| Signal Type | How It Works | Level Shifting Direction |
|---|---|---|
| Open-drain / open-collector | Devices pull the line low; pull-up resistors create HIGH level | BSS138-style bidirectional shifting works well |
| Push-pull | Output actively drives both HIGH and LOW | Use direction-aware buffer or translator |
I2C is open-drain. SPI and UART are normally push-pull. This is why the same level shifter is not always correct for every interface.
Why TXS0108E Can Be Problematic
The TXS0108E is often marketed as a universal level converter, but real circuits are more complicated. Its automatic bidirectional behavior can be sensitive to pull-ups, capacitive loads, long wires and devices with stronger output drivers.
- Not ideal for heavily pulled-up I2C buses
- Not ideal for long wires or high bus capacitance
- Can behave poorly with some push-pull SPI signals
- Can be confused by strong drivers or slow edges
- May work in one project and fail in another similar-looking project
This does not mean the TXS0108E is useless. It means it should not be treated as a universal cure for all logic-level problems.
Why Discrete BSS138 Level Shifters Are Still Useful
A discrete BSS138 level shifter is simple and predictable when used for the right type of signal. For I2C, it is one of the most common solutions.
- Good for SDA and SCL
- Good for many 5V-to-3.3V I2C sensor projects
- Easy to understand
- Easy to build into modules
- Less mysterious than automatic direction-sensing translators
For I2C modules, a BSS138-based level shifter is often more trustworthy than a generic TXS0108E board.
Choosing by Interface
| Interface / Signal | Better Level-Shifting Direction | Reason |
|---|---|---|
| I2C SDA and SCL | BSS138 MOSFET level shifter | I2C is open-drain and bidirectional |
| SPI MOSI, SCK, CS from 5V controller to 3.3V device | Directional level shifter or suitable buffer | Signals are push-pull and direction is known |
| SPI MISO from 3.3V device to 5V controller | Often direct if 5V controller recognizes 3.3V HIGH; otherwise use level shifter | Direction is known and voltage threshold matters |
| UART 5V TX to 3.3V RX | Resistor divider or directional level shifter | Only one direction needs reduction |
| UART 3.3V TX to 5V RX | Often direct, but check input threshold | Many 5V inputs accept 3.3V HIGH, but not all |
| Slow bidirectional logic line | Depends on signal type and load | Automatic level shifters may work, but must match the circuit behavior |
Pull-Up Resistors Matter
Pull-up resistors are an important part of I2C level shifting. Too weak, and the signal rises too slowly. Too strong, and devices must sink too much current.
- I2C bus capacitance affects rise time
- Longer wires need stronger pull-ups or slower bus speed
- Too many modules may place too many pull-ups in parallel
- Pull-up voltage must be safe for the connected devices
Level shifting does not eliminate normal I2C bus design rules.
Voltage Domains
A level shifter has two voltage sides. For example, one side may be connected to 5V logic and the other side to 3.3V logic.
- Connect the low-voltage reference to the low-voltage system
- Connect the high-voltage reference to the high-voltage system
- Share ground between both systems unless isolation is used
- Do not leave voltage reference pins floating
- Check that each side is powered correctly before signals are applied
Incorrect wiring can make a level shifter fail even if the part itself is suitable.
CANADUINO Discrete Level Shifter Modules
For practical I2C and mixed-voltage module systems, discrete MOSFET-based level shifters are often preferred over TXS0108E-style universal modules. CANADUINO level shifter modules use discrete BSS138-style channels to provide predictable bidirectional level shifting for suitable signals.
This approach is especially useful for I2C because it follows the same proven MOSFET level-shifter method widely used in sensor and microcontroller modules.
When to Use a BSS138 Level Shifter
- You need I2C level shifting between 5V and 3.3V
- You are connecting 5V Arduino boards to 3.3V I2C modules
- You need simple bidirectional open-drain level shifting
- You want a predictable circuit for SDA and SCL
- Your bus speed and wiring length are reasonable
BSS138 level shifters are usually the better choice for I2C.
When to Use TXS0108E Carefully
- You understand the signal type and loading
- The signals are within the device’s intended use case
- The wiring is short and clean
- The connected devices do not fight the automatic direction behavior
- You have tested the actual circuit under real conditions
The TXS0108E can work in suitable circuits, but it should not be selected only because it has many channels and says “bidirectional.”
When to Use Directional Level Shifters Instead
- Fast SPI signals
- Known one-way signals
- Clock lines
- Chip-select lines
- UART TX lines
- Signals driving heavier capacitive loads
When signal direction is known, a direction-aware translator or buffer is often cleaner than an automatic bidirectional level shifter.
Common Mistakes
- Using TXS0108E as a universal level shifter for every interface
- Using BSS138 level shifters for fast push-pull SPI without checking signal quality
- Forgetting that I2C pull-ups define the HIGH level
- Pulling a 3.3V I2C bus up to 5V by accident
- Not sharing ground between voltage domains
- Assuming 3.3V output is always accepted by every 5V input
- Ignoring cable length and capacitance
Which Level Shifter Should You Choose?
| Need | Best Direction | Why |
|---|---|---|
| I2C between 5V and 3.3V | BSS138 MOSFET level shifter | Matches open-drain I2C behavior well |
| Fast SPI from 5V controller to 3.3V device | Directional level shifter or buffer | SPI signals are push-pull and direction is known |
| UART 5V TX to 3.3V RX | Resistor divider or directional level shifter | Simple one-way voltage reduction is often enough |
| Many unknown mixed-direction signals | Do not guess; identify signal type first | The correct level shifter depends on electrical behavior |
| General I2C modular system | BSS138-based module | Predictable and compatible with common I2C level shifting practice |
| Automatic bidirectional module already installed | Test carefully under real conditions | Automatic translators can be circuit-sensitive |
When to Use Something Else
Sometimes a simple level shifter module is not the best solution.
- Use digital isolators when ground isolation is required
- Use RS485 or CAN for long-distance communication
- Use proper line drivers for cables or noisy environments
- Use optocouplers for some isolated slow digital signals
- Use a microcontroller that already matches the sensor voltage when possible
Conclusion
BSS138 MOSFET level shifters and TXS0108E modules are both used for logic level conversion, but they should not be treated as interchangeable universal parts.
- Choose a BSS138 MOSFET level shifter for I2C and other suitable open-drain bidirectional signals.
- Use TXS0108E-style automatic translators only when the signal type, loading and wiring fit the device behavior.
- Use directional level shifters or buffers for SPI, UART and other push-pull signals with known direction.
The best level shifter is selected by interface type, not by channel count. I2C, SPI and UART behave differently, so they often need different level-shifting approaches.
