# Threshold Voltage and Hysteresis for Digital Inputs

Researching this forum, most replies mention 0.3Vcc for LOW (logic 0) and 0.6Vcc for HIGH (logic 1). Here's the results of some actual measurements on an UNO Rev3:

Description:

As the input voltage increases from 0V, the input is read as 0 and switches to 1 at 2.60V. As the input voltage decreases from 5V, the input is read as 1 and switches to 0 at 2.35V. Hysteresis is 0.25V.

Expressed in terms of Vcc:

``````Input low voltage   0.47 Vcc
Hysteresis          0.05 Vcc
Input high voltage  0.52 Vcc
``````

dlloyd: Researching this forum, most replies mention 0.3Vcc for LOW (logic 0) and 0.6Vcc for HIGH (logic 1). Here's the results of some actual measurements on an UNO Rev3:

I think those are meant as the guaranteed extreme values. As in you can always count on 0.6Vcc to read HIGH and 0.3Vcc to read low. The actual points may vary from chip to chip and IIRC that is even mentioned in the datasheet somewhere. But between those points I don't think anything is guaranteed and will probably vary from chip to chip and from application to application.

Yes, I agree. It covers the full temperature range and voltage voltage range for the MCU. The values I got are quite close to what these charts show at 25 deg and Vcc = 5V. EDIT: Except for hysteresis.

EDIT: Updated to refer to latest datasheet (thanks Delta_G):

[u]33.1.9. Pin Threshold and Hysteresis (page 391-392)[/u] Figure 33-25. I/O Pin Input Threshold Voltage vs. VCC (VIH, I/O Pin read as ‘1’) Figure 33-26. I/O Pin Input Threshold Voltage vs. VCC (VIL, I/O Pin read as ‘0’) Figure 33-27. I/O Pin Input Hysteresis vs. VCC Atmel-42735B-ATmega328/P_Datasheet_Complete-11/2016

Researching this forum, most replies mention 0.3Vcc for LOW (logic 0) and 0.6Vcc for HIGH (logic 1).

THEY ARE NOT THE CORRECT VALUES. Try reading the datasheet. And you are the first I've seen to give those values on this forum.

Mark

holmes4: THEY ARE NOT THE CORRECT VALUES. Try reading the datasheet. And you are the first I've seen to give those values on this forum.

Mark

Can you quote what you see in the datasheet? I've seen the values 0.3Vcc and 0.6Vcc a lot of places. Most notably table 30-1 in the datasheet. It lists EXACTLY those values except when the chip is running at really low voltages.

Link to the datasheet I have in case there is any confusion.

Again, I am talking about table 30-1.

Current datasheet section 30.2 table 30.1 for a chip run at 5v ,

gives

low as < than (VIL - first row) as 0.3Vcc (aka 0.3 * Vcc) or 1.5V and
high as >than (VIH - second row) as 0.6Vcc (aka 0.6 * Vcc) or 3.0V

With limits for how far bellow ground and above Vcc you can go.

Anything in between “floats” and gives an undefined result when read.

The xVcc notation instead of x * Vcc has been known to cause problems.

This is nowhere near dlloyd 's figures

Researching this forum, most replies mention 0.3Vcc for LOW (logic 0) and 0.6Vcc for HIGH (logic 1).

Mark

PS The datasheet link in the Uno’s documentation no long works (Atmel have moved and rewritten the datasheet.)

M

OK, I'm either misunderstanding your previous post or this one. You quote here low is less than 0.3 * Vcc and high is greater than 0.6 * Vcc. Which is exactly the same levels you just said were wrong (in all caps).

holmes4: PS The datasheet link in the Uno's documentation no long works (Atmel have moved and rewritten the datasheet.)

Yeah, I noticed. That's why I came back and linked to the current one.

You know, in math when we write 0.6x it means the same as 0.6 * x. Without the * is, by the way, exactly how it is written in the datasheet.

Anything in between "floats" and gives an undefined result when read.

Incorrect. It's always defined.

Within the hysteresis region:

• the result is 1 if previously above the hysteresis region
• the result is 0 if previously below the hysteresis region

Or were you thinking he was saying 0.3 volts and 0.6 volts? I don't think that is what he meant at all. I think he meant just what he wrote, 0.3Vcc (1.5V for 5V supply) and 0.6Vcc (3.0V for 5V supply).

dlloyd:
Incorrect. It’s always defined.

Within the hysteresis region:

• the result is 1 if previously above the hysteresis region
• the result is 0 if previously below the hysteresis region

For the sake of others, I am compelled to point out that this is only true because the AVRs have a Schmitt triggers on the digital inputs, which can be seen in the GPIO diagram in the dataheet. This is not generally true for other digital chips, you must consult the individual datasheet to figure out what features the digital inputs have. For pins without a Schmitt trigger, metastability will be a very real problem.

Thanks holmes4, Delta_G, Jiggy-Ninja (for pointing out the latest datasheet). I see the re-write is a lot more detailed. I like the addition of “Figure 33-27. I/O Pin Input Hysteresis vs. VCC” The older version didn’t have this. I may need to re-visit and do more testing, as I was getting 0.25V hysteresis but the new graph shows about 0.53V

I still want to know how this:

holmes4:
low as < than (VIL - first row) as 0.3Vcc (aka 0.3 * Vcc) or 1.5V and
high as >than (VIH - second row) as 0.6Vcc (aka 0.6 * Vcc) or 3.0V

is nowhere near this:

dlloyd:
Researching this forum, most replies mention 0.3Vcc for LOW (logic 0) and 0.6Vcc for HIGH (logic 1).

Let me cut that down more. @holmes4 is contending that

holmes4:
0.3Vcc

is nowhere near

dlloyd:
0.3Vcc

and

holmes4:
0.6Vcc

is nowhere near

dlloyd:
0.6Vcc

It looks like exactly the same thing to me. Even stated in the same way.

@holmes4 – Where’s the difference?

I'll do a more accurate test at higher precision (12-bit) using an Arduino Due to generate a slow triangle wave with 20µs step interval. On the Uno, this should give time to read pin 2 and output the result on pin 13. Hopefully the results will closely match the 3 graphs mentioned in reply#2. The Due can only output 1/6 to 5/6 of 3.3V (0.55V to 2.75V) ... should be enough to cross the thresholds.

Results:

``````                     VCC     Volts   [url=http://www.atmel.com/Images/Atmel-42735-8-bit-AVR-Microcontroller-ATmega328-328P_Datasheet.pdf]Volts (Datasheet Page 391)[/url]
Input low voltage    5.098   2.32    [color=teal]2.15  (Figure 33-26)[/color]
Hysteresis           5.103   0.36    [color=teal]0.55  (Figure 33-27)[/color]
Input high voltage   5.108   2.68    [color=teal]2.70  (Figure 33-25)[/color]
``````

Using the datasheet graphs with VCC = 5V,

the threshold levels of 2.15V and 2.7V are much more accurate than using 1.5V and 3.0V (0.3*VCC and 0.6*VCC).

This shows to scale the low, hysteresis and high level regions. Note how close the low and high thresholds actually are.

Also note that the hysteresis isn't centered at 2.5V. There's 150mV better noise margin for the high region. Therefore, when using interrupts, the noise immunity for FALLING mode would be better (by 150mV).

Just noticed (from the graphs) that the threshold levels of 0.3*VCC and 0.6*VCC occur [u]only[/u] when the supply is at the lowest voltage allowed, VCC = 1.8V 2.4V.

dlloyd: Just noticed (from the graphs) that the threshold levels of 0.3*VCC and 0.6*VCC occur [u]only[/u] when the supply is at the lowest voltage allowed, VCC = 1.8V.

Those threshold levels are given as maximums and minimums in the datasheet table, not as typical values. That's why the graph exists plotting it with reference to supply voltage.

Those threshold levels are given as maximums and minimums in the datasheet table, not as typical values. That's why the graph exists plotting it with reference to supply voltage.

Yes, they're given for the condition VCC = 2.4V - 5.5V, which happens to occur at the minimum voltage in this range (2.4V).

The graphs are the only way to go, but with the datasheet re-write, it would have been useful to specify what the threshold levels actually are (in voltage and without reading the graphs) at the common operating voltages of 5V and 3.3V.

UPDATED: Here's the best I could get from the graphs and using a format similar to the MC74HC14. The Temp=25°C trace was used (where visible):

``````[b] Symbol  Parameter                                Condition    Value [/b]

VIH     Positive−Going Input Threshold Voltage   VCC = 5.0V   2.63V
VIL     Negative−Going Input Threshold Voltage   VCC = 5.0V   2.08V
VH      Hysteresis Voltage                       VCC = 5.0V   0.55V

VIH     Positive−Going Input Threshold Voltage   VCC = 3.3V   1.70V
VIL     Negative−Going Input Threshold Voltage   VCC = 3.3V   1.33V
VH      Hysteresis Voltage                       VCC = 3.3V   0.37V
``````

Looks like you are still missing the most important part of this: your values are valid only for YOUR Uno, on YOUR workbench at room temperature. I can imagine the values change with temperature, voltage, current in other (nearby) pins...