SparkFun will be closed Thursday, November 24th and Friday, November 25th in observance of the Thanksgiving holiday. Any orders qualifying for [same day shipping] (https://www.sparkfun.com/support#Same-DayShipping) placed after 2pm (MT) on Wednesday, November 23rd will be processed on Monday, November 28th when we return to normal business hours. Wishing you a safe and happy holiday weekend from all of us at SparkFun!

Logic Thresholds

Digital devices speak the binary language of 0s and 1s, using those “bits” to build larger numbers and other data. Under the hood, these 0s and 1s are represented by different voltage levels. In a 5V system, a 1 is represented by a voltage near 5V and a 0 is represented by a voltage near 0V. Same thing for a 3.3V system; a 1 is represented by 3.3V, a 0 is 0V. These voltages are also commonly called "high" and "low," abbreviated H and L.

Consistent logic levels allow different parts to communicate with each other. One chip's H is another chip's H. But what happens if this voltage isn’t exactly 5V, due to power supply variations, noise, or long wires? What if it’s 4.5V, or even 2.5V? Datasheets can help us figure out whether any given voltage will read as a 0 or a 1.

Datasheets for digital parts will contain electrical specifications for logic thresholds, those voltage levels that represent a 1 or a 0. There will be specifications for outputs (what the chip generates to represent a 0 or a 1), and inputs (what the chip will read as a 0 or 1). The outputs are often called VOH and VOL (Voltage Out High/Low), and the inputs are called VIH and VIL (Voltage In High and Low). These numbers will appear in a table like this:

parameter minimum average maximum units
VIH 2.8     Volts
VIL     1.2 Volts
VOH 4.6 4.8   Volts
VOL   0.2 0.4 Volts

Why isn't the whole table filled in? The reason is that the most important numbers are the worst case numbers since that is what you should really be designing for. Thus the chip manufacturer will tell you the lowest H and the highest L that the part will successfully read. For the outputs, you'll also get an average value, which is the output value that most of a bin of parts will achieve, but there may be some manufacturing variability you should take into account.

The above chart gives exact input and output levels, but some parts are ratiometric, which means the outputs are a percentage of the supply voltage and the table will present these levels as percentages.

If you take the time to graph out all these numbers, you'll end up with something like this:

Note that on the input side, there is a gap between the highest L and the lowest H. This is a “no man’s land” where the part doesn’t know for sure whether an input is a 0 or a 1. To ensure that your circuit works reliably, stay out of this zone! You'll also notice that these H and L ranges extend a bit beyond VCC and GND; this is because the maximum input range may extend slightly beyond the supply rails, but always check the absolute maximum ratings to be sure and don't send signals above VCC or below GND if you can help it.

These numbers become very important when you want to interface two parts together, especially parts with different VCCs (power supplies). Can you interface a 5V part to a 3.3V part? The answer is...sometimes.

When you're talking about sending signals from a 3.3V part to a 5V part, there's no danger of the 3.3V part damaging the 5V part since the 3.3V signals will be within the 5V part's power supply rails. However, you need to check whether the logic thresholds line up. As long as the max VOL of the 3.3V part is within the VIL of the 5V part, and the min VOH of the 3.3V part is within the VIH of the 5V part, you'll be fine. And this turns out to be true much of the time: as the below chart indicates, we're close to the edge of the VIH minimum value, but since we're still within the manufacturer's specs, we're good to go:

When you're talking about sending signals from a 5V part to a 3.3V part, you have the added consideration that you'll be sending a higher voltage to a part (5V), than that part's own VCC supply (3.3V). Generally this is a bad idea. Chips usually cannot withstand input voltages much outside the range of their own VCC to GND and can be damaged by this treatment:

There are a few things you can do to solve this, however. 

Some 3.3V chips are built with 5V tolerant inputs, and can thus be interfaced directly to 5V signals. Unlike most parts, these can tolerate input voltages higher than their VCC:

If your 3.3V chip is not 5V tolerant (don't assume that it is until you check its datasheet), you could use a simple circuit called a voltage divider that will reduce the 5V signal to a 3.3V signal. Or, you can use a logic-level translation part such as our Logic Level Converter. These parts are designed to help interface chips with different voltages to each other.

If you read your datasheets carefully, you should be able to successfully interface anything to anything else (and without letting out the magic smoke)!

Sample Question:

If one chip has a minimum VOH of 4.0V, and another chip has a maximum VIH of 3.0V, should you connect these parts together?

A.  Yes!

B.  No!

C.  Maybe!

D.  Cheddar!


While Cheddar is a good answer to most questions, in this case the best answer is B: No, you should clearly not connect these parts together. The output voltage (VO) of the first chip is outside the range of the input voltage (VI) of the second chip.

Quiz Question - Logic Level III

A part has a maximum VIL of 2.0V and a minimum VIH of 3.0V. What logic level will the part interpret 3.5V as?

Please log in to save your answers