I know that digital high and low are nominally 5v and 0v respectively, but what are the actual voltages that the Uno sees as high and low on input? I'm guessing a "high zone" of (say) 3-5 and a "low zone" of (say) 0-2 and a "no-man's-land" in the middle?
Reason I'm asking is that I have a sensor that looks like it outputs about 3v to my DMM. I haven't tried it to a digital pin yet because the Uno is currently deployed in my daughter's robot.... (Note to self: might need to buy another one so we can have one each $)). I guess if its high output is too low I could use it on an analog input, and set a level in the 0-1023 range as the threshold.
But I'm interested to know what the digital voltage high / low levels really are.
It is in the data sheet and is related to the supply voltage. Off the top of my head it is about 0.7 Vcc for a one or greater and less than 0.3 Vcc for a zero.
For an Uno, it is about <0.3Vcc for low, and >0.6Vcc for high (about 3V)
If it is too low, then your best bet would be either the analog comparator (with reference of 1.1v), or a simple mosfet level shifter (any n-channel enhancement MOSFET, and a 10k resistor).
EDIT: Form the datasheet:
Input Low Voltage, except
XTAL1 and RESET pin
Vcc = 1.8V - 2.4V MIN = -0.5 MAX = 0.2Vcc
Vcc = 2.4V - 5.5V MIN = -0.5 MAX = 0.3Vcc
Input High Voltage, except
XTAL1 and RESET pins
Vcc = 1.8V - 2.4V MIN = 0.7Vcc MAX = Vcc+0.5
Vcc = 2.4V - 5.5V MIN = 0.6Vcc MAX = Vcc+0.5
Thanks chaps..... I'll test it on a digital pin (I have negotiated time on the Uno and may have to sacrifice 2 cable ties to get it loose, more $)), but at least I now know what the 0-1 levels are likely to be.
If it's too low I'm happy to use it on an analog pin.
With +5V power supply 2.2V low and 2.7V high. Your 3V sensor should be reliable detected as high.
With +5V power supply 2.2V low
No you do not get a low,it has to be below 1.5V for a logic zero.
AtMega is not regular logic type IC, it has “build-in” Schmitt Trigger on each input.
I agree with Magician.
I mesure hystérésis on an UNO board.
I don't have the results with me but hysteresis was only a few mV.
I think a larger hysteresis would have been better.
Well those last two responses meant very little to me, but thanks anyway 8)
Main thing is, I now know there are three zones of high, low and no-mans’-land. If the sensor’s high is too low I’ll cheat and use an analog input.
Thanks for all the replies,
I don’t have the results with me but hysteresis was only a few mV.
All digital pins will show some form of hysteresis. It does not detract from the fact that the data sheet give a specific value for a guaranteed logic zero.
Sure you will get a logic zero at other voltage levels like you measured but they are not guaranteed.