Arduino UNO R4 - LED Strip
Discover how to program the Arduino Uno R4 to control 12V LED strips in this beginner-friendly tutorial. From single-color to RGB LED strips, learn to use relays for dynamic lighting projects. Here’s what you’ll learn:
- Step-by-step guidance on setting up Arduino Uno R4 with 12V LED strips
- Clear instructions for wiring relay modules to control single-color and RGB LED strips
- Practical Arduino code examples for LED strip control
- Insights into DIY electronics and home automation applications
- A second way with a MOSFET module, which turns a 1-color LED strip on and off and also dims it (brightness control with PWM)
A relay can only switch the strip fully on or fully off. A MOSFET module switches it too, without any click, and it can make the light brighter or dimmer.
Start your journey into Arduino programming and LED strip projects today!
Hardware Preparation
Or you can buy the following kits:
| 1 | × | DIYables STEM V4 IoT Starter Kit (Arduino included) | |
| 1 | × | DIYables STEM V4B IoT Starter Kit (Arduino included) | |
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Overview of LED Strip
A LED strip, also called LED tape or LED ribbon, is a flexible board with LEDs that shine light. These strips are flexible and used often for decorative lights in many places. LED strips are available in different colors and are mainly used to create a soft glow, highlight specific areas, or add decorative light effects.
LED strips are available in two primary varieties:
- Addressable LED Strips: In this type, you can control the color and brightness of each LED separately. Each LED has its own unique address that allows this individual control.
- Non-Addressable LED Strips: With these strips, you can change the color and brightness too, but the change affects all the LEDs on the strip at the same time.
This guide is about Non-Addressable LED Strips. For Addressable LED Strips, see the other guides provided.
- Arduino UNO R4 - NeoPixel LED Strip tutorial
- Arduino UNO R4 - WS2812B LED Strip tutorial
- Arduino UNO R4 - DotStar LED Strip tutorial
To dim a non-addressable strip, you can use a MOSFET module. Its pinout and its working are in the Arduino UNO R4 - MOSFET Module tutorial.
Relay vs MOSFET Module for a LED Strip
| Relay | MOSFET Module | |
|---|---|---|
| Light control | on or off | on, off, and brightness (PWM dimming) |
| Click sound | yes | no, silent |
| Reaction time | a few milliseconds | very short |
| Lifetime | contacts wear with each switch | long, no moving parts |
| Power type | AC or DC | DC only |
| Strip voltage | as the relay allows | 6V or more (12V and 24V strips are fine) |
| Isolation | yes, coil and contacts | yes, PC817 optocoupler |
| Best for | AC lights, plain on/off | DC strips that need dimming or fast effects |
For a 12V strip, the MOSFET module is the nicer choice because you can set the brightness. An RGB strip has three color pins (R, G, B), so it needs three MOSFET modules, one for each color, in the same way that it needs three relays.
Non-Addressable LED Strip Pinout
There are two main types of Non-Addressable LED Strips.
- Non-Addressable 1-color LED strip: Comes in only one color set by the manufacturer.
- Non-Addressable RGB LED strip: Can show many colors.
A Non-Addressable 1-color LED Strip typically has two pins:
- 12V/24V pin: Connect this to the positive pin of a 12V or 24V DC power supply.
- GND pin: Connect this to the negative pin of a 12V or 24H DC power supply.
A Non-Addressable RGB LED Strip typically has four pins:
- 12V/24V pin: Connect this to the positive pin of a 12V or 24V DC power supply.
- R pin: Use this pin for red color control. Connect it to the power supply's negative pin to activate red color.
- G pin: Use this pin for green color control. Connect it to the power supply's negative pin to activate green color.
- B come: Use this pin for blue color control. Connect it to the power supply's negative pin to activate blue color.

We will learn how to control both types using the Arduino UNO R4, one at a time.
How to Control a Non-Addressable 1-color LED strip.
When you connect a 12V LED strip to a 12V power supply, it will light up. To control this 12V LED strip using an Arduino UNO R4, you must use a relay. The Arduino UNO R4 controls the 12V LED strip through the relay. If you are not familiar with relays, such as their pinouts, functions, or programming, you can learn more by visiting the Arduino UNO R4 - Relay tutorial at Arduino UNO R4 - Relay tutorial.
Wiring Diagram.
Wiring Diagram between Arduino UNO R4 and Non-Addressable 1-color LED strip.

This image is created using Fritzing. Click to enlarge image
Wiring Diagram between Arduino UNO R4 and Non-Addressable RGB LED strip.

This image is created using Fritzing. Click to enlarge image
Arduino UNO R4 Code
Arduino UNO R4 Code for controlling Non-Addressable 1-color LED strip.
This code will continuously turn the LED strip on for 5 seconds and then off for 5 seconds.
Arduino UNO R4 Code for controlling Non-Addressable RGB LED strip.
The code below repeatedly changes the colors of the RGB LED strip (red, green, blue, yellow, magenta, cyan, and white).
Detailed Instructions
Follow these instructions step by step:
- If this is your first time using the Arduino Uno R4 WiFi/Minima, refer to the tutorial on setting up the environment for Arduino Uno R4 WiFi/Minima in the Arduino IDE.
- Wire the the LED strip to Arduino Uno R4 according to the provided diagram.
- Connect the Arduino Uno R4 board to your computer using a USB cable.
- Launch the Arduino IDE on your computer.
- Select the appropriate Arduino Uno R4 board (e.g., Arduino Uno R4 WiFi) and COM port.
- Copy the code provided above and paste it into the Arduino IDE.
- Click the Upload button in the Arduino IDE to transfer the code to your Arduino UNO R4.
- Observe the condition of the LED strip.
Code Explanation
The explanation is in the comments of the Arduino code above.
To adjust the brightness and colors of a non-addressable LED strip, we must use a driver like L298N driver instead of a relay.
Arduino UNO R4 Code - Dim LED Strip with MOSFET Module
Here a MOSFET module replaces the relay for the 1-color LED strip. The Arduino UNO R4 sends a PWM signal, and the strip gets brighter or dimmer.
Wiring Diagram between Arduino UNO R4, MOSFET Module and 1-color LED strip.

This image is created using Fritzing. Click to enlarge image
See The best way to supply power to the Arduino Uno R4 and other components.
- Arduino UNO R4 pin 9 → PWM pin of the module
- Arduino UNO R4 GND → GND pin of the module
- 12V adapter + → + terminal
- LED strip 12V pin → + terminal (shared with the adapter +)
- LED strip GND pin → LOAD terminal
- 12V adapter − → − terminal
An LED strip has no coil, so you do not need a flyback diode.
Arduino UNO R4 Code for dimming the 1-color LED strip.
The strip shines at full brightness for 2 seconds, then turns dark for 2 seconds. After that it fades up from 10% to 100% and fades back down to 0%, then the loop starts again.
Detailed Instructions
- Set up the Arduino IDE as described in the relay Quick Steps above.
- Wire the LED strip and the MOSFET module as in the diagram, with the 12V adapter unplugged.
- Upload the code to the Arduino UNO R4.
- Plug in the 12V adapter.
- Open the Serial Monitor and choose 9600 baud.
- Watch the strip become brighter and then dimmer, step by step.
Note: the MOSFET module only works with DC power, and the strip supply must be about 6V or higher. A 5V strip will not work well with it, and AC lights need the relay.