Take the 2-minute tour ×

A quick question about microcontroller digital level on I/O pins. I have a photo interrupter which is powered at 3.3V which is interfaced to Arduino UNO running at 5V.

For microcontroller to detect high or low level is determined by signal higher than 5V*(2/3) = 3.33V is high and signal lower than 5V*(1/3) is low. What I don't understand is that arduino is able to detect the level change from the photo interrupter. Doesn't the supply on pins have to be greater than (2/3) or Vcc in order for it to detect logic high? The circuit works and I am able to count pulses from the interrupter but I want to know why that works considering the photo interrupt only gets about 3.23V.

Please clarify

share|improve this question

migrated from electronics.stackexchange.com Apr 28 '14 at 2:34


2 Answers 2

up vote 9 down vote accepted

You've... misread the datasheet. The '328 input high voltage (VIH) for most pins is 0.6VCC minimum for devices with a 2.4-5.5V supply. This means that a 5V device has a 3V threshold.

share|improve this answer
You know the voltage at which the interrupter is connected is not a steady 3.3V. I was keeping track on the voltage and I saw it fluctuated to lowest value of 3.1V. Why doesnt it matter when the Threshold is 3V. The difference is only 0.1V. How come is still works? –  David Norman Apr 28 '14 at 2:45
The actual numerical difference is irrelevant. As long as the threshold is met, that's what counts. –  Ignacio Vazquez-Abrams Apr 28 '14 at 2:47
Awesome. Thank you. –  David Norman Apr 28 '14 at 2:50

The designed threshold of the '328 logic is 45% of Vcc for all supply voltages, except the tolerance reduces from +/-25% of Vcc {<3V} to +/-15% of Vcc{>3} This tolerance is due to temperature and process variation.

Keep in mind that the smaller the difference between the "actual" threshold and your input is your immunity to noise and it will work if there is low noise. Thus 45+15% = 60%* 5V=3V is guaranteed. What is not guaranteed, is the accuracy of your 5V regulator which if say 10% high will increase the threshold 10% above 3V or 3.3V. So then 3.1 would not be guaranteed. So ensure accuracy of 5 V is below 5.04 minus your noise immunity requirements.

share|improve this answer

Your Answer


