From 4d01400eae77e6ca0485267b727b3fd58a8e6976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Bagur=20N=C3=A1jera?= Date: Fri, 5 Sep 2025 19:20:09 -0600 Subject: [PATCH 1/2] Content update (PWM section) --- .../tutorials/01.user-manual/content.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/content/hardware/03.nano/boards/nano-r4/tutorials/01.user-manual/content.md b/content/hardware/03.nano/boards/nano-r4/tutorials/01.user-manual/content.md index 0db6be1589..b000d3ff2f 100644 --- a/content/hardware/03.nano/boards/nano-r4/tutorials/01.user-manual/content.md +++ b/content/hardware/03.nano/boards/nano-r4/tutorials/01.user-manual/content.md @@ -733,6 +733,8 @@ You can open the Arduino IDE's Serial Monitor (Tools > Serial Monitor) to see th The Nano R4 board features multiple pins with PWM capability that can be used to generate analog-like output signals. PWM works by rapidly switching a digital output between `HIGH` and `LOW` states, where the ratio of `HIGH` time to the total period determines the effective analog voltage output. +***__PWM Compatibility Note__: The Nano R4 shares identical PWM capabilities with the UNO R4 Minima, as both boards use the same RA4M1 microcontroller. This includes the same default 8-bit resolution, maximum 16-bit resolution, and PWM frequency control features. Code written for PWM on the UNO R4 Minima will work identically on the Nano R4.*** + The Nano R4 board provides PWM functionality on the following pins: | **Arduino Pin** | **Microcontroller Pin** | **PWM Channel** | **Primary Function** | @@ -746,6 +748,12 @@ The Nano R4 board provides PWM functionality on the following pins: ***__Important note:__ Pins `A4` and `A5` also have PWM capability but are primarily used for I²C communication (SDA and SCL respectively). The onboard LEDs (`LEDR`, `LEDG`, `LEDB`, `LED_BUILTIN`) also support PWM for brightness control.*** +The Nano R4's PWM offers the following technical specifications: + +| **Specification** | **Value** | **Notes** | +|:------------------:|:----------------:|:------------------------------:| +| Default Resolution | 8-bit (0-255) | Standard Arduino compatibility | +| Maximum Resolution | 16-bit (0-65535) | Full precision control | You can use PWM pins as analog output pins with the `analogWrite()` function: @@ -753,12 +761,20 @@ You can use PWM pins as analog output pins with the `analogWrite()` function: analogWrite(pin, value); ``` -By default, the resolution is 8-bit (0 to 255). You can use analogWriteResolution() to change this, supporting up to 12-bit (0 to 4095) resolution: +**By default, the resolution is 8-bit (0 to 255)**. You can use analogWriteResolution() to change this, supporting up to 16-bit (0 to 65535) resolution: ```arduino analogWriteResolution(resolution); ``` +The Nano R4 supports the following PWM resolution options that you can configure based on your project's precision requirements: + +- `analogWriteResolution(8)`: 8-bit resolution (0 to 255, **default resolution**) +- `analogWriteResolution(10)`: 10-bit resolution (0 to 1023) +- `analogWriteResolution(12)`: 12-bit resolution (0 to 4095) +- `analogWriteResolution(14)`: 14-bit resolution (0 to 16383) +- `analogWriteResolution(16)`: 16-bit resolution (0 to 65535, **maximum resolution**) + ***The following PWM examples use the built-in orange user LED (`LED_BUILTIN`) of the Nano R4 board, which supports PWM for brightness control. This eliminates the need for external components and allows you to test PWM functionality immediately.*** The following example demonstrates how to control the brightness of the built-in orange user LED using PWM: @@ -873,7 +889,6 @@ void loop() { This high-resolution example creates a smooth sine wave pattern with the built-in LED brightness, demonstrating the precision available with a 12-bit PWM resolution. You should see a very smooth transition in the LED brightness following a sine wave pattern. Additionally, you can open the Arduino IDE's Serial Monitor (Tools > Serial Monitor) to see the angle and PWM value outputs that demonstrate the precise 12-bit control values being used. ![Arduino IDE Serial Monitor output for the high-resolution PWM example sketch](assets/pwm-3.png) - ### Operational Amplifier (OPAMP) The Nano R4 board features a built-in operational amplifier (OPAMP) that provides signal conditioning and amplification capabilities directly on the board. The OPAMP is connected to analog pins `A1`, `A2` and `A3`, allowing you to perform analog signal processing without requiring external amplifier circuits. This feature is particularly useful for sensor signal amplification, buffering and analog filtering applications. From 5627662bb22a9ca3500541b5ba618f2313a3d79c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Antonio=20Bagur=20N=C3=A1jera?= Date: Mon, 22 Sep 2025 23:43:19 -0600 Subject: [PATCH 2/2] Content review (Taddy's review) --- .../boards/nano-r4/tutorials/01.user-manual/content.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/hardware/03.nano/boards/nano-r4/tutorials/01.user-manual/content.md b/content/hardware/03.nano/boards/nano-r4/tutorials/01.user-manual/content.md index b000d3ff2f..69a89c98c7 100644 --- a/content/hardware/03.nano/boards/nano-r4/tutorials/01.user-manual/content.md +++ b/content/hardware/03.nano/boards/nano-r4/tutorials/01.user-manual/content.md @@ -746,7 +746,7 @@ The Nano R4 board provides PWM functionality on the following pins: | `D10` | `P103` | Channel 2A | Digital I/O, SPI CS | | `D11` | `P101` | Channel 5A | Digital I/O, SPI MOSI | -***__Important note:__ Pins `A4` and `A5` also have PWM capability but are primarily used for I²C communication (SDA and SCL respectively). The onboard LEDs (`LEDR`, `LEDG`, `LEDB`, `LED_BUILTIN`) also support PWM for brightness control.*** +***__Important notes__: Pins `D3` and `D9` share the same PWM channel (`Channel 0B`) and cannot be used for PWM simultaneously. When using PWM on one of these pins, the other cannot output an independent PWM signal. Similarly, pins `D6`, `D3`, and `D9` all use timer `GPT0`, which means they will share the same PWM frequency setting. The onboard LEDs (`LEDR`, `LEDG`, `LEDB`, `LED_BUILTIN`) also support PWM for brightness control.*** The Nano R4's PWM offers the following technical specifications: @@ -761,7 +761,7 @@ You can use PWM pins as analog output pins with the `analogWrite()` function: analogWrite(pin, value); ``` -**By default, the resolution is 8-bit (0 to 255)**. You can use analogWriteResolution() to change this, supporting up to 16-bit (0 to 65535) resolution: +**By default, the resolution is 8-bit (0 to 255)**. You can use the `analogWriteResolution()` resolution to change this, supporting up to 16-bit (0 to 65535) resolution: ```arduino analogWriteResolution(resolution);