Arduino RGB LED strip control with MOSFETs and optocouplers – Part 1 – The Hardware

Today we tinker us a driver for RGB LED strips using an Arduino. In addition, we use optocouplers to separtae our Arduino from the control unit with the 3 MOSFETs, which is not absolutely essential, but brings some advantages to the circuit.

Arduino RGB LED strip control with MOSFETs and

Arduino RGB LED strip control with MOSFETs and optocouplers

Now you might naturally ask why build a control with an Arduino, since the RGB strips usually have a control unit with an infrared remote control. Here starts the problem, because different strip remotes may interfere with other strips, also it can be, that an existing TV control switch the strip in unexpected behaviour. So is using the default remotes not a good way.

Since our circuit has a serial control, you  can later use a Bluetooth connection to control the strip (or more), for example, via a smartphone.

But first, let us build the following circuit:

Zoom level:

1afbgchdie1j5510101515202025253030353540404545505055556060afbgchdiejLTV874Arduino Nano - - SVG created by Ronny Simon - All rights reserved.
Move over elements (parts, jumper cable etc.) for more information (or tap in touch mode)...

The circuit consists of a 4x optocoupler (LTV847), which is connected over three 390 Ohm resistors directly to our Arduino and with three other 10 kOhm resistors to +12V. (While we only need 3 optocouplers, the circuit contains 4 of them.)

Furthermore, in the circuit 3 MOSFETs with three 10k resistors are connected to ground the MOSFET type used here is a P16NF06,. Alternative types include, for example: the old and proven BUZ11, an IRL1404 or an IRFZ44N, just to name a few.

However, this is not supposed to lead to a “Which is the best MOSFET?” debate. To be safe for a 12V strip with 5 meters length, a MOSFET with a voltage V(DSS) of about 40-55V, a current I(D) of at least 20A and the smallest possible R(DSon) resistance in mOhm, would be an advantage. All MOSFETs mentioned above were tested with this circuit and a 5m strip, without leading to increased heat development or otherwise problems.

The RGB Strip has used a common anode, which should be true for most RGB LED stripes. Although the stripe has a common anode (+) the cable is usually in black, which may lead to confusion. On the stripe itself is has usually a “12+” printed on. The wires for the LED color red on the stripe, I have chosen in the circuit in orange, so there is no confusion with the positive pole. Of course, we still need a 12V power supply, which for a 5 meters stripe – in my opinion – should have about 60 watts, it is connected to the upper line voltage (note +/-). In the circuit the stripe is on one meter long. The Arduino is supplied over the USB port and is due to the optocoupler perfectly separated from the 12V, so there should be no problems.

Then we need a library for controlling RGB LEDs, which is still added to the Arduino libraries (this is a self-developed library and is in beta status – version 0.8).

Now upload the following program on our Arduino:

Source code (Sketch):

#include "simtronyx_RGB_LED.h"

#define REDPIN 3
#define GREENPIN 5
#define BLUEPIN 6

void setup() {

void loop(){


Download Source Code

If everything worked, the RGB strip should now permanently fade through all colors.

Since just simple fading would be quite boring, it will soon go further in the second Part of the series, where we will set via the serial interface, simple colors and different fading programs.



eBay: 12V 5A power supply
Breadboard jumper wires
Resistor 10k
Resistor 390
Amazon: 12V 5A power supply
Breadboard jumper wires
Resistor 10k
Resistor 390