Skip to content

Commit 959feaf

Browse files
committed
analog and pwm pins section added
1 parent 8b01e15 commit 959feaf

File tree

1 file changed

+75
-1
lines changed
  • content/hardware/03.nano/boards/nano-33-ble-sense-rev2/tutorials/01.user-manual

1 file changed

+75
-1
lines changed

content/hardware/03.nano/boards/nano-33-ble-sense-rev2/tutorials/01.user-manual/content.md

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ The Nano 33 BLE Sense Rev2's pins are organized into the following categories:
301301
| **Pin Type** | **Count** | **Pin Numbers** | **Primary Functions** |
302302
| :--------------: | :-------: | :-----------------------: | :----------------------------------: |
303303
| **Digital Pins** | 14 | `D0` - `D13` | Digital I/O, PWM (5 pins), SPI, UART |
304-
| **Analog Pins** | 8 | `A0` - `A7` | Analog input, Digital I/O, I²C |
304+
| **Analog Pins** | 8 | `A0` - `A7` | Analog input, Digital I/O, I²C, DAC (`A0`) |
305305
| **Power Pins** | 4 | `VIN`, `5V`, `3V3`, `GND` | Power supply and ground |
306306
| **Special Pins** | 2 | `RESET` | System control |
307307

@@ -381,6 +381,80 @@ digitalRead(pin);
381381
```
382382

383383
The available pin modes are `OUTPUT` for digital output, `INPUT` for digital input with high impedance, and `INPUT_PULLUP` for digital input with internal pull-up resistor enabled. Digital output values can be `HIGH` (+3.3 VDC) or `LOW` (0 VDC), and digital input readings will return `HIGH` or `LOW` based on the voltage level detected on the pin.
384+
385+
### Analog Pins
386+
387+
The Nano 33 BLE Sense Rev2 features **8 analog input pins** (`A0` to `A7`) that can be read using the `analogRead()` function. These pins allow you to measure continuously varying voltages, making them perfect for reading sensors like potentiometers, light sensors, temperature sensors and other analog components and devices. The analog-to-digital converter (ADC) built into the nRF52840 microcontroller of the Nano 33 BLE Sense Rev2 board converts the analog voltage into a digital value that your sketch can process.
388+
389+
The Nano 33 BLE Sense Rev2 analog pins provide the following functionality:
390+
391+
| **Arduino Pin** | **Microcontroller Pin** | **Additional Functions** | **Special Features** |
392+
| :-------------: | :---------------------: | :----------------------: | :------------------: |
393+
| `A0` | `P0.04` | DAC | 12-bit DAC output |
394+
| `A1` | `P0.05` | Analog In | Analog input only |
395+
| `A2` | `P0.30` | Analog In | Analog input only |
396+
| `A3` | `P0.29` | Analog In | Analog input only |
397+
| `A4` | `P0.31` | SDA (I²C) | I²C communication |
398+
| `A5` | `P0.02` | SCL (I²C) | I²C communication |
399+
| `A6` | `P0.28` | Analog In | Analog input only |
400+
| `A7` | `P0.03` | Analog In | Analog input only |
401+
402+
***__Important note:__ Pins `A4` and `A5` are primarily used for I²C communication (SDA and SCL respectively).***
403+
404+
The Nano 33 BLE Sense Rev2's analog pins offer the following specifications:
405+
406+
| **Specification** | **Value** | **Notes** |
407+
| :----------------: | :-----------: | :--------------------------: |
408+
| Input Voltage | 0 to +3.3 VDC | Maximum safe input voltage |
409+
| Default Resolution | 10-bit | Values 0-1023 |
410+
| Maximum Resolution | 12-bit | Values 0-4095 |
411+
| Default Reference | +3.3 VDC | AREF voltage |
412+
| Internal Reference | +0.6 VDC | Built-in precision reference |
413+
414+
You can read analog values using the `analogRead()` function:
415+
416+
```arduino
417+
value = analogRead(pin);
418+
```
419+
The default reference voltage of these pins is +3.3 VDC, but this can be changed using the `analogReference()` function. You can use `analogReference(AR_VDD)` for the default reference of +3.3 VDC, `analogReference(AR_INTERNAL)` for the built-in reference of +0.6 VDC, `analogReference(AR_INTERNAL1V2)` for the built-in reference of +0.6 VDC with 2x gain, and `analogReference(AR_INTERNAL2V4)` for the built-in reference of +0.6 VDC with 4x gain.
420+
421+
The default resolution is set to 10-bit, but it can be updated to 12-bit resolution using the `analogReadResolution()` function in the `setup()` of your sketch. Available options are analogReadResolution(10) for default 10-bit and analogReadResolution(12) for 12-bit for maximum 14-bit resolution.
422+
423+
### PWM (Pulse Width Modulation)
424+
425+
The Nano 33 BLE Sense Rev2 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.
426+
427+
The Nano 33 BLE Sense Rev2 board provides PWM functionality on the following pins:
428+
429+
| **Arduino Pin** | **Microcontroller Pin** | **PWM Channel** | **Primary Function** |
430+
| :-------------: | :---------------------: | :-------------: | :-------------------: |
431+
| `D2` | `P1.11` | Channel 0B | Digital I/O |
432+
| `D3` | `P1.12` | Channel 0B | Digital I/O |
433+
| `D4` | `P1.15` | Channel 0B | Digital I/O |
434+
| `D5` | `P1.13` | Channel 1B | Digital I/O |
435+
| `D6` | `P1.14` | Channel 0A | Digital I/O |
436+
| `D7` | `P0.23` | Channel 0B | Digital I/O |
437+
| `D8` | `P0.21` | Channel 0B | Digital I/O |
438+
| `D9` | `P0.27` | Channel 0B | Digital I/O |
439+
| `D10` | `P1.02` | Channel 2A | Digital I/O, SPI CS |
440+
| `D11` | `P1.01` | Channel 5A | Digital I/O, SPI MOSI |
441+
| `D12` | `P1.08` | Channel 0B | Digital I/O |
442+
| `D13` | `P0.13` | Channel 0B | Digital I/O |
443+
444+
***__Important note:__ . The onboard LEDs (`LEDR`, `LEDG`, `LEDB`, `LED_BUILTIN`) also support PWM for brightness control.***
445+
446+
You can use PWM pins as analog output pins with the `analogWrite()` function:
447+
448+
```arduino
449+
analogWrite(pin, value);
450+
```
451+
452+
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:
453+
454+
```arduino
455+
analogWriteResolution(resolution);
456+
```
457+
384458
## Support
385459

386460
If you encounter any issues or have questions while working with your Nano 33 BLE Sense Rev2 board, we provide various support resources to help you find answers and solutions.

0 commit comments

Comments
 (0)