# Switch to the Arduino's Internal Reference

**URL:** <https://forum.xod.io/t/switch-to-the-arduinos-internal-reference/1916>\
**Category:** Uncategorized\
**Created:** [February 25, 2019, 11:00pm UTC](https://forum.xod.io/t/switch-to-the-arduinos-internal-reference/1916 "2019-02-25T23:00:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![texmex](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@texmex](https://forum.xod.io/u/texmex)\
**Post date:** [February 25, 2019, 11:00pm UTC](https://forum.xod.io/t/switch-to-the-arduinos-internal-reference/1916/1 "2019-02-25T23:00:53Z")

</div>

I’m new to XOD but am loving it so far. I have one question at the moment, how do I switch the Arduino to use the Internal ADC Reference. I’m using an Arduino Nano so the MCU is the 328p and the command is "analogReference(INTERNAL).

Would I need to build a node or use the developer tools to add this line to a sketch.

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![texmex](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@texmex](https://forum.xod.io/u/texmex)\
**Post date:** [February 26, 2019, 9:11pm UTC](https://forum.xod.io/t/switch-to-the-arduinos-internal-reference/1916/2 "2019-02-26T21:11:06Z")

</div>

Anyone, I would really appreciate any help. Especially if I’m missing something really simple.

Thanks again

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [February 26, 2019, 10:20pm UTC](https://forum.xod.io/t/switch-to-the-arduinos-internal-reference/1916/3 "2019-02-26T22:20:42Z")

</div>

I have no idea what that is supposed to do, but worst-case, you can create a node and use not-implemented-in-xod with the following code:

```auto
struct State {
};

{{ GENERATED_CODE }}

void evaluate(Context ctx) {
    ::analogReference(INTERNAL)
}

```

Presumably this only needs to execute once during startup to apply some global setting in Arudino, so it just needs to exist in your patch and probably doesn’t need any pins.

---

<div class="post-metadata">

**Author:** ![texmex](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@texmex](https://forum.xod.io/u/texmex)\
**Post date:** [February 26, 2019, 10:41pm UTC](https://forum.xod.io/t/switch-to-the-arduinos-internal-reference/1916/4 "2019-02-26T22:41:44Z")

</div>

This sets the reference volatage for the ADC’s to the internal Band Gap Refernce that’s built in to the MCU. There is very little voltage drift on this so my readings will be much more accurate. In the case of the 328p the Vref is 1.1V.
