Stalker v3 : Limitations on using A4/A5 as inputs

Be aware that on the Stalker v3 that since A4 and A5 are also used for the I2C bus (SDA/SCL), and that the I2C bus uses a level translator for 5V operation, that if you specify A4 or A5 as INPUT in pinMode, they will be pulled-up to 3.3 V. Even using a 10K pull-down will only bring the pin voltage down to about 2.25 V, which will still be read as a logic HIGH when doing an digitalRead on the pin. Note that this behavior is not seen on the Seeeduino v4.2 boards, nor on standard Arduino boards. Both A4 and A5 function properly when used as OUTPUT pins, however.

Note that a workaround for using A4/A5 as inputs on the Stalker v3 is to define them in pinMode as INPUT_PULLUP. All that is required then is to connect the button switch between either A4/A5 and ground. In this mode, when the button is pressed, the pin state will be 0, when released, the pin state is 1. No external resistor is required. Note this does not permit the Grove button switch to be used on the I2C Grove socket on the Stalker, however, due to the power connection and the pull-down resistor built into the Grove button. If you want to use the Grove button, you can simply jumper the yellow and red wires on the switch and connect to A4/A5 and ground.

A bit more on using A4/A5 on the Stalker v3 with INPUT_PULLUP. As I described, this works fine, but be aware that in the LOW state, that because of the I2C level shifter, you will be sinking significantly more pin current. In the LOW state on A4 or A5 defined as INPUT_PULLUP, the sink current is about 1.8 mA, which is an effective pull-up resistance of only about 1.8K ohm. For comparison, if you define A0 as INPUT_PULLUP and measure the LOW state sink current, it’s only 96 uA, which corresponds to the expected value of the ATMEGA 328P internal pull-up resistance of about 35K ohm.