0

If I take an Arduino (samd21, if it matters) and plug in an analog sensor/pot into a digital pin and then set that pin to be an input, would digitalRead(#) trigger HIGH and LOW at some threshold point? Or does it not work at all?

1
  • I don't have the parts
    – rfii
    Commented Nov 7, 2021 at 1:34

2 Answers 2

4

According to SAMD21 the digital input pin detects HIGH if the voltage on pin is higher than 0.55 of supply voltage. So at 3.3 V it is 1.8 V.

The input pin detects LOW if the voltage is lower than 0.3 of supply voltage. It is 0.99 V at 3.3 V.

For voltages between these values (1 V to 1.8 V) the result can be HIGH or LOW.

4

Yes. If you read the datasheet you will find a set of voltage specifications. The ones you are interested in are VIH and VIL.

Most MCUs use a "Schmitt Trigger" for the inputs. This means that when the voltage rises above the HIGH threshold (VIH) the input switches to HIGH. When the voltage drops below the LOW threshold (VIL) the input switches to LOW. This "hysteresis" provides a certain amount of noise rejection to give a clean digital input signal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.