Analog inputs A4 & A5 on Nano 33 BLE

Hi there,
I have a project using a Nano 33 BLE and I need 7 analog inputs. No need for I²C at all.
Chapter 2.2 of the Nano datasheet says:

"As opposed to other Arduino Nano boards, pins A4 and A5 have an internal pull up and default to be used as an I2C Bus so usage as analog inputs is not recommended"

Well, Not recommended is different from prohibited.
So, is there a mean to de-activate these pull ups and taking adantage of these 2 analog inputs ?
Does anybody here have used these two inputs as real analog ?
Thanks

may be by creating a new variant file where you would not activate the pull-up

Thanks JML for this quick answer.
Instead of creating a new variant, could I simply write the following code in setup:
Will the effect be the same ?

void setup() 
{
   digitalWrite(PIN_ENABLE_I2C_PULLUP, HIGH);
  
   /*  other application setup code here  */
}

I made a mistake on previous post. :slightly_frowning_face:
Do you think this instruction could be adapted ?

void setup() 
{
  digitalWrite(PIN_ENABLE_I2C_PULLUP, LOW);
 
   /*  other application setup code here  */
}

may be try doing the opposite of what they did in the the variant:

// disable I2C pullup and power that were activated @startup
  digitalWrite(PIN_ENABLE_SENSORS_3V3, LOW);
  digitalWrite(PIN_ENABLE_I2C_PULLUP, LOW);

  pinMode(PIN_ENABLE_SENSORS_3V3, INPUT);
  pinMode(PIN_ENABLE_I2C_PULLUP, INPUT);

those pins are defined here

Thanks for your suggestion.
I think we have to tell the compiler that we are dealing now with A4 as an input.

void setup() 
{
  digitalWrite(PIN_ENABLE_SENSORS_3V3, LOW);
  digitalWrite(PIN_ENABLE_I2C_PULLUP, LOW);
  pinMode(PIN_ENABLE_SENSORS_3V3, INPUT);
  pinMode(PIN_ENABLE_I2C_PULLUP, INPUT);

  pinMode(A4, INPUT;)
}

analogRead() does not require the pin to be made as an INPUT upfront (it will use it in the right way), this is just when using the pin in its so called digital capability, but it doesn't hurt to do so :slight_smile:

giving it a recognisable name would be good though.

const byte waterSensorPin = A4;    // use descriptive variable names
...
  pinMode(waterSensorPin, INPUT;)  // then use the name in the code

Thanks again J-M-L for your quick and precise answers.
Will now order the Nano 33 and make some testing on A4 & A5

duplicate you signal onto two analog pins and compare the readings. it will tell you if that works or not or if you get a bias.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.