Arduino Nano 33 IoT - LED Strip
This lesson will teach you how to code the Arduino Nano 33 IoT to control a 12V RGB LED light strip and single color 12V LED strip.

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 Strip
An LED strip, sometimes called LED tape or LED ribbon, is a flexible board with tiny LED lights attached. These strips are very useful and are usually used for creative lighting in different areas. LED strips come in many colors and are often used to add soft light, highlight special spots, or create attractive decoration.
There are two main kinds of LED strips:
- Addressable LED Strips: In these strips, you can change each LED's color and brightness separately because every LED has its own unique number.
- Non-Addressable LED Strips: In these strips, you can change the color and brightness, but all LEDs change the same way.
This guide will talk about Non-Addressable LED Strips. For tutorials on Addressable LED Strips, please see the ones listed below.
Non-Addressable LED Strip Pinout
Non-addressable LED light strips come in two main types:
- Basic single-color LED strip: The maker sets it to show only one color.
- RGB LED strip: It can display many different colors.
A basic one-color LED strip that cannot be controlled individually normally comes with two pins.
- 12V/24V pin: Connect this to the positive terminal of a 12V or 24V DC power supply.
- GND pin: Connect this to the negative terminal of a 12V or 24V DC power supply.
A basic RGB LED strip that isn’t individually controlled usually has four pins.
- 12V/24V pin: Connect this to the positive terminal of a 12V or 24V DC power supply.
- R pin: This pin controls the red light. When you connect it to the negative terminal, the red light turns on.
- G pin: This pin controls the green light. When you connect it to the negative terminal, the green light turns on.
- B pin: This pin controls the blue light. When you connect it to the negative terminal, the blue light turns on.

We will learn how to control both types using the Arduino Nano 33 IoT, one at a time.
How to Control a Non-Addressable 1-color LED strip.
When a 12V LED strip is connected to a 12V power supply, it lights up. To control the LED strip, we use a relay that sits between the Arduino Nano 33 IoT and the LED strip. The Arduino Nano 33 IoT sends commands through the relay to the LED strip. If you are not familiar with relays, their pins, how they work, or how to program them, check out the Arduino Nano 33 IoT - Relay tutorial.
Wiring Diagram.
Wiring Diagram between Arduino Nano 33 IoT and Non-Addressable 1-color LED strip.

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

This image is created using Fritzing. Click to enlarge image
Arduino Nano 33 IoT Code
Arduino Nano 33 IoT Code for controlling Non-Addressable 1-color LED strip.
The following code repeatedly turns the LED strip on for 5 seconds and then off for 5 seconds.
Arduino Nano 33 IoT Code for controlling Non-Addressable RGB LED strip.
The code below continuously changes the colors of the RGB LED strip (red, green, blue, yellow, magenta, cyan, and white).
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 the Arduino IDE to send the code to the Arduino Nano 33 IoT.
- Look at the LED strip to see its status.
Code Explanation
You can see the explanation in the comments above the Arduino code.
Remember, to change the brightness and colors of a regular LED strip, you need to use the L298N driver instead of a relay.