# 1.1V reference voltage (Nano)

**URL:** <https://forum.arduino.cc/t/1-1v-reference-voltage-nano/579140>\
**Category:** General Electronics\
**Created:** [March 11, 2019, 10:37pm UTC](https://forum.arduino.cc/t/1-1v-reference-voltage-nano/579140 "2019-03-11T22:37:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![v3xX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/v3xx/32/286102_2.png) [@v3xX](https://forum.arduino.cc/u/v3xX)\
**Post date:** [March 11, 2019, 10:37pm UTC](https://forum.arduino.cc/t/1-1v-reference-voltage-nano/579140/1 "2019-03-11T22:37:35Z")

</div>

Hello everyone.

I am trying to measure the reference voltage of my circuit. I have connected an ADC, a shiftregister, a few LED, thermistor, etc. to the chips. Everything is supplied using the Arduinos own 5V. This 5V are not always that stable. Therefore I wanted to measure the supply voltage back to itself.

I read in another topic

[http://forum.arduino.cc/index.php?topic=220044.0](http://forum.arduino.cc/index.php?topic=220044.0)

that it is possible to measure the external voltage using the internal reference (1.1V for Nano).

In idle mode (no leds are turned on) the measured voltage is 4830mV and my oscilloscope shows the same value. After turning on a few things the voltage drops a little e.g. 4810mV from the Arduino and 4785mV on the oscilloscope. At first I thought this was just a standardized error.

Connecting a MQ-2 Sensor (+5V-GND) the voltage drops to 4005mV on the oscilloscope but the reference on the Arduino shows 4630mV.

Does the 1.1V refer to the Arduinos power supply? Is it even possible to measure the 5V/3.3V output back to itself?

---

<div class="post-metadata">

**Author:** ![Coding\_Badly](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Coding\_Badly](https://forum.arduino.cc/u/Coding_Badly)\
**Post date:** [March 11, 2019, 10:41pm UTC](https://forum.arduino.cc/t/1-1v-reference-voltage-nano/579140/2 "2019-03-11T22:41:41Z")

</div>

> v3xX:  
> Connecting a MQ-2 Sensor (+5V-GND) the voltage drops to 4005mV on the oscilloscope but the reference on the Arduino shows 4630mV.

This is the moment you scribble a schematic on a sheet of paper, take a reasonably good quality picture of that schematic, then post the picture.

> v3xX:  
> that it is possible to measure the external voltage using the internal reference (1.1V for Nano).

It is...

> [@Measurement of Bandgap voltage](https://forum.arduino.cc/t/measurement-of-bandgap-voltage/38215):
>
> I was surfing the postings on AVRfreaks site and came across an interesting topic where someone asked how and if they could measure the battery voltage that was powering their AVR chip. There were the normal suggestions of using a voltage divider across the battery and changing the A/D reference to the internal 1.1 band gap option. But also mentioned was a way I hadn't heard of or had known about before. It seems with the proper analog mux channel selection made, one can directly measure the 1…

~~[https://forum.arduino.cc/index.php?topic=38119.0](https://forum.arduino.cc/index.php?topic=38119.0)~~

---

<div class="post-metadata">

**Author:** ![v3xX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/v3xx/32/286102_2.png) [@v3xX](https://forum.arduino.cc/u/v3xX)\
**Post date:** [March 11, 2019, 11:15pm UTC](https://forum.arduino.cc/t/1-1v-reference-voltage-nano/579140/3 "2019-03-11T23:15:00Z")

</div>

a sketch is attached.

[  
  ![](https://forum.arduino.cc/index.php?action=dlattach;topic=602999.0;attach=298890;image)  
 ](https://forum.arduino.cc/index.php?action=dlattach;topic=602999.0;attach=298890;image)

I used the code in your link

```cpp
int getBandgap(void)
    {
       
#if defined( __AVR_ATmega1280__ ) || defined( __AVR_ATmega2560__ )
    // For mega boards
    const long InternalReferenceVoltage = 1115L;  // Adust this value to your boards specific internal BG voltage x1000
        // REFS1 REFS0          --> 0 1, AVcc internal ref.
        // MUX4 MUX3 MUX2 MUX1 MUX0  --> 11110 1.1V (VBG)
    ADMUX = (0<<REFS1) | (1<<REFS0) | (0<<ADLAR) | (1<<MUX4) | (1<<MUX3) | (1<<MUX2) | (1<<MUX1) | (0<<MUX0);
#else
    // For 168/328 boards
    const long InternalReferenceVoltage = 1050L;  // Adust this value to your boards specific internal BG voltage x1000
        // REFS1 REFS0          --> 0 1, AVcc internal ref.
        // MUX3 MUX2 MUX1 MUX0  --> 1110 1.1V (VBG)
    ADMUX = (0<<REFS1) | (1<<REFS0) | (0<<ADLAR) | (1<<MUX3) | (1<<MUX2) | (1<<MUX1) | (0<<MUX0);     
#endif
        // Start a conversion 
    ADCSRA |= _BV( ADSC );
        // Wait for it to complete
    while( ( (ADCSRA & (1<<ADSC)) != 0 ) );
        // Scale the value
    int results = (((InternalReferenceVoltage * 1024L) / ADC) + 5L) / 10L;
    return results;
    }

```

and my result is now 459 (mV?).

The code I originally used was

```cpp
long internalVcc() {
    long result;
    // Read 1.1V reference against AVcc
    ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
    delay(2); // Wait for Vref to settle
    ADCSRA |= _BV(ADSC); // Convert
    while (bit_is_set(ADCSRA,ADSC));
    result = ADCL;
    result |= ADCH<<8; //result |= ADCH<<6;
    result = 1125300L / result; // Back-calculate AVcc in mV
    return result;

  }

```

which gives 4603mV (with the MQ2 connected -\> dotted line).

Since I do not understand what both codes exactly do, and still do not now if it is possible to measure the 5V-GND line back to the same Arduino I am a little stuck.

 ![referenceVoltage.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/0/3/c/03c8d1af9cb090614e2c40f79b0e794adc54545b.jpeg)

---

<div class="post-metadata">

**Author:** ![Wawa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wawa/32/1211303_2.png) [@Wawa](https://forum.arduino.cc/u/Wawa)\
**Post date:** [March 12, 2019, 12:08am UTC](https://forum.arduino.cc/t/1-1v-reference-voltage-nano/579140/4 "2019-03-12T00:08:26Z")

</div>

A thermistor/resistor is ratiometric.  
If you read that with a ratiometric A/D (default Aref), then the returned A/D value is independent of supply voltage.

If you read that thermistor/resistor with a constant voltage A/D (1.1volt Aref), then the thermistor becomes voltage dependent (bad).  
Leo..

---

<div class="post-metadata">

**Author:** ![Coding\_Badly](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@Coding\_Badly](https://forum.arduino.cc/u/Coding_Badly)\
**Post date:** [March 12, 2019, 12:36am UTC](https://forum.arduino.cc/t/1-1v-reference-voltage-nano/579140/5 "2019-03-12T00:36:09Z")

</div>

> v3xX:  
> and my result is now 459 (mV?).  
> Since I do not understand what both codes exactly do

> [@](#):
>
> 1. value is the voltage at AREF \*100

---

<div class="post-metadata">

**Author:** ![v3xX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/v3xx/32/286102_2.png) [@v3xX](https://forum.arduino.cc/u/v3xX)\
**Post date:** [March 12, 2019, 8:46am UTC](https://forum.arduino.cc/t/1-1v-reference-voltage-nano/579140/6 "2019-03-12T08:46:31Z")

</div>

As long as the supply voltage \>3.3V the reference voltage is high enough to supply the chips.

I have a correction to make. The answer from 'Coding Badly' leads to my solution.

> [@](#):
>
> It is...  
> [Measurement of Bandgap voltage - Development - Arduino Forum](https://forum.arduino.cc/index.php?topic=38119.0)

The voltage difference at the pins are 475 (4.75V). So it was not a problem from the measurement method, since the value at the +5V-GND is correct.

This sadly leads to my actually problem. I measured every point where I connect to the +5V supply line of my circuit and I noticed that I get different voltage level across the boards. I attached an exact copy of my schematic and the measure voltages between my elements and noticed voltage drops when the LED is turned on.

 ![voltagedrop.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/c/8/c/c8c2a7e92a05935797d34aec32c0db9235a06067.jpeg)

How can the voltage drop from 4.75V to different voltages if all elements are connected in parallel? Especially when current is drawn from the LED. It is only 20mA and is well in the confines of the Arduino and the shiftregister.

 ![voltagedrop.jpg](https://europe1.discourse-cdn.com/arduino/original/4X/c/8/c/c8c2a7e92a05935797d34aec32c0db9235a06067.jpeg)

---

<div class="post-metadata">

**Author:** ![v3xX](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/v3xx/32/286102_2.png) [@v3xX](https://forum.arduino.cc/u/v3xX)\
**Post date:** [March 12, 2019, 9:13am UTC](https://forum.arduino.cc/t/1-1v-reference-voltage-nano/579140/7 "2019-03-12T09:13:08Z")

</div>

Quick update:

1. In the post above the Arduino is powered via USB and the voltage drops are noticeable.

2. Now I power the Arduino using a stable power source 12V@6A (max draw) using Vin. The USB connections still persists to check the serial outputs and messages.

In case 2. the voltage drops only for a \<1ms and then stabilizes at 5.02V.

My conclusion is, that the power conversion from the USB alone is not enough to draw the power for the Arduino and all peripherals. I was always \>3.3V since the chips do not draw much power, but with other elements (LED, MQ2, ...) the power draw is between 20-150mA.

I will now try to design my circuit where I power all measurement elements (ADC, buttons,...) via the Arduino and all the elements that draw power with a separate line only connected via Common. I still can switch or measure the elements using their datapins, because their power draw is usually \<10nA.

Is this a good approach for designing such circuits?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 2:22am UTC](https://forum.arduino.cc/t/1-1v-reference-voltage-nano/579140/8 "2021-05-06T02:22:23Z")

</div>

Closed on May 6, 2021, 2:22am UTC


