How to read stable lithium voltage using adc ARef arduino

Hi there, i have wrote one code that reads a constant battery voltage irrespective of the current battery voltage. I want the system to function in such a manner that i can use the battery constant value in the sensor formula. For example:
int voltage = ((calling batt function) * Read sensor val/ 1024;

Note: The whole system will be working on a lithium battery (I am using arduino board just for prototype, if it works, ill be ussing attiny IC

My main problem is that i dont want to use analog pin to read constant battery voltage as i dont have any spare attiny pin.

Is it possible to use aref pin to get constant battery voltage.



void setup(){
  Serial.begin (115200);
}

void loop() {  
  //REFS1 AND REFS0 to 1 1 -> internal 1.1V refference
  ADMUX |= B11000000;   
  //We read A1 (MUX0)
  ADMUX |= B00000001;       
  // Start AD conversion
  ADCSRA |= B11000000;
  // Detect end-of-conversion
  while (bit_is_set(ADCSRA,ADSC));
  float val = ADCL | (ADCH << 8);
  val = val * 5.7; //Multiply by the inverse of the divider
  Serial.println(val);
}

IMG_20230213_122205_798

Please let me know if its possible to read const battery voltage using only AREf and not analog pin.

I know the if we program the AREf to be internally connected and we make any physical connections to it we can possibly damage our IC.

No.

Also, what happens over time when the Vbatt drops, how will Vbatt be constant if Vbatt is changing?

Hi, so only analog pin would work?

Don't believe me, give it a try for yourself and prove me right or wrong.

Due to their violation of forum rules, @electrogeeky has been permanently suspended from the Arduino forum.

Since there is no point in continuing this discussion, I am locking the topic.