Arduino Nano - LED Module
This tutorial instructs you how to use Arduino Nano to control a 10mm LED module, a small board that is ready to plug in. Because the resistor and the driver are already on the board, the Nano needs only three wires to it. In detail, we will learn:
- How to connect Arduino Nano to the LED module (GND, VCC and IN pins)
- How to program Arduino Nano to blink the LED module and report its state on the Serial Monitor
- How to program Arduino Nano to set the brightness of the LED module with PWM, so it fades in and out

We suggest:
- Utilizing a bare LED with a resistor if you want to learn how the LED itself is wired and protected.
- Utilizing an RGB LED if you are looking to show many colors from one light. For more fade tricks, see Arduino Nano - LED - Fade.
Hardware Preparation
Or you can buy the following kits:
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Buy Note: Use the LED Module for easier wiring. It includes an integrated resistor.
Overview of LED Module
The LED module is a 10mm diffused round LED, mounted on a small black PCB of 20mm x 20mm. The pack comes with five colors: red, yellow, blue, green and white. Think of it as an LED that already has its resistor and its driver on the board. A 330Ω resistor limits the LED current, a 1KΩ resistor sits on the IN line, and a small transistor works as a switch. The LED takes its power from VCC, and the IN pin only tells the transistor to open or close. So the Nano pin gives only a tiny current, and you do not need to add any resistor.
| LED Module | |
|---|---|
| LED | 10mm, diffused, round |
| Colors in the pack | red, yellow, blue, green, white |
| Board size | 20mm x 20mm |
| Operating voltage | 3.3V to 5V DC |
| Control logic | active HIGH (IN = HIGH → LED ON) |
| Brightness control | yes, with PWM on the IN pin |
| Header | 3-pin, 2.54mm, right-angle, presoldered |
The LED Module Pinout

The 3-pin header is labeled GND, VCC and IN, in this order:
- GND pin: must be connected to GND (0V)
- VCC pin: must be connected to 5V (or 3.3V). This pin feeds the LED
- IN pin: must be connected to a digital output pin of Arduino Nano. HIGH turns the LED ON, LOW turns it OFF, and a PWM signal sets the brightness
※ NOTE THAT:
The arrangement of pins on a module may differ from one manufacturer to another. It is essential to always refer to the labels printed on the module when using it. Take a close look!
Wiring Diagram
The module gets its power from the 5V pin of the Nano, and its IN pin goes to pin D5, which is a PWM pin (marked with ~), so the same wiring works for both the blink code and the fade code.

This image is created using Fritzing. Click to enlarge image
See The best way to supply power to the Arduino Nano and other components.
| LED Module | Arduino Nano |
|---|---|
| GND | GND |
| VCC | 5V |
| IN | D5 |
How To Program For LED Module
No library is needed. Only the built-in Arduino functions are used.
- The first step is to specify the Arduino Nano pin that is connected to the IN pin of the module:
- Configure that pin as an output in setup() with pinMode():
- To set a brightness level, write a value from 0 (off) to 255 (full) with analogWrite():
Arduino Nano Code for LED Module - Blink
This first sketch turns the LED module ON for one second and OFF for one second, again and again. Each time the state changes, it prints a line to the Serial Monitor.
Detailed Instructions
- If this is the first time you use Arduino Nano, see how to set up the environment for Arduino Nano in Arduino IDE.
- Wire the components as shown in the diagram.
- Connect the Arduino Nano board to your computer using a USB cable.
- Open Arduino IDE on your computer.
- Select the Arduino Nano board and its COM port.
- Copy the above code and paste it into Arduino IDE.
- Click the Upload button to upload the code to the Arduino Nano.
- Open the Serial Monitor and set the baud rate to 9600.
- Look at the module: the LED lights up for one second, then goes dark for one second.
- See the result on the Serial Monitor:
Arduino Nano Code for LED Module - Fade
The second sketch uses PWM on pin D5. The brightness climbs from 0 to 255 in steps of 5, then drops back to 0 in the same steps. The LED stays dark for half a second, and the cycle starts again.
Detailed Instructions
- Keep the same wiring. Nothing needs to change, because D5 already supports PWM.
- Copy the fade code above and paste it into Arduino IDE.
- Click the Upload button.
- Watch the LED: it slowly gets brighter, then slowly gets dimmer, in a smooth "breathing" effect.
- The Serial Monitor shows when each half of the cycle starts:
※ NOTE THAT:
If the LED only blinks ON and OFF and does not fade, check that the IN wire is on D5 (or another pin marked with ~, such as D3, D6, D9, D10 or D11). On a pin without PWM, analogWrite() can only give fully ON or fully OFF.
Additional Knowledge
LED Module vs Bare LED
| LED Module | Bare LED | |
|---|---|---|
| Series resistor | on the board | you must add one (for example 220Ω) |
| Polarity | labeled pins (GND, VCC, IN) | you must find the anode (+) and cathode (-) |
| Current from the Nano pin | very small (the transistor drives the LED) | the full LED current |
| Brightness | fixed by the board, does not depend on the pin | depends on the pin and the resistor |
| Pins | 3 | 2 |
It is evident that the LED module is easier and safer for a quick indicator, while a bare LED is better when you want to learn the basics or save space.
Project Ideas
- A power or "system ready" light on the front of a box
- An alarm or fault light that turns red when a sensor reads a bad value
- A small traffic-light model with the red, yellow and green modules
- A heartbeat light that fades slowly while the Nano is running