level shifting
Level shifting is translating a digital signal from one voltage domain into another so two chips that run on different supplies can talk. It is like an interpreter standing between someone who speaks in 3.3-volt sentences and someone who only understands 5-volt ones — the meaning (HIGH or LOW) is preserved, but the loudness is converted. Modern boards are full of these boundaries: a 1.8 V processor talking to a 3.3 V sensor talking to a 5 V actuator.
Going from a lower voltage up to a higher one is the hard direction, because a 3.3 V HIGH may not clear a 5 V chip's input threshold. Several methods exist. A simple one is an open-drain output with a pull-up resistor to the higher rail: the chip only ever pulls the line low, and the resistor pulls it up to whatever rail you choose. A single N-channel MOSFET with pull-ups on both sides makes a neat bidirectional translator (the classic two-resistor-and-FET circuit used on I2C buses). For going down from a higher voltage to a lower one, a simple resistor divider or a series resistor into a clamp can do the job, and dedicated translator ICs handle many lines at once with controlled speed.
Why care? Get it wrong in the unsafe direction and you do real damage: feeding 5 V into a 1.8 V input can inject current into its protection diodes and slowly destroy the chip. Even when nothing burns, a marginal shift erodes noise margin and creates intermittent, maddening bugs. The honest tradeoffs are speed and direction: a pull-up resistor translator is cheap, but the pull-up plus wire capacitance slows the rising edge (an RC delay) and limits bus speed, and a plain divider only shifts down, not up. Choose the method to match the direction, the speed, and whether the line is bidirectional.
On a 100 kHz I2C bus, a 3.3 V master and a 5 V sensor share lines through a single N-channel MOSFET translator with 4.7 kΩ pull-ups to each side's rail. Each side pulls the line low; the resistors restore the correct HIGH for that side. Both ends read valid logic without over-volting either chip.
Same bits, different voltage — translate, do not just connect.
Never wire a higher-voltage output straight into a lower-voltage input and hope. Even if it reads correctly today, current through the input's clamp diodes can quietly degrade the chip over weeks.