Home > Projects > LED Projects > Nerd++: Controlling Dioder RGB LED Strips with Arduino, Pt. 1 – Getting Started

Nerd++: Controlling Dioder RGB LED Strips with Arduino, Pt. 1 – Getting Started

Summary of Nerd++: Controlling Dioder RGB LED Strips with Arduino, Pt. 1 – Getting Started


Summary: The article describes building an Arduino Mega2560 controller for IKEA Dioder color-changeable LED strips, wiring ULN2003 driver chips to PWM pins, powering the strips from a 12V adapter, and implementing a simple serial protocol to set RGB values for four strips. It also mentions an Xcode Cocoa app that sends color commands to the Arduino.

Parts used in the Arduino-based Dioder controller:

  • Arduino Mega2560
  • 12V AC-DC Adapter
  • A-B USB Cable
  • Male-Male Jump Cables (approximately 40)
  • ULN2003 DIP-profile chips (2 units)
  • Breadboard with at least 20 lanes
  • IKEA Dioder multicolour LED strips (four strips)

A few weeks ago, it came to my attention that IKEA do a set of colour-changeable LED strips. I’ve been looking for a decent way of providing some lighting behind my computer to reduce eye-strain for a long time, and these seemed perfect:

I was very pleased with them, but no self-respecting nerd would stop here. Especially one who’s seen Philips’ Ambilight technology in action!

Over a series of blog posts, I’ll be explaining how I built a simple controller for IKEA Dioder lights using an Arduino Mega2560 unit, then moving on to explore various ways to utilise this control in software for fun and awesomeness.

In this post, I’ll be building an Arduino layout that controls the Dioder LED strips, programming it to listen to messages on its serial port and set the LED strips’ colours accordingly, then making a simple Cocoa application in Xcode that sends messages to the unit to match the strips to colour wells in a window on-screen.Nerd Controlling Dioder RGB LED Strips with Arduino Pt 1 Getting Started

Note: If you see a paragraph starting with Tangent:, you can skip it without losing information on how to build this project.

I care not for your long and boring descriptions! Just give me the code and wiring diagrams!

You can grab the code over at the project’s homeon GitHub, which includes both Arduino sketches for uploading to the device and Xcode projects for controlling it. The Arduino sketches require the Arduino software and the Xcode projects were written on Mac OS X 10.7.

You can download a PDF wiring diagram here.

Enjoy!

Part 1: Creating the Arduino-based hardware layout

IKEA sell Dioder lights in a number of configurations — I went with the set that includes four multicolour strips, a control box and a power adapter (Store links: Sweden/UK/USA). The control box and power adapter won’t be used once they’re connected to the Arduino, though.

The Dioder LED strips have 12VDC on a common anode, with three return paths for the red, green and blue channels.

Ingredients (links to Swedish stores):

  • 1 x Arduino Mega2560 Link
  • 1 x 12v AC-DC Adapter Link
  • 1 x A-B USB Cable Link
  • ~40 x Male-Male Jump Cables (I got four packs of ten) Link
  • 2 x ULN2003 DIP-profile chips Link
  • 1x Breadboard with at least 20 lanes Link

The layout here is fairly simple — power the Arduino with the 12V power adapter, then tap into that for the anode on each LED strip. PWM pins 2-13 (0 and 1 collide with serial communication, which we’ll be using on this project) on the Arduino are connected to the ULN2003 chips, which act as relays for the red, green and blue cathodes from the LED strips. Finally, the ground pins on the ULN2003s are connected to the Arduino’s ground to complete the circuit.Nerd Controlling Dioder RGB LED Strips with Arduino Pt 1 Getting Started Schematic

Below are photos of the completed unit as well as a diagram of the wiring. You may notice that the wiring in the photos isn’t quite the same as in the wiring diagrams — that’s because I miswired the project when I took photos of it. All code and future projects are based on the wiring diagram.

You can download a PDF of the diagram here.

Part 2: Programming the Arduino

Rather than stepping through the process of listening to the serial port and controlling the PWM pins, I’m going to jump straight to what I implemented for the Arduino to listen to messages on its serial port and set the PWM output values accordingly. However, if you haven’t programmed Arduino before, I strongly recommend visiting the Arduino reference guides and looking at the sample projects included with the Arduino software to learn how it all works — it’s a lot of fun!

The protocol I implemented is very simple — two constant header bytes, 12 “body” bytes (one for each red, green and blue pin over four separate LED strips) and a checksum byte (a bitwise XOR of all the body bytes).

 

For more detail: Nerd++: Controlling Dioder RGB LED Strips with Arduino, Pt. 1 – Getting Started

Quick Solutions to Questions related to Arduino-based Dioder controller:

  • How is the Dioder LED strip powered in this project?
    The Dioder strips are powered from a 12V AC-DC adapter, with the Arduino also powered from the same 12V adapter.
  • Can the original IKEA control box be used with this project?
    No, the original control box and power adapter are not used once the strips are connected to the Arduino.
  • What component is used to switch the LED strip cathodes from Arduino PWM pins?
    ULN2003 DIP-profile driver chips are used as relays for the red, green, and blue cathodes.
  • Which Arduino pins are used for PWM control in this layout?
    PWM pins 2 through 13 are used; pins 0 and 1 are avoided because they conflict with serial communication.
  • How many LED channels are controlled by the protocol described?
    The protocol controls 12 body bytes corresponding to red, green, and blue channels for four separate LED strips.
  • What serial protocol structure does the Arduino expect?
    The protocol uses two constant header bytes, 12 body bytes (one per RGB channel per strip), and a checksum byte computed as the bitwise XOR of all body bytes.
  • Does the project include software to send color commands from a computer?
    Yes, the author created a simple Cocoa application in Xcode that sends messages to the Arduino to match on-screen color wells.
  • Where can the project code and wiring diagrams be obtained?
    The code and Xcode projects are available on the project home on GitHub, and a PDF wiring diagram can be downloaded from the project page.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top