LED Flowers are a set of PWM-controlled RGB LEDs which get their settings via USB using obdev.at's USB stack. Everything needed for this workshop is under a free license, so feel free to copy and modify.

To get started, you first need all the parts and a PCB. You can manufacture your PCB from the board data in the git repository (see Sources). The parts are listed in the Bill of Materials section including an order number from two german component sellers. Alternatively, you can just contact Marvin and ask him to send you a complete kit as there are some leftovers from the last workshop. If you ask nicely, he might solder the most complicated parts for you and even pre-program the microcontroller. Once you have obtained everything, go ahead and read the Tutorial. Also you may want to get inspired by all the other LED Flowers that have been created: LED Flowers.

Tutorial

Preface

This Tutorial consists of three parts. The first two parts do not necessarily have to be completed in the given order. Also, two people may work simultaneously, each on one part.

If you don't want so modify the project to look like something else (which of course would be perfectly okay) make sure that you execute every step exactly as described. Compare your result with the provided pictures. If you are unsure what to do contact Marvin prior to soldering. Also, the tutorial often uses designators like R4, C1 or U2. Those can be found on the PCB images at the top of this page, the Bill of Materials and the schematic.

If you encounter any problems with your device, you may also ask Marvin for support, but only if you include a correctly focused photograph of the bottom of your PCB that has an adequate resolution and an exact description of your problem.

Prerequisites

I highly recommend checking out the git repository with the current sources for the firmware and control programs. If you are building this in a workshop, you probably won't need it as your tutor may provide the initial firmware. However, the control programs are the one thing that make this project interesting. See LED Flower#Sources.

Clean the board with aceton before soldering.

Part I: The PCB

Microcontroller

The first step in soldering this board is also the most difficult: Soldering the microcontroller. We are going to use the drag soldering technique. To do so, we first place the microcontroller on the board to get an idea of how it should be placed afterwards. Notice the pin one mark which is a small dip in one corner of the IC. This is used to orient it correctly:

Before proceeding, please read the entire section about soldering the microcontroller and make sure you understood everything. Now remove the microcontroller again, select one pad of the PCB and tin it. For this and the next two steps, you don't have to worry about any solder bridges, we will remove them afterwards.

Now grab the microcontroller with a pair of tweezers, heat up the tinned pad and place the microcontroller correctly. Do not overheat the microcontroller: If you are not able to position the microcontroller within about 10 seconds remove the soldering iron and try again after waiting a short amount of time.

To further secure it, also solder one pin on the opposite corner.

Now select one edge of the microcontroller that has not been used in the previous steps and add some Flux to pins. What comes now is not easy and probably may require multiple attempts: Solder some pins one on side of the edge at once and then just slide the soldering iron slowly and without any pressure to the other side:

If you have done everything right (right speed, correct amount of solder and flux) all pins will be soldered to the board and there will be no bridges between them:

If you have created any bridges, there are two ways to get rid of them:

Add some flux (only if necessary) and drag the solder away from the microcontroller. You see in some of the pictures that I used this method here as there is solder relatively far away from the microcontroller.

Use a desoldering gun or wig.

However, repeat this process for the three other edges that are not yet soldered completely:

Decoupling Capacitors

To operate, the microcontroller needs a set of decoupling capacitors. These are two-padded components, so we will essentially replicate the first steps of the microcontroller soldering process:

Tin one pad,

add the component and

solder the other side.

The first one is C9, a 100 nF capacitor in a 1206 package, the biggest of the capacitors included in this kit:

Now continue with C1 using the same process. C1 is also a 100 nF capacitor, but in a 0603 package.

And now C2 and C3, both the same capacitor as C1.

Crystal Oscillator

Next step is the crystal oscillator. To prepare for that, we will first solder the capacitors C4 and C5 which are both 22 pf 0603 capacitors.

The crystal oscillator then goes directly on the other side of the PCB below those two capacitors. Just put it in and solder both pins.

Position of the Crystal

From the bottom

Solder both pins

Then clip off anything that is above the solder joint.

Clip off the excess wire

Programming and Analog Input Headers

Now we add two headers, one for programming the microcontroller, one for the analog input of the microcontroller. Again, the headers are on the back side of the PCB.

Now simply solder each pin to the PCB:

First Test

Get a lab power supply and set the maximum voltage to 5 V and the maximum current to zero. Connect the positive terminal (red) and negative terminal (black) as shown in the picture below:

The positive terminal goes to the leftmost pin of the shorter connector, the negative terminal to the middle one of the remaining three pins.

Slowly increase the current. The current should not exceed 20 mA.

If you have reached 20 mA, but the voltage is still below the previously set voltage limit, something is wrong. Do not further increase the current limit as this could damage the device. Check if every component is soldered and oriented correctly, check if there are any solder bridges.

If everything is okay, connect the in-system programmer. From left to right it's: MOSI, MISO, SCK, Vcc, GND, /RESET

Programming the Microcontroller

Go into the source folder, adapt the programmer.mk to use your programmer and execute make fuses:

If you are asked if you want to change back the efuse as it has not been written correctly, just say 'n'. In fact the fuse has probably been written correctly, the upper bits are just not writable and always remain 1.

To program the microcontroller and check if the oscillator is working, just execute make:

Finishing the PCB's Core

Base & Reset Resistors

Now we are going to add the /Reset pull-up resistor R1 and base resistors R8 to R19 and R38 to R40 with 3.6 kΩ resistors

Transistors

Now we are adding the transistors T1 to T18 (BC807).

LED Resistors

Next are the resistors that limit the current flow through the LEDs. If you are using the parts supplied at the 27C3 Peace Mission in Göttingen, you can just use the values given here. If you are using other LEDs, please calculate your own Values. First are the 150 Ω resistors R32 to R37 for the red LEDs. Then the 100 Ω resistors R26 to R31 for the green and R20 to R25 for the blue LEDs are following:

The red resistors...

...and red, green and blue.

Optional: USB Power Supply

One way to supply the device is to use USB power. However, you should note that if you choose this option, you are not able to plug in the external power supply while the device is connected to USB. Also, the device may not conform to the USB specification in terms of power limitations.

To activate the USB power supply, just solder the 10 uH coil to L1 and a 10 uF capacitor to C6:

Optional: Voltage Regulator for external Supply

Instead of using the USB power supply, you can also add an external supply, for example a 9V battery. Do not use USB power supply and the external voltage regulator simultaneously!

To use this supply, add a two pin connector as shown below:

Then add a 1N400x diode to D1, an LM1117 (AMS1117, &c.) to U2 and 10 uF, 10V capacitors to C7 and C8:

Test the voltage regulator by setting your lab power supply to 7.5 V and 0 A. Connect the supply to the two pins you just added and slowly increase the current limit. You should see a current of about 20 to 30 mA when the voltage limit is reached. If this is not the case, you probably did something wrong.

Optional: Button

Add the button BTN and resistor R41 (3.6 kΩ)

Part II: The LEDs

For this part you will need 6 RGB LEDs, about 20 centimeters of heat shrink and enameled copper wire with a diameter of 0.6 to 1.0 mm (more may work too, less may not be stable enough).

Cut 4 pieces of wire off the spool, each about 30 to 40 cm in length.

Use enamel removal tweezers to get 5 mm of clean copper on one end of each wire.

Get one LED and bend the leads outwards to about 20 to 30 degrees. This does not have to be exact as we will bend them back once we are finished.

Mount the LED in one finger of a third hand and pre-tin its leads.

Now, also tin all four wires at the end where you removed the enamel.

You can now solder the copper wires to the LED lead without adding new solder. Try to solder the wires as near to the LED case as possible. Beware: The copper wire may heat up faster than you think.

After soldering all four wires, you can turn the LED around and clip off any extra lead.

To prevent any short circuits, cut the heat shrink into sizes that are long enough to cover the remaining LED lead and put those pieces on the leads.

There are many ways to shrink a heat shrink. The probably most simplistic one is to use a lighter. However, do not put the heat shrink into the flame, about 5 to 10 centimeters above the flame are enough.

Now switch to the other end of the copper wires. Place them in a drill chuck. Make sure that the length of all wires from the chuck opening to the LED is equal.

Firmly grab the other side of the wires and slowly start the drill. You should get something like in the images below.

Release the drill chuck and cut all wires to equal size. Then remove about 5 mm of enamel. Though this is not necessary it may be a good idea to tin the end of the wires.

It's time to test our construction. Get a lab power supply, set the voltage limit to about 3.2 V and the current limit to 10 to 20 mA. Then probe different combinations on the of the wires to find out what lead is connected to ground, positive red, positive green or positive blue:

To adapt the wires to the PCB, they should be bent so they are in the following order: ground, positive red, positive green and positive blue.

Part III: Putting them together

Now we put the result of part I and part II together.

To do so, we first make sure that the legs are still in the correct order: Ground, Red +, Green +, Blue +. Do this as described in part II:

Somehow mark the ground pin, for example by bending it outwards:

Put the LED into the PCB. The Ground pin is the one that is clockwise the last (from the component side of the PCB, the side with the microcontroller) or the first (from the top side of the PCB, the side with the USB and programming connector).

Just solder it. Make sure that the solder joints are good as those will have to withstand any force applied to the LED.

Now just test the LED and repeat these steps for the next five LEDs.

What now?

Well, everything necessary is done! Now:

Decorate, paint and glue until this really looks like a flower or whatever you want to have.

Check out control programs from the official git sources to this project (see Sources).

Feel free to contribute any new ideas and send a photo of your flower to fl@deaggi.net or simply add it yourself to LED Flowers.

Known Issues

This project ist far from perfect:

We do not yet implement correct LED fading. For correct human perception of the different brightness levels we would have to implement a logarithmic scale. There are some trials to do so using a 16-bit PWM instead of 8 bits in the git history, however, they all brought up different more severe issues.

Sometimes some PWM actions are deferred due to the time-critical in-software USB operation. This leads to perceivable flickering of the LEDs when they are at a low brightness level. This also complicates the issue above as this makes it a bit harder to implement a correction on the host side.

However, both issues can be ignored, as long as you do not need calibrated colors and on every RGB LED there is one LED that is at brightness level 15 or higher.