Introduction: Arduino Controlled RGB LED Strip for the Living Room

The idea behind this little project was to have some pretty indirect mood light in the living room. It is controlled by the openHAB server (that project is still on the list to be added to this site) installed on a Raspberry Pi. Of course, the light can also be switched on from the smartphone/tablet/PC.

Because I'm not a programmer and I had a lot of hick-ups setting that thing up, I wasn't able to create the choice of lighting up just any color (for the breathing lights, more on that later), so I settled for a fixed color set on the Arduino. Also since openHAB basically controls the light, they can be programmed to switch on when coming home, getting up in the night, or even as an alarm light for water, unexpected visitors in the house or when the wife sets the house on fire ...again.

Material used

  • 1x circuit case (11cm x 11cm x 5cm in my case, however could be bigger), 7$
  • 1x Arduino Mini Pro 3.3V, 1.75$
  • 1x RFM69H (3.3V), 4.50$
  • 1x step-down 5V->3.3V (to run Arduino and the RFM transmitter), 0.35$
  • 1x 5V power supply (to run the step-down and the relays)
  • 1x PCB board 3cmx7cm (for example)
  • 2x 3 pin wiring connector, negligible $
  • screwable wiring connectors (like the black ones in the picture), negligible $
  • 3x 10kO resistors, negligible $
  • 3x STP16NF06 N-channel MOSFET, 0.35$ each
  • cables to connect everything; either connect with Duponts or solder... (AWG 26 for Arduino, AWG 20 or 22 for12V/RGB connections, AWG 18 for AC to the power supply), approx. 8$
  • 1x AC relay, 1.75$
  • 1x 12V 8A (100W) power supply (important note in the next steps!)
  • 1x RGB LED amplifier (another note in the next steps!)
  • 7m (23ft) RGB LED strip, specs of mine are 5050, 60 LEDs/m, 7.4W/m (for a 1m strip or even less)

Step 1: Some Important Notes

The power supply used is that one
The next time I'll take a smaller one, but the thing to say is that I first tried that 8A power supply
but it couldn't deliver more than 3A. So I'm not sure if I'm not able to use them or so.

Also the RGB amplifier used is a big one
It was able to take the Arduino signals and dim the light, as expected. The other RGB amplifier that I first tried (mini amplifier)
was not able to dim the signal directly from the Arduino (Arduino -> mini amp -> LED strip). It did however burn the AWG 26 cable connector into the wire connector, as seen on the picture.
However, connecting Arduino -> big amp -> 5m LED strip -> mini amp -> 5m LED strip, the mini amp could dim the 5m light correctly.

Step 2: How It Looks on Android

In the later steps you will see similar screenshots, but from PC.

Step 3: Putting the Things Together

In order to have good connections, I soldered everything together. The MOSFETs are soldered to the board with a pull-down and some Dupont pins. The black wire connectors are hot-glued directly to the board.

Because the LED strip is sticky-taped directly to the wood and the space is very limited, the delivered LED connectors had to be lost and AWG 22 cable were soldered to it.

For more infos on MOSFET and LED and stuff, check out some Adafruit pages or

Make sure to put the Arduino ground and the 12V ground together, or the LEDs will be at full power and not dimmable.

Step 4: LED Amplifier

As seen on the pictures, initially I wanted to use 1 amplifier for each strip, but for some reasons, I couldn't use them both or everything went dark. Since the amplifier is able to handle 12A, it should be way enough anyway. I will still need to disconnect it though...

Step 5: Arduino Code


Only the WDT (WatchDogTimer) and the RFM libraries are included. The WDT is used in case the Arduino hangs somewhere and with the WDT it would reset by itself. However with this box, the Arduino never lost itself until now.

The code is attached and should be more or less understandable. It is assumed that you know that stuff at least to half-way read it. The Arduino code might look familiar as it has been copied from different sources, modified and put together.

Don't get too picky on the NodeID; keep it 2 digits since you probably won't have more than 90 nodes in your house. Don't change the number of digits, or you will need to change it practically everywhere later.
Define the frequency band as given by the module you bought. The ChannelFreq might need to be adjusted to the standards where you live; the number is in Hertz.

// RFM69
#define NODEID 21 //unique for each node on same network Floor&Room&Node#=X&XX&X
#define NETWORKID 666 //the same on all nodes that talk to each other
#define GATEWAYID 1
#define FREQUENCY RF69_433MHZ
#define ENCRYPTKEY "1234567890ABCDEF" //exactly the same 16 characters/bytes on all nodes!
#define ChannelFreq 434520000

The message structure has to be the same on your whole network

typedef struct {        // Radio packet format
int nodeID; // node identifier
int devID; // device identifier
int cmd; // read or write
long intVal; // integer payload
float fltVal; // floating payload
char payLoad[32]; // string payload
} Message;

A device was defined for the LightSequence, the dim switch and the fadespeed

#define LEDDev 75
#define LEDDimmDev 76
#define LEDFadeDev 77

I think it's easier to send commands to.


Nothing special to mention. The digitalwrite and the color light-up at the end of the setup is an easy way to see the Arduino started up correctly. It also a quick way to see if all connections (especially to ground) were soldered ok.


It checks if some data was received through FM (more on that below).

If the data received says to switch to a pre-defined solid color, that one is set.

The single-blink codes are pre-defined too. There are 7 single colors to go high and low in repeated sets. The repeats, pauses between blinks and colors cannot be changed from openHAB. The LED light at full power.
Be aware when testing and lighting having the LEDs in your sight will definitely lead to headaches!
The dual-blink is very similar to the single-blink. It simply contains an "if loop more".
Both single and dual-blinks are not really optimal for the mood as you might go crazy. So better use them as alarm lights (red for fire, blue for water, red-blue for PIR set off when nobody home, etc.), or interface openHAB with the FritzBox and have blink yellow when the phone ring, and so on.

The color wave or breathing light is ideal for the mood. However, only "pure colors" (R,G,B, and the 3 mixes + white) are nicely to be waved. Otherwise you will have to do serious calculations on the Arduino and the colors will still not be nice. For ex. R255, G50, B100 cannot be dimmed nicely down to 0 because the numbers are not all 0 or 255.. If you begin testing that, you will know what I mean.

The big wave with ColorSet=80 is a modified code of the previous step's link. It has been modified to be run in a loop and "at the same time" (between dim-steps between the fade-speed intervals) listen to instructions from openHAB sent via FM.

Parse command

Depending on the values received in the FM data packet, different actions are taken.
Device 80 is the AC relay. Actually I'm not sure if it is really needed because if the color 0.0.0 is sent, the LED stays dark. I guess the power supply still uses a little power, and I feel more save knowing the AC is turned off.

Device 77 is defined as the FadeSpeed used in the color waves. It simply updates the variable which is then used in the next loop cycle.

Device 76 is used for dimming. Also it simply updates the variable which is then used in the next loop cycle.

Device 75 is used to set the LightSequence. The reason for doing it that way was that the light sequence can be chosen with a 2 digit number, whereas choosing a color via color-code would become quite complicated if you then want the color to fade. Solid colors and blinks shouldn't be that hard though.
Depending on the ColorSet, different variables are set differently.

To do in the next version of the Arduino code:

  • remove all delays and replace them with the same logic for the intervals between RFM send.
  • increase the default FadeSpeed to 200 or so, which is a less nervous light to watch...

Step 6: OpenHAB Code


The item configuration is quite straightforward.
The FadeSpeed_100, _10, _1 and Dimm_100, _10, _1 steps are used to set new values. It's easier to use a slider than buttons going up or down.
The icons cannot be included as they might have copyrights on them.


The power switch only powers off. Powering on is done by chosing one of the colorsets.


Don't mind about the imports, I'm not sure which ones are really needed for the LED strip.
The variables are used as it's easier to to change the variables than values in the code.
The 2 main rules LED_Strip_WZ_Dimm_xxx and LED_Strip_WZ_FadeSpeed_xxx are used to calculate the new values to send set with the slides.
Be aware that on a PC, the "slider" are represented with buttons.