This project was inspired by the mystic wildfire in Game of Thrones, a greenish liquid, which, when lit, exploded in green flames. The project concentrates on using RGB SMD5050 LED strips for customised colour effects. Three glass objects are equipped with a strip of six RGB LEDs each. An Arduino Uno creates a fire like flickering pattern for the lights. The RGB LEDs are needed to create a gradient colour pattern from dark green through bright green all the way to brightest white. A simple green LED is not enough, it needs the red and blue components to create bright white. As a bonus, this hardware can produce any other colours. The glass objects are needed to refract the light and disguise the actual light source, i.e. the small, very technical looking RGB SMD5050 LED strips.
The idea can be extended to as many objects you want and whatever dynamic colour scemes you want. This instructable describes how I implemented a setup with three glass objects with the following colour schemes. The wildfire scheme is seen in the introduction video. The rest of the schemes are seen in a video in the Step 6 page of this instructable.
- Wildfire. A Game of Thrones inspired fire like spectacle.
- Unicorn Attractor. A spectacle, which fades through the rainbow colours.
- Blink. Random change of colour in two different speeds.
- Fade. Smooth change of random colours in two different speeds.
- Living colours. Colour your objects with a light softly oscillating around one particuar colour.
- Candles. Have your LEDs imitate a natural candle flame.
In the basic setup you advance through the six colour schemes by a single button click. A double click will advance within one colour scheme from one setting to another, if applicable. Colour setups can be added by editing the Arduino program.
In a future extended version, the button is replaced by an ESP8266 board, which will interface to a web page, which will control the colour schemes. The web page in turn can be controlled with a mobile device browser. This gives much more variety in adjusting things:
- set the speed and direction of change
- set the colour for flickering candles
- set the brightness and saturation of the colours
This instructable focuses on the basic setup, which only includes a push button as the user interface.
Step 1: What You Need
- A cheap RGB LED strip, which you can cut into shorter strips
- A power unit, preferably the 12 V 1.5 A thing that came with the RGB LED strip
- An Arduino UNO or similar
- Two ULN2803AP IC:s
- A simple press button
- A Perma-Proto breadboard
- A box for the electronics
- Some glass objects to be lit by the RGB LED strips
- Tools (wire stripper, soldering iron, solder...)
The led strip
I bought a cheap led strip, which consists of some 90 RGB SMD LEDs. A small unit drives the leds, changing their colour. The unit is remote controlled and the strip can change colours in various ways. But the whole strip has the same colour. The fun thing is that you can cut the strip to small strips containing only three rgb leds in each strip. Each strip, no matter how long it is, is to be powered with 12 V. Each section of three rgb leds has its own set of resistors taking care of the voltage drop for the leds. You only have to provide the 12 V and enough of amperes, well, milliamperes. For this project, I use three strips of the led strip, which 6 units in each, and the 12 V 1.0 A power unit. The control unit and the remote controller are not needed.
A single led needs only little current. Usually you can light a led directly from an Arduino data pin, as long as you have a resistor that drops the data pin 5 V to some 3 V for the led. But a single RGB SMD5050 LED consists of three leds, a red, a gren and a blue one. And for this project, I am using strips of 6 RGB SMD5050 LEDs. One data pin of the Arduino Uno controls 6 LEDs. Only that would toast the data pin, if the power to light the leds would come from the data pin. But there will be in alles nine such data pins and that sure will be too much current for the Arduino. That's why the ULN2803AP kicks in. The ULN2803AP is an integrated chip with 8 darlington transistors. I need 9, so I just use two ULN2803AP chips. That leaves me with 7 spare transistors, if I want to extend the project to say five objects.
One single led inside the RGB SMD5050 LED draws 20 mA. Six of them would mean 120 mA. One pin (one darlington transistor) in the ULN2803 can sink 500 mA. But the whole chip can handle max 1.44 W of heat produced by the current. 120 mA produces 0.144 W. I'm putting five lines on one of the ULN2803 chips and four lines on the other. That will be 0.72 W on one chip and 0.58 W on the other chip. So I should be alright. Using all 8 lines of a ULN2803 with 120 mA on each would warm up the chip with 1.2 W. It would get hot, but it would still tolerate it.
Simply explained, the RGB SMD LED strip gets 12 V from the power source. From the LED strip, the current from each of the three colour LEDS goes to its own pin in the ULN2803AP and further to GND. The circuit is closed and the LED lights up. But the ULN2803AP is switched on/off by the 5 V data signals from the Arduino. These signals will draw just a few milliamps from the Arduino.
The glass objects
and the LED strips
I had these strange glass objects, which are meant for tea lights. I cut plates from birch logs for them to stand on and to have something to glue the LED strips on. I made some folds in the strips to make them into rings, where the individual LED units faced upwards. Be careful with the folds, so you don't cut the lines.
Step 2: User Instructions
The device will have a simple user interface. It turns on by plugging the power source in the wall socket and starts with the first colour scheme, which is the Wildfire. It turns off by unplugging. A button click will advance to next colour scheme. A double click will advance through the sub schemes of each colour scheme. I'm going to implement the following colour schemes:
- Wildfire. A Game of Thrones inspired fire like spectacle, where green flames travel from one glass object to the other ones. This effect will look most spectacular, when the glass objects are placed vertically to each other. Three different subschemes are implemented with varying pace of the flames.
- Unicorn Attractor. A spectacle, which fades through the rainbow colours. Fading happens in a rotating way, like each colour moves from one glass object to the next one. The subschemes will have varying speeds of the fade.
- Blink. Random change of colour in two different speeds. Subschemes will have varying palettes (only fully saturated colours, half saturated colours, colours from only a half of the colour circle)
- Fade. Smooth change of random colours in two different speeds. Similar subscemes as in #3.
- Living colours. Colour your objects with a light softly oscillating around one particuar colour. The subschemes will set the colours to red, orange, yellow, green, blue, indigo or purple. The oscillating happens inside a 10 degree sector around the chosen colour. The three glass object have the same chosen colour, but each object has its own randomly changing frequency of oscillating, to give the whole set a vibrant living colour.
- Candles. Have your LEDs imitate a natural candle flame. Three subschemes:
- "as calm as possible"
- "an open window somewhere"
- "it was a dark and stormy night"
Step 3: A Few Words About RGB Colours
In this section i discuss my view on the RGB colour space. You can quite well skip this section. I just give some background to why I treat the colours of the RGB LEDs like I do.
So the RGB LED has only red, green and blue light. Mixing these will create all the colours the human eye can recognise (almost). The amount of each part - red, green or blue - is in the digital world usually defined by a number from 0 to 255. A fully saturated colour needs one of the colour components to be zero and one colour component to be 255. In this sense we have only 1530 different fully saturated colours in our digital world.
One way of modelling the RGB space is a cube. One vertex of the cube is black. From that vertex we can travel along the red, the blue or the green edge. Any point in the cube is a colour defined by its red, green and blue coordinates. Travelling to the far most vertex from the black vertex, we come to the white vertex. Focusing on the six vertices excluding the black one and the white one, we can form a path that traverses all six vertices by following the edges. Each edge has 256 points or colours. Each vertex is shared by two edges, so the total number of points is 6 * 255 = 1530. Following this path is traversing all 1530 fully saturated colours in the colour spectrum. Or the rainbow. The vertices represent the colours red, yellow, green, cyan, blue and magenta.
Any other point in the cube represents a colour, which is not fully saturated.
- Either the point is inside the cube, meaning the red, green and blue coordinates all differ from zero. Think of the diagonal from the black vertex to the white vertex as the line of all grey shades. And all "not fully saturated colours" inside the cube are fading from full saturation at the edge towards this diagonal of "zero saturation".
- Or the point lies on one of the three plane surfaces of the cube touching the black vertex. Such colour could be considered fully saturated, but darkened. The more you darken it, the more it loses its percepted colour saturation.
Instead of having the six edge path around the cube describing all fully saturated colours, we can place these 1530 colours in a circle, where we have 255 different colours in a 60 degree sector - like when fading from red to yellow by adding green to it. Running through all colours in the colour circle is like sliding three colour controllers, one in a turn, while the other two are in opposite far most positions. Since I'm going to use the colour circle, or the rainbow spectrum, in some of the colour schemes, I'm going to define a colour (the hue) as a point in the circle, using my own 1530 scale:
1530 scale standard 360 scale ========== ================== red 0 0 orange 128 30 yellow 256 60 green 512 120 turquoise 768 180 blue 1024 240 indigo 1152 270 purple 1280 300 pink 1408 330
This 1530 scale simplifies converting rainbow colours into values for the RGB LEDs.
Why 255 colours in each section? Why not 256? Well, the 256th color of one sector is the 1st color of the next sector. You can't count that colour twice.
Yet a few words about PWM
A typical LED is designed to shine brightly at a given voltage. Lowering that voltage might drop the brightness, but the LED itself is not designed to be dimmable just by dropping the voltage. At half the voltage it might not even turn on at all. Instead, dimming is achieved by switching between full voltage and zero voltage. The faster the switching is, the less flickering the human eye can recognise. If the LED is half the time on and half the time off, the human eye perceives the light as if it shines with half the effect of a full bright LED. Adjusting the ratio between the time of full effect and the time of zero effect is what dimming a LED is all about. This is PWM, or pulse width modulation.
The cheap RGB SMD LED strip I bought for this project includes a device that takes care of the PWM. In this project I create the PWM with the Arduino UNO instead. The RGB colour space, as typically implemented in a computer screen, is a theoretical struct, where one imagines each colour channel holding a value from 0 to 255 and the luminosity of the channel would linearly follow the value. The graphic card of the computer might compensate for any abbreviation from this linear expectation that the actual leds might have. Whether or not the SMD LEDs used in this project follow linearly the PWM values used is not in the scope of this project. A PWM value of 255 creates the brightest light. But a value of 128 might not be a brightness percepted as half the brightness of 255. And 192 might not be percepted as a brightness exactly in the middle of 255 and 128.
Step 4: The Schematics
Here I present the schematics of the electronics. The photo shows how my connection looks. I've soldered the chips, the wires and the button onto a perma proto board. So far the components are just connected with the wires, but I leave it to you to design how to fit them in a nice box and how to draw the wires to the LED strips. If you find a 4 wire flat cable, use it, because one LED strip needs 4 wires. I only had 3 wire flat cable, so I needed an extra wire, which made it look a bit ugly.
Step 5: The Code
The code is written for an Arduino Uno. The Uno has only 6 PWM capable pins, but I need 9 of them. So I use a special PWM library written by Brett Hagman. This has to be installed in your Arduino IDE.
wildfire.ino is the main project file, it includes the setup() and loop() functions, as well as some other common functions for all schemes.
wildfire.h is the common header file.
The various scheme files can be pasted as separate tabs in the project.
Step 6: In Action
Step 7: Further Development
- Replace the single button interface with an ESP8266 to enable wireless contact with an Android phone, where the user interface is a web page for controlling the schemes.
- There are still some 70 RGB SMD LEDs left in the strip to be used. That's 24 strips with 3 in each. 24 more channels needs a new approach. It would need an Arduino Mega 2560 and some more ULN2803AP chips, alternatively two 16 channel servo boards, which are often used for LEDs.
- Unused are also the remote controller for the original LED strip, as well as its receiver. I haven't opened the receiver yet, but it could perhaps be reused somehow. One could let an Arduino hijack its logics and have it deliver numerical data to the Arduino to control the light show.