Chained Mood-light Using High Power RGB LEDs
by dedehai in Workshop > Lighting
22254 Views, 68 Favorites, 0 Comments
Chained Mood-light Using High Power RGB LEDs
I have startet this project more than a year ago and working on it on and off since then. Now it is finally done.
The goal was to have a nice-looking mood-light for my livingroom, inspired by a standard lighting console a friend once had (with colored bulbs and switches) but with an added tint of high tech. Also the lamps should be spot lamps, not flood lamps to color my wall nicely.
After some initial tests with RGB LEDs I decided to use a 10W LED in each lamp. Also, to add placement flexibility the lamps should be individually placeble, not all together embedded in one piece of wood. I got the idea of using wooden bowls from this IKEA hack
here:
http://technabob.com/blog/2008/11/28/salad-bowl-speakers-ikea-hack/
The hardware part is not too hard to make, the electronics can be more complicated, depending on you abilities. The hard part was the software, took me a few weekends to figure it all out but that is now all ready for you.
So here is what it can do and how it works:
There is one master lamp, equipped with an arduino that sends commands to all the slave lamps (I have one master and five slaves, more can be added or less can be used) via the I2C serial bus protocol. I selected I2C because it uses only 2 addidtional wires but if I had to do it all over I would use a 2.4GHz wireless module in each lamp for added flexibility.
The master lamp is also equipped with an IR receiver. It gets commands from a cheap IR remote (almost any remote can be programmed into it) to change colors, fade modes and whatever you have programmed into the master.
I got most of the electronics material from DealExtreme and digikey, The bowls are from IKEA, the wires I got locally.
Stuff needed:
-10W RGB LED, wide angle (http://www.dealextreme.com/p/10w-500-lumen-multi-color-rgb-led-emitter-metal-plate-140-degree-44043?item=1)
-Small Arduino with ATmega328, I used one from Seeedstudio but any that fits into the lamp will do. I recommend to use an Arduino Nano for its size (http://www.dealextreme.com/p/arduino-nano-v3-0-81877?item=2)
-NFET transistor with low threshold voltage (below 4V) in whatever package you like
-Heat sink (http://www.dealextreme.com/p/high-performance-dc-brushless-cooling-fan-for-pc-video-card-8942 it is out of stock, any similar one will do)
-Heat sink paste (http://www.dealextreme.com/p/heatsink-thermal-compound-grease-like-4593)
-12V power supplies (http://www.dealextreme.com/p/ac-to-dc-12v-1a-power-adaptor-with-5-4mm-dc-plug-eu-type-110-240v-15991)
-LED controllers with PWM input (three per lamp): (http://www.dealextreme.com/p/mr16-1-3w-650-700ma-constant-current-regulated-led-driver-8-40v-input-13557)
-Heat shrink tubing (http://www.dealextreme.com/p/1m-black-heat-shrink-tubing-five-size-pack-0-8-1-5-2-5-3-5-4-5mm-23450)
-Aluminium pipe, 20mm diameter (hardware store)
-Reflectors (http://www.dealextreme.com/p/35mm-35mm-aluminum-textured-op-reflector-for-cree-led-emitters-2-pack-14599)
-5-strand cable (or more), 300V insulation between strands, 5m length. Current capability: 12W*[number of lamps]/230V (or 120V in US and Japan). I used a cable with eight 0.14mm^2 conductor strands.
-Power cable (1-2m length) with a plug fitting your power outlets. Can also have a switch on it.
-IR-receiver, 38KHz (I think I used a TSOP2238, but not sure anymore)
-IR Remote (http://www.dealextreme.com/p/24-key-wireless-infrared-ir-remote-controller-for-rgb-led-light-bulb-1-cr2025-47019?item=2)
-Diffusor material (60° angle diffusor used) (I used very expensive professional diffusors I had a sample available of, scotch tape works too but not as well)
-Cover glass (http://www.dealextreme.com/p/glass-lens-for-flashlights-10-pack-34-8mm-x-1-2mm-10643?item=4)
-Wooden bowls from IKEA
-"Behandla" scumble from IKEA (like varnish but not varnish)
-Cork pad for stand, 10mm thick (got that from IKEA too)
For each slave controller board: (you can also use an arduino pro mini, a bit more expensive but saves a lot of soldering work) and modify the slave software. You have to figure out how yourself. Get it here: http://www.dealextreme.com/p/arduino-pro-mini-w-atmega328p-electronic-building-blocks-interactive-media-improved-version-104332?item=1)
-ATTiny24
-5V LDO regulator IC (i.e. L1117 in SOT223 package)
-NFET transistor with low threshold voltage (below 4V) in a SOT23 package
-SMD decoupling capacitors, 10uF (1uF would be fine too)
-Pin headers
Tools used:
-Dremel
-Various drill bits
-CNC Milling machine (optional but makes stuff easier)
-All sorts of sand paper
-Brush
-Vice
-Cutter knife
-File
-Bar clamps
-Glue (epoxy, hot glue, wood glue)
-Silicone or silicone glue (optional)
-Soldering Iron
-Solder
-Heat resistant wires (I used silicone wires used in RC models but any wire that works up to 80°C is fine)
-Multimeter
-Oscilloscope (optional, but very useful for debugging)
-Lab power supply (optional as well)
-Programmer (ISP) for Atmel chips (I used a AVRISP STK500 compatible I got from Seeedstudio, but you can get it from ebay for around 20$)
Note: If you are a beginner in electronics, this project is not for you. You can try and I am willing to answer some questions but be aware that the instructions are meant for people with some knowledge in electronics and programming.
WARNING:
THE LAMP RUNS ON 230V/120V, TAKE SPECIAL CARE EACH TIME BEFORE TESTING TO NOT ACCIDENTALLY SHORT IT OUT OR GET SHOCKED! ALSO BE EXTRA CAREFUL WHEN WIRING IT UP, YOUR INSURANCE PROBABLY DOES NOT COVER FIRES CAUSED BY SELF MADE ELECTRONICS! ALWAYS SWITCH IT OFF BY COMPLETELY CUTTING THE POWER AND DO NOT LET IT RUN UNATTENDED! I WILL NOT BE LIABLE FOR ANY INJURIES OR LOSSES OF EARTHLY GOODS IF YOU GET SHOCKED OR BURN DOWN YOUR HOUSE.
The goal was to have a nice-looking mood-light for my livingroom, inspired by a standard lighting console a friend once had (with colored bulbs and switches) but with an added tint of high tech. Also the lamps should be spot lamps, not flood lamps to color my wall nicely.
After some initial tests with RGB LEDs I decided to use a 10W LED in each lamp. Also, to add placement flexibility the lamps should be individually placeble, not all together embedded in one piece of wood. I got the idea of using wooden bowls from this IKEA hack
here:
http://technabob.com/blog/2008/11/28/salad-bowl-speakers-ikea-hack/
The hardware part is not too hard to make, the electronics can be more complicated, depending on you abilities. The hard part was the software, took me a few weekends to figure it all out but that is now all ready for you.
So here is what it can do and how it works:
There is one master lamp, equipped with an arduino that sends commands to all the slave lamps (I have one master and five slaves, more can be added or less can be used) via the I2C serial bus protocol. I selected I2C because it uses only 2 addidtional wires but if I had to do it all over I would use a 2.4GHz wireless module in each lamp for added flexibility.
The master lamp is also equipped with an IR receiver. It gets commands from a cheap IR remote (almost any remote can be programmed into it) to change colors, fade modes and whatever you have programmed into the master.
I got most of the electronics material from DealExtreme and digikey, The bowls are from IKEA, the wires I got locally.
Stuff needed:
-10W RGB LED, wide angle (http://www.dealextreme.com/p/10w-500-lumen-multi-color-rgb-led-emitter-metal-plate-140-degree-44043?item=1)
-Small Arduino with ATmega328, I used one from Seeedstudio but any that fits into the lamp will do. I recommend to use an Arduino Nano for its size (http://www.dealextreme.com/p/arduino-nano-v3-0-81877?item=2)
-NFET transistor with low threshold voltage (below 4V) in whatever package you like
-Heat sink (http://www.dealextreme.com/p/high-performance-dc-brushless-cooling-fan-for-pc-video-card-8942 it is out of stock, any similar one will do)
-Heat sink paste (http://www.dealextreme.com/p/heatsink-thermal-compound-grease-like-4593)
-12V power supplies (http://www.dealextreme.com/p/ac-to-dc-12v-1a-power-adaptor-with-5-4mm-dc-plug-eu-type-110-240v-15991)
-LED controllers with PWM input (three per lamp): (http://www.dealextreme.com/p/mr16-1-3w-650-700ma-constant-current-regulated-led-driver-8-40v-input-13557)
-Heat shrink tubing (http://www.dealextreme.com/p/1m-black-heat-shrink-tubing-five-size-pack-0-8-1-5-2-5-3-5-4-5mm-23450)
-Aluminium pipe, 20mm diameter (hardware store)
-Reflectors (http://www.dealextreme.com/p/35mm-35mm-aluminum-textured-op-reflector-for-cree-led-emitters-2-pack-14599)
-5-strand cable (or more), 300V insulation between strands, 5m length. Current capability: 12W*[number of lamps]/230V (or 120V in US and Japan). I used a cable with eight 0.14mm^2 conductor strands.
-Power cable (1-2m length) with a plug fitting your power outlets. Can also have a switch on it.
-IR-receiver, 38KHz (I think I used a TSOP2238, but not sure anymore)
-IR Remote (http://www.dealextreme.com/p/24-key-wireless-infrared-ir-remote-controller-for-rgb-led-light-bulb-1-cr2025-47019?item=2)
-Diffusor material (60° angle diffusor used) (I used very expensive professional diffusors I had a sample available of, scotch tape works too but not as well)
-Cover glass (http://www.dealextreme.com/p/glass-lens-for-flashlights-10-pack-34-8mm-x-1-2mm-10643?item=4)
-Wooden bowls from IKEA
-"Behandla" scumble from IKEA (like varnish but not varnish)
-Cork pad for stand, 10mm thick (got that from IKEA too)
For each slave controller board: (you can also use an arduino pro mini, a bit more expensive but saves a lot of soldering work) and modify the slave software. You have to figure out how yourself. Get it here: http://www.dealextreme.com/p/arduino-pro-mini-w-atmega328p-electronic-building-blocks-interactive-media-improved-version-104332?item=1)
-ATTiny24
-5V LDO regulator IC (i.e. L1117 in SOT223 package)
-NFET transistor with low threshold voltage (below 4V) in a SOT23 package
-SMD decoupling capacitors, 10uF (1uF would be fine too)
-Pin headers
Tools used:
-Dremel
-Various drill bits
-CNC Milling machine (optional but makes stuff easier)
-All sorts of sand paper
-Brush
-Vice
-Cutter knife
-File
-Bar clamps
-Glue (epoxy, hot glue, wood glue)
-Silicone or silicone glue (optional)
-Soldering Iron
-Solder
-Heat resistant wires (I used silicone wires used in RC models but any wire that works up to 80°C is fine)
-Multimeter
-Oscilloscope (optional, but very useful for debugging)
-Lab power supply (optional as well)
-Programmer (ISP) for Atmel chips (I used a AVRISP STK500 compatible I got from Seeedstudio, but you can get it from ebay for around 20$)
Note: If you are a beginner in electronics, this project is not for you. You can try and I am willing to answer some questions but be aware that the instructions are meant for people with some knowledge in electronics and programming.
WARNING:
THE LAMP RUNS ON 230V/120V, TAKE SPECIAL CARE EACH TIME BEFORE TESTING TO NOT ACCIDENTALLY SHORT IT OUT OR GET SHOCKED! ALSO BE EXTRA CAREFUL WHEN WIRING IT UP, YOUR INSURANCE PROBABLY DOES NOT COVER FIRES CAUSED BY SELF MADE ELECTRONICS! ALWAYS SWITCH IT OFF BY COMPLETELY CUTTING THE POWER AND DO NOT LET IT RUN UNATTENDED! I WILL NOT BE LIABLE FOR ANY INJURIES OR LOSSES OF EARTHLY GOODS IF YOU GET SHOCKED OR BURN DOWN YOUR HOUSE.
Preparing LED Circuitry
The very first thing is to prepare the drivers. Remove the stuff we do not need:
-the two connector pins
-the four rectifier diodes (use the soldering iron on highest power setting)
make sure you do not remove the diode for the step-down driver circuit (the one next to the little IC)
Connect three of them together by connecting the 12V lines and the GND lines. Use a Multimeter to find the right soldering pads (where the diodes were soldered) the picture shows the 12V connected with a red cable and the GND connected with bare copper wire.
To each driver, connect a signal cable to the contoller IC on pin number 3, the one next to the edge of the circuit board. If you are not used to SMD soldering, this may be a little tricky as the pads are small compared to through hole soldering.
Now you should have three drivers connected together, two cables coming out for 12V supply, three cables for signal input and six wires to connect to the LEDs.
Connect the drivers output cables tho the LEDs. I did this by first soldering about 10cm of cable to each LED connecting pad and then soldering these to the red and white wires of the drivers and adding heat shrink tubing. To find out which pad of the LED is the anode and which the cathode I used a regulated power supply with a current limit of 10mA and a voltage of 6V. You can also use a 9V battery to do this. You can destroy the LEDs by applying a reverse voltage of more than 4V per LED but with three in series, 9V should be fine (no guarantee though). Be careful with the 9V battery, the LED will be very bright (and burn out if applied for more than a few seconds).
The multimeter diode test did not work for me, the voltage was too low to drive the three series connected LEDs.
There is a small hole in one of the LED's soldering pad which I think marks the kathode side but I am not sure anymore and I have no spare LED at hand to test that, sorry.
Make sure that the length of the cables from the LED to the circuit board is long enough to later go around the heat sink and into the bottom part of the lamp. I used cables of about 15cm of length.
Always use the same order and know which color is which when connecting the drivers or you will have to sort out the colors later!
Ok, so now you have connecteds the driver to the LEDs. If you have a 12V power supply at hand, you can test it. If no signal is applied to the PWM signal cables, the drivers go to full brightness. You can also connect a Potentiometer to the signal input to adjust brightness (at least the datasheet states so) of each channel. Do not test extensively now, the LEDs cannot handle the heat without the heatsink. So let's attach it...
-the two connector pins
-the four rectifier diodes (use the soldering iron on highest power setting)
make sure you do not remove the diode for the step-down driver circuit (the one next to the little IC)
Connect three of them together by connecting the 12V lines and the GND lines. Use a Multimeter to find the right soldering pads (where the diodes were soldered) the picture shows the 12V connected with a red cable and the GND connected with bare copper wire.
To each driver, connect a signal cable to the contoller IC on pin number 3, the one next to the edge of the circuit board. If you are not used to SMD soldering, this may be a little tricky as the pads are small compared to through hole soldering.
Now you should have three drivers connected together, two cables coming out for 12V supply, three cables for signal input and six wires to connect to the LEDs.
Connect the drivers output cables tho the LEDs. I did this by first soldering about 10cm of cable to each LED connecting pad and then soldering these to the red and white wires of the drivers and adding heat shrink tubing. To find out which pad of the LED is the anode and which the cathode I used a regulated power supply with a current limit of 10mA and a voltage of 6V. You can also use a 9V battery to do this. You can destroy the LEDs by applying a reverse voltage of more than 4V per LED but with three in series, 9V should be fine (no guarantee though). Be careful with the 9V battery, the LED will be very bright (and burn out if applied for more than a few seconds).
The multimeter diode test did not work for me, the voltage was too low to drive the three series connected LEDs.
There is a small hole in one of the LED's soldering pad which I think marks the kathode side but I am not sure anymore and I have no spare LED at hand to test that, sorry.
Make sure that the length of the cables from the LED to the circuit board is long enough to later go around the heat sink and into the bottom part of the lamp. I used cables of about 15cm of length.
Always use the same order and know which color is which when connecting the drivers or you will have to sort out the colors later!
Ok, so now you have connecteds the driver to the LEDs. If you have a 12V power supply at hand, you can test it. If no signal is applied to the PWM signal cables, the drivers go to full brightness. You can also connect a Potentiometer to the signal input to adjust brightness (at least the datasheet states so) of each channel. Do not test extensively now, the LEDs cannot handle the heat without the heatsink. So let's attach it...
Adding the Heat Sink
Clean the heatsink from any stickers and oil that may still be on them.
Apply some heat sink compound to the center, where the LED will be placed.
Put the LED on top and press it down. Remove any excess heat sink paste that may come out on the sides.
The LED should now hold on the heatsink on the greasy paste.
I used two component epoxy glue to secure it. This surely is not the best method, it would be better to use screws, the glue weakens over time due to the elevated temperature and the LED can become loose. For the ones that became loos I then used a silicone glue instead of the heatsink paste, which also works fine but if available, use screws!
You may notice that in the picture there is a lot of debris. That is from the plastic lens that was on top of the LED. I thought that it would be better to use 60° angle LEDs instead of 140°, but that gave very bad color mixing so i used sandpaper to grind the lens flat (destroying 2 out of 5).
Apply some heat sink compound to the center, where the LED will be placed.
Put the LED on top and press it down. Remove any excess heat sink paste that may come out on the sides.
The LED should now hold on the heatsink on the greasy paste.
I used two component epoxy glue to secure it. This surely is not the best method, it would be better to use screws, the glue weakens over time due to the elevated temperature and the LED can become loose. For the ones that became loos I then used a silicone glue instead of the heatsink paste, which also works fine but if available, use screws!
You may notice that in the picture there is a lot of debris. That is from the plastic lens that was on top of the LED. I thought that it would be better to use 60° angle LEDs instead of 140°, but that gave very bad color mixing so i used sandpaper to grind the lens flat (destroying 2 out of 5).
Making the Color Mixing Chamber
If the reflector is put directly on to the LED, the color mixing is just awful. So we need to scramble the colors. To this purpouse I added the color mixing chamber. It is a piece of aluminium pipe, polished on the inside with diffusers on both ends (as the lenses of the 60° leds were already diffuse after grinding, I only added one extra diffuser, test what works best for you).
The light from the LED passes through the first diffuse surface, gets reflected and scrambled inside the tube and passes through another diffusor, scrambling it even more. This reduces the brightness of the LEDs a lot, but makes for a nice and smooth spot light.
Ok, so cut the 20mm pipe into pieces of the same length of about 6-10mm. Use sand paper to make them nice and flat.
Use the dremel tool with some polishing paste to polish the inside of the pieces of tube.
Glue the diffuser (milk glass, scotch tape...) to both ends.
Glue the whole mixing chamber on to the LEDs. I used epoxy glue for this, but it does not stick too well to the plastic of the LED and I often had to do it twice or three times because it broke off during the assembly of the lamp.
The light from the LED passes through the first diffuse surface, gets reflected and scrambled inside the tube and passes through another diffusor, scrambling it even more. This reduces the brightness of the LEDs a lot, but makes for a nice and smooth spot light.
Ok, so cut the 20mm pipe into pieces of the same length of about 6-10mm. Use sand paper to make them nice and flat.
Use the dremel tool with some polishing paste to polish the inside of the pieces of tube.
Glue the diffuser (milk glass, scotch tape...) to both ends.
Glue the whole mixing chamber on to the LEDs. I used epoxy glue for this, but it does not stick too well to the plastic of the LED and I often had to do it twice or three times because it broke off during the assembly of the lamp.
Preparing the Reflector
The reflector was intended to use on a much small LED, so the hole in the center is only 5-6mm. The ID of our mixing chamber (and the LED) is 18mm, so lets make that hole a little bit bigger.
Use a vice to hold the reflector and carefully make the hole bigger. I am not 100% sure but I think I made that hole 18mm. If you make it too big, the shiny surface of the reflector gets damaged.
You may also want to file down some of the threaded part, it must be shorter than your mixing chamber so the mixing chamber fits well. I also made some adapter rings out of plastic to help center the mixing chamber to the reflector because the threading in the reflector is bigger than 20mm. Make sure all fits together well.
Now you can test how well your mixing chamber woks. Take one of the LEDs, put the reflector on top and connect it to a power supply. I used the Arduino (with analogWrite()) to generate some PWM signals to test what happens with different colors to see if the all mix well.
Enough electronics and metal for now. Let's put that lamp into a housing.
Use a vice to hold the reflector and carefully make the hole bigger. I am not 100% sure but I think I made that hole 18mm. If you make it too big, the shiny surface of the reflector gets damaged.
You may also want to file down some of the threaded part, it must be shorter than your mixing chamber so the mixing chamber fits well. I also made some adapter rings out of plastic to help center the mixing chamber to the reflector because the threading in the reflector is bigger than 20mm. Make sure all fits together well.
Now you can test how well your mixing chamber woks. Take one of the LEDs, put the reflector on top and connect it to a power supply. I used the Arduino (with analogWrite()) to generate some PWM signals to test what happens with different colors to see if the all mix well.
Enough electronics and metal for now. Let's put that lamp into a housing.
Making the Wooden Casing
In the IKEA store, I already selected bowls that look nice, match in color and size.
I marked the pieces that I wanted to go together. In one piece i made one big hole for the reflector, in the other I made three smaller holes: one 18mm hole in the center for air circulation and two 6mm holes for the cables in a distance of 5mm of the center hole.
The hole for the reflector has a step in my case. I made this with a CNC milling machine so it came out very nice. You can also just make on through hole with a 35mm diameter to fit the reflector.
After drilling all the holes, I made the matching pairs match even better. Notice that the original bowles have rounded seams and do not fit well. I sanded the seam flat (on a machine, but can be done manually) until the two halves matched much better.
To give the wood a more natural look, I removed all the varnish on the outside with a fine sand paper.
Next I used bar clamps to put the two matching halves together and gave it a nice sandpaper finish so they match now almost seamlessly.
After finishing all the sanding work I used the "behandla" scumble stuff from IKEA giving it a nice natural wooden look. I put that stuff on in two layers.
I marked the pieces that I wanted to go together. In one piece i made one big hole for the reflector, in the other I made three smaller holes: one 18mm hole in the center for air circulation and two 6mm holes for the cables in a distance of 5mm of the center hole.
The hole for the reflector has a step in my case. I made this with a CNC milling machine so it came out very nice. You can also just make on through hole with a 35mm diameter to fit the reflector.
After drilling all the holes, I made the matching pairs match even better. Notice that the original bowles have rounded seams and do not fit well. I sanded the seam flat (on a machine, but can be done manually) until the two halves matched much better.
To give the wood a more natural look, I removed all the varnish on the outside with a fine sand paper.
Next I used bar clamps to put the two matching halves together and gave it a nice sandpaper finish so they match now almost seamlessly.
After finishing all the sanding work I used the "behandla" scumble stuff from IKEA giving it a nice natural wooden look. I put that stuff on in two layers.
Making the Stands
I want each lamp to be positioned freely, also to change the angle at which it is shining at my wall. What I came up with is a little stand made from 10mm thick cork plates, the ones used to put hot pans or pots on to the table.
Here is how its made:
draw a ring on to the cork (with an edding for example) with an outer diameter of about 10cm and an inner diameter of 7cm. I used a roll of packaging tape as a stencil.
You need one of these rings for each lamp.
In addition you need 6 pieces of quarter rings.
Use a cutting knife to roughly cut out the pieces, after separation, cut it more nicely.
I then used wood glue (the white stuff) to glue the pieces together to a nice little stand. See the images on how to put it together. After the glue dried, I used a rough sandpaper to round off the edges and rough spots.
Here is how its made:
draw a ring on to the cork (with an edding for example) with an outer diameter of about 10cm and an inner diameter of 7cm. I used a roll of packaging tape as a stencil.
You need one of these rings for each lamp.
In addition you need 6 pieces of quarter rings.
Use a cutting knife to roughly cut out the pieces, after separation, cut it more nicely.
I then used wood glue (the white stuff) to glue the pieces together to a nice little stand. See the images on how to put it together. After the glue dried, I used a rough sandpaper to round off the edges and rough spots.
The Slave Driver Electronics
In retrospect it was way too much work to do a custom designed circuit board for the slave lamps, but hey, I learned a lot.
Initially I was looking for a simple IC that just converts a serial signal like I2C or SPI into three PWM. I also wanted to be able to have a two way communication because I was sure there would be noise on the signals because I packed power cables and signal cables into the same bundle, so a shift register based solution did not do.
Since there are no I2C to PWM ICs available, I decided to make a little microcontroller board to do it.
It is more ore less a breakout board of an ATTiny24 with a 5V regulator added to it so I can supply it with 12V.
The ATTiny24 can be seen as an Arduino with not as many pins and not as many functions but it has just enough to do I2C communication and output PWM signals. Also, it is very cheap only 1$ a piece.
You can buy it from digikey for example:
http://search.digikey.com/us/en/products/ATTINY24A-SSU/ATTINY24A-SSU-ND/2050982
The circuit board I made on the CNC milling machine as well but you can also use online order services or use any other home-brew circuit making technique availble. Another possibility is to order the through hole version of the Tiny24 instead of the SMD version and just use a prototyping board to solder the components.
The two pullup resistors on the I2C lines (SCK and SCL) are optional. I only added them (about 2k ohms) in the last lamp as well as 1.5k Ohm in the master lamp but that one does not have the Tiny24 adapter board in it. To get more info about these pullups, read into how I2C works.
Download AVRStudio 4.
Now compile and upload the code (no additional libraries necessary). You need to compile the code for each lamp, as the I2C address is fixed in the program (read the code and find where the address is defined). Do not forget to make a mark on the PCB which one contains which address.
I wanted to add it into EEPROM but never got around to do it. And it only takes 10 seconds to change the address and recompile. And also, this only needs to be done once for each lamp. Ever.
Note: If you already connected the I2C signals, disconnect them, uploading does not work if the I2C lines are connected.
To add the power supply, crack open the casing and remove the electronics inside. Clip the 230V connections (leave some cable to solder the connecting cable) and cap the 12V cable about 10cm from the board.
When you finish the board, connect the 12V power supply to the tiny24 board. Also connect the three PWM signals from the led drivers. Refer to the code to see which pin I assigned to which color (also take a look at the datasheet of the tiny24). The I2C signal will be sent to the long cable, connecting two lamps and is the very last thing we will connect. Also connect the fan to the pins.
Initially I was looking for a simple IC that just converts a serial signal like I2C or SPI into three PWM. I also wanted to be able to have a two way communication because I was sure there would be noise on the signals because I packed power cables and signal cables into the same bundle, so a shift register based solution did not do.
Since there are no I2C to PWM ICs available, I decided to make a little microcontroller board to do it.
It is more ore less a breakout board of an ATTiny24 with a 5V regulator added to it so I can supply it with 12V.
The ATTiny24 can be seen as an Arduino with not as many pins and not as many functions but it has just enough to do I2C communication and output PWM signals. Also, it is very cheap only 1$ a piece.
You can buy it from digikey for example:
http://search.digikey.com/us/en/products/ATTINY24A-SSU/ATTINY24A-SSU-ND/2050982
The circuit board I made on the CNC milling machine as well but you can also use online order services or use any other home-brew circuit making technique availble. Another possibility is to order the through hole version of the Tiny24 instead of the SMD version and just use a prototyping board to solder the components.
The two pullup resistors on the I2C lines (SCK and SCL) are optional. I only added them (about 2k ohms) in the last lamp as well as 1.5k Ohm in the master lamp but that one does not have the Tiny24 adapter board in it. To get more info about these pullups, read into how I2C works.
Download AVRStudio 4.
Now compile and upload the code (no additional libraries necessary). You need to compile the code for each lamp, as the I2C address is fixed in the program (read the code and find where the address is defined). Do not forget to make a mark on the PCB which one contains which address.
I wanted to add it into EEPROM but never got around to do it. And it only takes 10 seconds to change the address and recompile. And also, this only needs to be done once for each lamp. Ever.
Note: If you already connected the I2C signals, disconnect them, uploading does not work if the I2C lines are connected.
To add the power supply, crack open the casing and remove the electronics inside. Clip the 230V connections (leave some cable to solder the connecting cable) and cap the 12V cable about 10cm from the board.
When you finish the board, connect the 12V power supply to the tiny24 board. Also connect the three PWM signals from the led drivers. Refer to the code to see which pin I assigned to which color (also take a look at the datasheet of the tiny24). The I2C signal will be sent to the long cable, connecting two lamps and is the very last thing we will connect. Also connect the fan to the pins.
Put It All Together
It is now time to assemble the electronics into the wooden bowls.
I arranged the electronic parts around the bottom half of the lamp and used hot glue to give it a quick fix. The hot glue however will become soft when the lamp heats up, so in addition I used epoxy glue. Silicone can also be used here instead of epoxy.
Make sure that the 12V power supply fits in, even when the top part is put on. Nothing should stick out of the bowl (more than a few millimeters that is).
Put the reflector into the top part of the lamp and secure it in place with some epoxy. Do not yet put on the cover glass, that is the very very last step, after the lamp was tested and works because you cannot clean out any debris or dust after the glass has been glued and you will get stuff into the reflector in case you need to remove the LED again later (to fix it or readjust/recenter or whatever).
With the reflector in place and all the electronics in the bottom part secured, you can now place the heat sink with the LED and the mixing chamber into the reflector. The plastic spacer I mentioned earlier now comes in handy as in my case the two pieces just fit together and are centered. I am sure you fill figure out a way to center it. Just do not apply much force on the mixing chamber, it breaks off very easily from the LED and you will have to re-glue it.
After the heatsink is mounted into the top part, you may notice that the only thing that holds it is the mixing chamber. I added two pieces of wood to outer ribs of the heat sink and glued these to bowl, the wooden pieces acting as a bridge for the big gap between bowl and heat sink. After the glue hardens, it is quite rigid, but still you should not drop it or throw it around.
Ok, so you now have a finished lamp, the only thing missing is the cable connecting it to 230V and the master signal.
For me, the master lamp was the hardest to assemble, because I used a big arduino board and had to cut off some the edges of the PCB to make it fit. Use a Arduino Nano and you will have less problems. I will explain how to connect the master board in the next step.
I arranged the electronic parts around the bottom half of the lamp and used hot glue to give it a quick fix. The hot glue however will become soft when the lamp heats up, so in addition I used epoxy glue. Silicone can also be used here instead of epoxy.
Make sure that the 12V power supply fits in, even when the top part is put on. Nothing should stick out of the bowl (more than a few millimeters that is).
Put the reflector into the top part of the lamp and secure it in place with some epoxy. Do not yet put on the cover glass, that is the very very last step, after the lamp was tested and works because you cannot clean out any debris or dust after the glass has been glued and you will get stuff into the reflector in case you need to remove the LED again later (to fix it or readjust/recenter or whatever).
With the reflector in place and all the electronics in the bottom part secured, you can now place the heat sink with the LED and the mixing chamber into the reflector. The plastic spacer I mentioned earlier now comes in handy as in my case the two pieces just fit together and are centered. I am sure you fill figure out a way to center it. Just do not apply much force on the mixing chamber, it breaks off very easily from the LED and you will have to re-glue it.
After the heatsink is mounted into the top part, you may notice that the only thing that holds it is the mixing chamber. I added two pieces of wood to outer ribs of the heat sink and glued these to bowl, the wooden pieces acting as a bridge for the big gap between bowl and heat sink. After the glue hardens, it is quite rigid, but still you should not drop it or throw it around.
Ok, so you now have a finished lamp, the only thing missing is the cable connecting it to 230V and the master signal.
For me, the master lamp was the hardest to assemble, because I used a big arduino board and had to cut off some the edges of the PCB to make it fit. Use a Arduino Nano and you will have less problems. I will explain how to connect the master board in the next step.
Connecting the Master Lamp
The slave lamps are not working without the master board. It may be a good idea to first make the master lamp work, before assembling all the slaves, but I should have told you that earlier should't I. Oh well, I am sure you figured that out yourself.
The only thing different from the master lamp to the slave lamps is that there is a different microcontroller in it (or you can also use arduinos in all slave lamps and upload the (adapted) slave code to the slave lamps). Also it is the only lamp that has a USB connector and a IR receiver.
I removed the original mini-USB socket from the board and used wire wrap cables (any other small cables will be fine) to reconnect it with 5cm cable in between. I used the dremel tool to make a hole into the lamp to fit the usb socket, so I can update the master software without opening the lamp. On the opposite side, i made a hole big enough for the IR receiver but small enough so that from the outside it just looks like a little black knob. It is a good Idea to place the IR receiver about in the middle between the seam of the two halves and the bottom of the lamp.
Connect the IR receiver to GND, 5V and the signal output to pin to the arduino digital pin 8 (which is linked with the timer1 input capture interrupt).
Hook up the NFET transistor to the Arduino: connect the gate to digital pin 13 and the source to GND. The Drain connects to the negative input of the fan. Connect the positive input of the fan to the Arduino's 5V pin. Yes, it is a 12V fan but at 5V it creates enough airflow to keep the LED cooled and it creates almost no noise. If your fan does not work at 5V, connect it to the 12V line (which is also true for all the slave lamps by the way).
Use two 1.5k Ohm resistors and connect them as pullups: one from SDA (analog pin 4) to 5V and one from SCL (analog pin 5) to 5V. These are the pullups for the I2C communication bus. If you forget them, the serial communication will not work. Do not use the Arduino's internal pullups, they are too weak (ignore this sentence if you do not know about the internal pullups of the Arduino, they are activated by software and it does not matter if they are activated or not if you solder external pullups).
The PWM signals are generated using timer1 (red and green) and timer2 (blue). The pins controlled are digital pin 9 (red), digital pin 10 (green) and digital pin 11 (blue).
Timer1 is a 16bit timer, giving you 65'536 color steps, which is more than enough (above 12bit you cannot see any "color jumps" when dimming) but timer1 is only a 8bit timer. In the beginning I had both run in 8bit mode but that looked a bit crappy because our eyes are logarithmic and the LED is linear, meaning you perceive a change from 2 to 4 as a bigger change in brightness than a change from 200 to 255. In reality the 256 brightness steps, when done in a logarithmic way only give you about 12-13 color values (in theory, in reality its a few more) per channel, resulting in a total of 13^3 = 2197 distinguishable colors. Sounds like a lot but it's not.
I go a bit into detail about the code now, if you are not familiar with hardware timing and timer stuff, skip it.
I have searched the web for a few hours trying to find a software method to increase the 8bit timer, but all of them introduce jitter errors due to software delay, which results in frequent flickering of an led which is not acceptable. I then sat down and wrote my own code to get a higher resolution. I found that for the lower values, software delays are too slow, also interrupts are not fast enough (we are talking single cpu clock precision here). It could maybe have been done in assembler but I did not want to go down that road, no sir.
I instead used a trick (which I discovered by accident, and now am pretty proud of) that the timers do not immediately update the compare match register but have a buffer on it, updating it only on the next timer overflow. With this in mind I use the timer2 overflow to synchronize and check timers and can make a up to 16bit timer out of any 8bit timer, but can also have it be 12bits or 13bits. This adds a lot of CPU load, but the master lamp only needs to listen to the IR, send commands out and generate PWM, which is all mostly done in hardware so there is enough time do do color calculations and stuff in the meantime. With an arduino CPU clock of 16Mhz and a timer prescaler of 8 (with a prescaler of 1 the CPU load gets too high due to interrupts every 256 timer ticks) the PWM frequency is 2MHz/(2^13) = 244Hz (for the slave lamps it is only 122Hz since they run on 8Mhz) which is fine (100Hz is the minimum to get flicker free lights).
Good, so we have a software-hardware combination PWM output with a 13bit resolution, giving us 8191 linear color steps for each lamp, this gives us 254 logarithmic steps (the resolution is actually too high and the lower values use the same number of timer ticks) resulting in 16'387'064 different colors! This gives nice and smooth color changes.
Ok, enough about the code and color theory. Hook up the 12V power supply to the arduino. Take the power cable and put it through one of the two smaller holes in the bottom of the lamp. Connect it to the AC input of the 12V power supply, make sure to use heat shrink tubing on the soldered joints of the cable. Arrange all the electronics nicely into the two wooden bowls and fix it with glue, like described for the slave lamps. Double check that the 230V lines are secured and well insulated. Now you can plug it in (I use an extension cord with a switch, also from IKEA). Be extra careful now, the lamp has still some places (on the power supply) with exposed 230V parts.
It does not work as expected? Gotcha. You need to comment out all updatelamp(x); commands from the arduino code (also from all functions!), with x being 1 to 5 (only update lamp 0, the master). The updatelamp commands wait for the proper response from the slave and try to resend commands if it fails, so the program falls into an infinite loop. You can put in a timeout into the updatelamp command if you wish, I did not want to do that so no lamp skips any colors.
Oh and while you are working on the master lamp, put in three pulldown (to GND) resistors of lets say about 2k Ohms on each of the PWM signal pins. I forgot to do that and during bootup of the arduino the master lamp flashes in bright white light for about half a second, which it would't if I had not forgotten those pulldowns...
If all is working, it is now time to hookup the slaves. I hope you marked which one you programmed with the address of slave number one.
Note: I know there are still some bugs in the code, if you find one, please report it to me (and if you know how to fix it, tell me). Also my programming skills are moderate at best and the code is a mess but I tried to add in comments on most of the lines (may be in german in some parts, sorry for that). It is still a work in progress (which code isn't?) and not fully cleaned up.
Any additions or suggestions to the code are welcome.
The only thing different from the master lamp to the slave lamps is that there is a different microcontroller in it (or you can also use arduinos in all slave lamps and upload the (adapted) slave code to the slave lamps). Also it is the only lamp that has a USB connector and a IR receiver.
I removed the original mini-USB socket from the board and used wire wrap cables (any other small cables will be fine) to reconnect it with 5cm cable in between. I used the dremel tool to make a hole into the lamp to fit the usb socket, so I can update the master software without opening the lamp. On the opposite side, i made a hole big enough for the IR receiver but small enough so that from the outside it just looks like a little black knob. It is a good Idea to place the IR receiver about in the middle between the seam of the two halves and the bottom of the lamp.
Connect the IR receiver to GND, 5V and the signal output to pin to the arduino digital pin 8 (which is linked with the timer1 input capture interrupt).
Hook up the NFET transistor to the Arduino: connect the gate to digital pin 13 and the source to GND. The Drain connects to the negative input of the fan. Connect the positive input of the fan to the Arduino's 5V pin. Yes, it is a 12V fan but at 5V it creates enough airflow to keep the LED cooled and it creates almost no noise. If your fan does not work at 5V, connect it to the 12V line (which is also true for all the slave lamps by the way).
Use two 1.5k Ohm resistors and connect them as pullups: one from SDA (analog pin 4) to 5V and one from SCL (analog pin 5) to 5V. These are the pullups for the I2C communication bus. If you forget them, the serial communication will not work. Do not use the Arduino's internal pullups, they are too weak (ignore this sentence if you do not know about the internal pullups of the Arduino, they are activated by software and it does not matter if they are activated or not if you solder external pullups).
The PWM signals are generated using timer1 (red and green) and timer2 (blue). The pins controlled are digital pin 9 (red), digital pin 10 (green) and digital pin 11 (blue).
Timer1 is a 16bit timer, giving you 65'536 color steps, which is more than enough (above 12bit you cannot see any "color jumps" when dimming) but timer1 is only a 8bit timer. In the beginning I had both run in 8bit mode but that looked a bit crappy because our eyes are logarithmic and the LED is linear, meaning you perceive a change from 2 to 4 as a bigger change in brightness than a change from 200 to 255. In reality the 256 brightness steps, when done in a logarithmic way only give you about 12-13 color values (in theory, in reality its a few more) per channel, resulting in a total of 13^3 = 2197 distinguishable colors. Sounds like a lot but it's not.
I go a bit into detail about the code now, if you are not familiar with hardware timing and timer stuff, skip it.
I have searched the web for a few hours trying to find a software method to increase the 8bit timer, but all of them introduce jitter errors due to software delay, which results in frequent flickering of an led which is not acceptable. I then sat down and wrote my own code to get a higher resolution. I found that for the lower values, software delays are too slow, also interrupts are not fast enough (we are talking single cpu clock precision here). It could maybe have been done in assembler but I did not want to go down that road, no sir.
I instead used a trick (which I discovered by accident, and now am pretty proud of) that the timers do not immediately update the compare match register but have a buffer on it, updating it only on the next timer overflow. With this in mind I use the timer2 overflow to synchronize and check timers and can make a up to 16bit timer out of any 8bit timer, but can also have it be 12bits or 13bits. This adds a lot of CPU load, but the master lamp only needs to listen to the IR, send commands out and generate PWM, which is all mostly done in hardware so there is enough time do do color calculations and stuff in the meantime. With an arduino CPU clock of 16Mhz and a timer prescaler of 8 (with a prescaler of 1 the CPU load gets too high due to interrupts every 256 timer ticks) the PWM frequency is 2MHz/(2^13) = 244Hz (for the slave lamps it is only 122Hz since they run on 8Mhz) which is fine (100Hz is the minimum to get flicker free lights).
Good, so we have a software-hardware combination PWM output with a 13bit resolution, giving us 8191 linear color steps for each lamp, this gives us 254 logarithmic steps (the resolution is actually too high and the lower values use the same number of timer ticks) resulting in 16'387'064 different colors! This gives nice and smooth color changes.
Ok, enough about the code and color theory. Hook up the 12V power supply to the arduino. Take the power cable and put it through one of the two smaller holes in the bottom of the lamp. Connect it to the AC input of the 12V power supply, make sure to use heat shrink tubing on the soldered joints of the cable. Arrange all the electronics nicely into the two wooden bowls and fix it with glue, like described for the slave lamps. Double check that the 230V lines are secured and well insulated. Now you can plug it in (I use an extension cord with a switch, also from IKEA). Be extra careful now, the lamp has still some places (on the power supply) with exposed 230V parts.
It does not work as expected? Gotcha. You need to comment out all updatelamp(x); commands from the arduino code (also from all functions!), with x being 1 to 5 (only update lamp 0, the master). The updatelamp commands wait for the proper response from the slave and try to resend commands if it fails, so the program falls into an infinite loop. You can put in a timeout into the updatelamp command if you wish, I did not want to do that so no lamp skips any colors.
Oh and while you are working on the master lamp, put in three pulldown (to GND) resistors of lets say about 2k Ohms on each of the PWM signal pins. I forgot to do that and during bootup of the arduino the master lamp flashes in bright white light for about half a second, which it would't if I had not forgotten those pulldowns...
If all is working, it is now time to hookup the slaves. I hope you marked which one you programmed with the address of slave number one.
Note: I know there are still some bugs in the code, if you find one, please report it to me (and if you know how to fix it, tell me). Also my programming skills are moderate at best and the code is a mess but I tried to add in comments on most of the lines (may be in german in some parts, sorry for that). It is still a work in progress (which code isn't?) and not fully cleaned up.
Any additions or suggestions to the code are welcome.
Downloads
Chaining the Lamps
Take the shielded cable and cut it into 5 pieces of 1m length. Strip 4-5cm of the outer insulation on either end of all cables. Pull the cable shield away from the inner cables and twirl it up. Strip a few millimeters of insulation from all cable strands.
Put the first cable into the second small cable hole of the master lamp. Solder one strand to the Arduinos SDA pin (Analog pin4), I used the yellow strand of my cable for this. One strand (the white one in my case) goes to the SCL pin (Analog pin5).
Use two of the strands to connect the 230V line (I connected four (two each) to lower the resistance and because my cable has 8 strands). Connect the remaining strands and the cable shield to GND.
Do not forget to add the cork stand to the lamp before connecting the cable to the next lamp!
Put the other end of the cable into the slave lamp number 1. Connect in the same way: the 230V lines go obviously to the 12V power supply (note: all the power supplies are connected in parallel, not in series!), all the GND lines (and the shielding) are connected to the GND of the slave controller PCB. The SDA and SCL lines go to the PCB as well, look at the picture in step 7 (or the schematic) to see which one is which.
Now it's time to do some testing. Uncomment the updatelamp(1); lines you commented earlier from the code. Upload it to the master lamp and switch it on (you can leave your PC connected to the lamp even if it is on).
You may have to debug at this point, I sure as hell had to. If the slave lamp is not working, check the communication lines with an oscilloscope and see if there are any signals present. If there are, try lowering the I2C speed in the code by changing "TWI_FREQ 400000L" to 100kHz. Values below 50kHz did not work for me.
If this does not help either, check the GND connection and while you are at it, check if you accidentally switched the SDA and SCL lines. If this also does not help, disconnect the slave from the SDA and SCL lines and re-upload the code to the slave and make sure you compile it with the right slave address (it is 0x11 for slave number one).
If the lamp is still not doing what is should, use the Serial.println() command in the master lamp code to check what is going on in the software (does the code work as expected? are commands sent? are they sent successfully? does the slave lamp acknowledge the commands?). If all works, it is not a software nor a communication problem. Check the hardware connections of the slave lamp. You can unhook the PWM signal cables from the led drivers, the lamp should then light up in bright white. If not, double check the wiring (all connected right? no short circuits?)
If it still is not working, you are on your own.
Take the next cable and hook up slave number 2 in the same way. Continue until all the lamps are connected like a chain.
Congratulations, you now have a working chained mood-light.
All that is left is to close up the lamps and put on the cover glass to the reflector.
When closing the lamps, be careful that none of the wires get in the way of the fan. It may be necessary to fix some of the cables to the wooden bowls or even shorten them. Once everything fits, use a few drops of wood glue to fix the two halves of the lamps together. If necessary, use bar clamps to fix while drying.
Now use a soft cloth or paper towels to carefully clean the reflector from dust, fingerprints or whatever you may have gotten in there. Also clean the glass covers (I used window cleaner and alcohol) as well as possible. In the bright LED light, even the tiniest particles will be visible.
Use transparent adhesive (I used silicone) to glue the glass covers onto the reflector.
Set the lamps up in your living room and enjoy!
Put the first cable into the second small cable hole of the master lamp. Solder one strand to the Arduinos SDA pin (Analog pin4), I used the yellow strand of my cable for this. One strand (the white one in my case) goes to the SCL pin (Analog pin5).
Use two of the strands to connect the 230V line (I connected four (two each) to lower the resistance and because my cable has 8 strands). Connect the remaining strands and the cable shield to GND.
Do not forget to add the cork stand to the lamp before connecting the cable to the next lamp!
Put the other end of the cable into the slave lamp number 1. Connect in the same way: the 230V lines go obviously to the 12V power supply (note: all the power supplies are connected in parallel, not in series!), all the GND lines (and the shielding) are connected to the GND of the slave controller PCB. The SDA and SCL lines go to the PCB as well, look at the picture in step 7 (or the schematic) to see which one is which.
Now it's time to do some testing. Uncomment the updatelamp(1); lines you commented earlier from the code. Upload it to the master lamp and switch it on (you can leave your PC connected to the lamp even if it is on).
You may have to debug at this point, I sure as hell had to. If the slave lamp is not working, check the communication lines with an oscilloscope and see if there are any signals present. If there are, try lowering the I2C speed in the code by changing "TWI_FREQ 400000L" to 100kHz. Values below 50kHz did not work for me.
If this does not help either, check the GND connection and while you are at it, check if you accidentally switched the SDA and SCL lines. If this also does not help, disconnect the slave from the SDA and SCL lines and re-upload the code to the slave and make sure you compile it with the right slave address (it is 0x11 for slave number one).
If the lamp is still not doing what is should, use the Serial.println() command in the master lamp code to check what is going on in the software (does the code work as expected? are commands sent? are they sent successfully? does the slave lamp acknowledge the commands?). If all works, it is not a software nor a communication problem. Check the hardware connections of the slave lamp. You can unhook the PWM signal cables from the led drivers, the lamp should then light up in bright white. If not, double check the wiring (all connected right? no short circuits?)
If it still is not working, you are on your own.
Take the next cable and hook up slave number 2 in the same way. Continue until all the lamps are connected like a chain.
Congratulations, you now have a working chained mood-light.
All that is left is to close up the lamps and put on the cover glass to the reflector.
When closing the lamps, be careful that none of the wires get in the way of the fan. It may be necessary to fix some of the cables to the wooden bowls or even shorten them. Once everything fits, use a few drops of wood glue to fix the two halves of the lamps together. If necessary, use bar clamps to fix while drying.
Now use a soft cloth or paper towels to carefully clean the reflector from dust, fingerprints or whatever you may have gotten in there. Also clean the glass covers (I used window cleaner and alcohol) as well as possible. In the bright LED light, even the tiniest particles will be visible.
Use transparent adhesive (I used silicone) to glue the glass covers onto the reflector.
Set the lamps up in your living room and enjoy!
The IR Remote
I probably still need to explain how the IR remote works. You can always take a look at the code to see what keys do in each mode in more detail and also add new functions to keys.
The lamp has four modes at the moment. They can be activated by the four function buttons "FLASH", "STROBE", "FADE" and "SMOOTH".
FLASH:
this is the constant color mode. If you press any color button, all lamps will switch to this color. The up and down buttons (or brighter, darker) change the hue (the software uses HSV color scheme). Brightness and saturation cannot be changed. Feel free to add this functionality (I almost never use this mode).
STROBE:
I called this mode "vivid colors". It is similar to the constant color mode. Select a color and all lamps will show a color that is similar to the selected one. They all fade slowly in brightness, hue and saturation with the hue being kept close to the selected color. If you select white as the color ("W" key) the color is selected randomly and also changes randomly from time to time (between 20 and 150 seconds).
FADE:
The rainbow mode. Lamps show a rainbow which slowly moves across. The color buttons do nothing in this mode. With the up and down buttons you can increase or decrease the total width of the rainbow, meaning the number of lamps it takes from red to blue. The default is six.
SMOOTH:
The program mode. Nothing moving here but you can program the color of each lamp and save it to any of the color buttons (is saved to eeprom, so they are kept in memory for many years but can be overwritten anytime).
To change the color of a lamp, push the red "R" button. The selected lamp (the master by default) will quickly fade through the colors to indicate you selected the hue change. Now use the up and down buttons (single clicks or long pressed) to select your hue.
With the green "G" button, you change the saturation. Pressing this button will be confirmed by quickly fading to white and back. Use the up and down buttons to change color saturation.
The blue "B" button changes brightness in the same way.
To select a different lamp, push the white "W" button. The up and down buttons now switch to the next lamp. The currently selected lamp will blink in white.
You can use the "ON" and "OFF" buttons to switch on and off a lamp. When switching a lamp off, its color is copied into a buffer. When switching it back on, the color from the buffer is written to that lamp. This can be used as a copy-paste function. Just switch to another lamp, press the on button and the color is pasted.
That's it. As mentioned before, there probably are still lots of bugs in the code.
The lamp has four modes at the moment. They can be activated by the four function buttons "FLASH", "STROBE", "FADE" and "SMOOTH".
FLASH:
this is the constant color mode. If you press any color button, all lamps will switch to this color. The up and down buttons (or brighter, darker) change the hue (the software uses HSV color scheme). Brightness and saturation cannot be changed. Feel free to add this functionality (I almost never use this mode).
STROBE:
I called this mode "vivid colors". It is similar to the constant color mode. Select a color and all lamps will show a color that is similar to the selected one. They all fade slowly in brightness, hue and saturation with the hue being kept close to the selected color. If you select white as the color ("W" key) the color is selected randomly and also changes randomly from time to time (between 20 and 150 seconds).
FADE:
The rainbow mode. Lamps show a rainbow which slowly moves across. The color buttons do nothing in this mode. With the up and down buttons you can increase or decrease the total width of the rainbow, meaning the number of lamps it takes from red to blue. The default is six.
SMOOTH:
The program mode. Nothing moving here but you can program the color of each lamp and save it to any of the color buttons (is saved to eeprom, so they are kept in memory for many years but can be overwritten anytime).
To change the color of a lamp, push the red "R" button. The selected lamp (the master by default) will quickly fade through the colors to indicate you selected the hue change. Now use the up and down buttons (single clicks or long pressed) to select your hue.
With the green "G" button, you change the saturation. Pressing this button will be confirmed by quickly fading to white and back. Use the up and down buttons to change color saturation.
The blue "B" button changes brightness in the same way.
To select a different lamp, push the white "W" button. The up and down buttons now switch to the next lamp. The currently selected lamp will blink in white.
You can use the "ON" and "OFF" buttons to switch on and off a lamp. When switching a lamp off, its color is copied into a buffer. When switching it back on, the color from the buffer is written to that lamp. This can be used as a copy-paste function. Just switch to another lamp, press the on button and the color is pasted.
That's it. As mentioned before, there probably are still lots of bugs in the code.