Arduino Nano 33 IoT - Potentiometer LED
This guide shows you how to use the Arduino Nano 33 IoT and a potentiometer to change the brightness of an LED.
Hardware Preparation
Or you can buy the following sensor kits:
1 | × | DIYables Sensor Kit (30 sensors/displays) | |
1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Overview of LED and Potentiometer
If you're new to using the LED, Potentiometer, and Arduino Nano 33 IoT, please check out these tutorials:
These tutorials explain how LED and Potentiometer work, their pinouts, how to connect them to the Arduino Nano 33 IoT, and how to program Arduino Nano 33 IoT to work with the LED and Potentiometer.
Wiring Diagram

This image is created using Fritzing. Click to enlarge image
※ NOTE THAT:
Please note that the Arduino Nano 33 IoT pins A4 and A5 have built-in pull-up resistors for I2C communication. This can affect analog readings, so it is recommended to avoid using these pins with any devices/sensors that relies on ADC.
How To Program
- Reads the value from an analog pin (a number between 0 and 4095)
- Converts the brightness into a number between 0 and 255.
- Changes the LED's brightness.
Arduino Nano 33 IoT Code
Detailed Instructions
If you are new to the Arduino Nano 33 IoT, be sure to check out our Getting Started with Arduino Nano 33 IoT tutorial. Then, follow these steps:
- Connect the components to the Arduino Nano 33 IoT board as depicted in the diagram.
- Use a USB cable to connect the Arduino Nano 33 IoT board to your computer.
- Launch the Arduino IDE on your computer.
- Select the Arduino Nano 33 IoT board and choose its corresponding COM port.
- Copy the code above and paste it into the Arduino IDE.
- Click the Upload button in Arduino IDE to compile and send the code to the Arduino Nano 33 IoT board.
- Open the Serial Monitor in Arduino IDE.

- Turn the knob on the potentiometer.
- Watch the LED become dim.
- Look at the result on the Serial Monitor. It should look like this: