|
| 1 | +--- |
| 2 | +title: "About the analog pins on Nano RP2040 Connect" |
| 3 | +--- |
| 4 | + |
| 5 | +The microcontroller on the Nano RP2040 Connect has four analog pins, connected to A0–A3 on the board. The NINA-W10 multiradio module is used to enable analog inputs for the remaining A4-A7 pins on the standard Nano form factor. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Input and output capabilities |
| 10 | + |
| 11 | +**Pins A0–A3** are connected to the board's microcontroller (Raspberry Pi RP2040). These pins can be used like analog pins on most other Arduino boards: |
| 12 | + |
| 13 | +* Write to a pin with [analogWrite()](https://www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/) |
| 14 | +* Read from a pin with [analogRead()](https://www.arduino.cc/reference/en/language/functions/analog-io/analogread/) |
| 15 | + |
| 16 | +If possible, try to use these pins for your project. |
| 17 | + |
| 18 | +**Pins A4–A7** are connected to the NINA-W10 multiradio module. These pins have the following limitations: |
| 19 | + |
| 20 | +* They are read-only. You cannot write to these pins. |
| 21 | +* Pins A4 and A5 are used by the microcontroller to communicate with some onboard peripherals (I<sup>2</sup>C), such as the crypto chip (required for Cloud connectivity). Avoid reading from these pins if your project relies on I<sup>2</sup>C communication. |
| 22 | +* The input voltage range is [lower than the board's 3.3 V operating voltage](#voltage-range). |
| 23 | + |
| 24 | +The input/output support for the analog pins is summarized in this table: |
| 25 | + |
| 26 | +| Pins | In | Out | |
| 27 | +|-------|------|-----| |
| 28 | +| A0–A3 | Yes | Yes | |
| 29 | +| A5–A6 | Yes* | No | |
| 30 | +| A6–A7 | Yes | No | |
| 31 | + |
| 32 | +*_Pins A4 a A5 are used by the I<sup>2</sup>C communications bus. Reading from these pins is possible but doing so can interfere with onboard peripherals._ |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +<a id="voltage-range"></a> |
| 37 | + |
| 38 | +## Input voltage range |
| 39 | + |
| 40 | +The range of analog input values that can be read is different for the two sets of pins: |
| 41 | + |
| 42 | +| Pins | Voltage range | |
| 43 | +|-------|---------------| |
| 44 | +| A0-A3 | 0.0–3.3 V | |
| 45 | +| A4-A7 | 0.0–2.7 V* | |
| 46 | + |
| 47 | +_*With WIFINina firmware 1.4.8 or earlier, the range for these pins are 0.0–1.2 V. [Update the firmware](https://support.arduino.cc/hc/en-us/articles/360013896579-Check-and-update-the-firmware-for-WiFiNINA-and-WiFi101) to get the full 0.0–2.7 V range._ |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## Increase the analogRead resolution |
| 52 | + |
| 53 | +The `analogRead()` function returns 10-bit values (0–1023) by default. You can increase the resolution to 12-bit (0–4095) with the [analogReadResolution()](https://www.arduino.cc/reference/en/language/functions/zero-due-mkr-family/analogreadresolution/) function. Just add this code to your `setup()` function: |
| 54 | + |
| 55 | +```arduino |
| 56 | +analogReadResolution(12); |
| 57 | +``` |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +## Differential nonlinearity spikes on pins A0-A3 |
| 62 | + |
| 63 | +The analog-to-digital converter on the RP2040 microcontroller have spikes in DNL (Differential nonlinearity) errors at four values — 512, 1,536, 2,560, and 3,584, limiting performance in some cases. |
| 64 | + |
| 65 | +See errata RP2040-E11 (p. 627) in the [RP2040 Datasheet](https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf) for more information. |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +## Further reading |
| 70 | + |
| 71 | +* [Nano RP2040 Connect (Arduino Docs)](https://docs.arduino.cc/hardware/nano-rp2040-connect) |
| 72 | +* [NINA-W10 series data sheet](https://content.u-blox.com/sites/default/files/NINA-W10_DataSheet_UBX-17065507.pdf) |
0 commit comments