Arduino Nano Every - Read Vcc?

Greetings,

In the past I have successfully used the information provided in this thread to read the Vcc using Arduino Nano: How to know VCC voltage in arduino ?

However my current project requires more RAM than Nano has so I've switched to using Arduino Nano Every instead. Is there a way to read the Vcc in a similar way to above i.e. code only?

What makes it look difficult?

The link from the Thread they are talking about Arduino which is quite similar to Arduino Nano, they are the same just different scales of ATmega328p chip. For measuring Vcc you need to use one of your Arduino analog input (labeled A0 ~ A7) to measure Vcc voltage.
If your program needs more RAM you need to change your Arduino Nano to a more powerfull processor like esp32 or Arduino Mega. Arduino Nano has only 2 Kilo Bytes of RAM compared to esp32 which is 520 Kilo Bytes.

Sorry for the confusing question. Let me try to rephrase:

I'd like to read the Vcc of the Arduino Nano Every board without any external connections. Code only if possible.

With the ATmega328p based Nano this was possible using the code in the link above but obviously it doesn't work with the Every board as it's based on a different chip.

The technique for internally reading Vcc on the AT328 family of chips will not work with the Nano Every (ATmega4809).

The method requires using Vcc as Vref and that setting is not available on the 4809

Bits 6:4 – ADC0REFSEL[2:0] ADC0 Reference Select
These bits select the reference voltage for ADC0.
Value Name Description
0x0 0V55 0.55V internal reference
0x1 1V1 1.1V internal reference
0x2 2V5 2.5V internal reference
0x3 4V3 4.3V internal reference
0x4 1V5 1.5V internal reference
Other - Reserved

Given the secret voltmeter won’t work , You could just use a voltage divider switched into circuit using a FET - switch divider on , measure vcc , switch off .

You could post your code up and see if it’s possible to reduce its memory requirements ( eg using the “F” macro)

Thanks for confirming my fears. I will seek alternative options.

The trouble is this was nearly a finished project which I designed around the old Nano. I had PCBs made for it so changing the electronics isn't that straightforward at this stage.

I've already optimised the code as much as I can using references where possible and avoiding hard coded strings etc. The project just has ballooned over time bigger than the Nano's tiny RAM can handle.

Anyway, I have an idea for a workaround. Just waiting for a second Every board to arrive so I can do more testing without dismantling my actual project...