As you probably know, mixing 3.3V logic with 5V logic is usually a bad idea, but why and what if you need to do it anyway?
This topic is too complex for a single post, but let’s just start and see where it leads to:
VCC in these examples is the supply voltage, i.e. either 3.3V or 5.0V, depending on which chip we’re looking at. The goal being to connect a mix of these.
Digital I/O pins work by treating everything below a certain voltage as “0” and everything above another voltage as “1”. In between, the levels are undefined and could be interpreted either way, depending on temperature, stray capacitances, moon phases, who knows…
For the ATmega328, for example, everything between -0.5V and 0.3 x VCC is treated as “0” and everything between 0.6 x VCC and VCC+0.5V as “1”.
For 5V signals, that translates to: under 1.5V is “0” and over 3.0V is “1”, respectively.
Also relevant, is that unloaded output pins tend to be very close to the 0V and VCC ground and power supply levels, respectively.
So mixing is in fact not a problem at all for the following scenario: 3.3V levels for output signals, tied to 5V levels for the input signals. If all you need, is to read logic levels on say a 5V Arduino Uno from a 3.3V JeeNode, then just tie the signals together and you’re all set.
Connecting a 3.3V level output pin to a 5V level input pin works fine.
The problem occurs in the other direction: a “1” output on a 5V logic level is about 5V, whereas the maximum allowed input level for a “1” on a chip powered by 3.3V is 3.3+0.5, i.e. at most 3.8V.
Hooking these together without taking care of the problem will lead to problems, such as overheating chips and even smoke or fire (although this is almost impossible with simple battery- or USB-powered hookups).
Tomorrow I’ll describe the cause of these problems, along with some simple solutions.