RGB LED Ring — now available as DIY SMD kit !

The RGB LED Ring is available as a DIY SMD kit! Honestly, ignore the next two paragraphs :-)


4576775492_df54a0f5be_o



Well as of next Monday 18:00 CET to be honest (May 17th 2010). I’ve already added it to zen-cart, but it’s still marked as sold out. This morning FedEx didn’t manage to deliver the shipment from Mouser containing the vital ATmega168 chips — and they didn’t even leave a note :-(

I haven’t done all of the math yet, but basically I’ll be giving these away at cost. The fun is in the making and releasing. I couldn’t live on selling these things anyway. …1 or 2 days later… I’ve done the math and ‘at cost’ is 9.35€ + shipping.

It has been upgraded to version 1.21 and now comes with proper LED ordering, fully functional auto-reset and last but not least an onboard ultra low drop voltage regulator. You can supply it with 4 to 12V DC and it will work just fine. No costly boost converter for 5V is required anymore. The voltage regulator is very powerful and can drive more than just this little board. If other parts of your project should need 5V as well, you can use it to feed power to them. It should be good enough to drive an Arduino board and a few standard LEDs.

You should feel at home with soldering SMD parts of sizes 0805 and larger. If you haven’t completed any SMD projects before, better watch a few tutorials first. It is not difficult as such, but you’re likely to kill the SMD LEDs without “enough” practice – and they don’t come cheap. Nowadays taking apart broken devices is a good and cheap source for SMD practice material!

To get started you’ll need an AVR programmer (usbtiny, AVR ISP MKII …). Once you’ve flashed the Arduino bootloader, I recommend using an FTDI adapter such as the Moderndevice BUB I or the FTDI Basic Breakout – 5V for convenience.

I can recommend the USBtinyISP or the Pocket AVR Programmer. Both cost about 15$-25$ and are compatible with AVRDUDE and work on Linux and MAC OS (and windoze if you have that). You can also easily use the Arduino IDE with both of them.

As seen on hackedgadgets and in previous posts [1],[2] on my blog.

 


Assembly instructions:


0. Ingredients
1. Identify all parts
2. Solder it
      2.1 Paying special attention to the RGB LEDs
      2.2 Soldering tips
3. Flash it
      3.1 Flash it – an update
4. Be creative
      4.1 Arduino pin names
      4.2 Battery Power
      4.3 I²C / 2-Wire
      4.4 Voltage regulator
5. Hacks, Mods
      5.1 More light hack
      5.2 Extremely more light hack
6. Upload code
      6.1 Adding the board to the Arduino-IDE
      6.2 Upload code with an Arduino board (ArduinoISP)
      6.3 Upload code with an FTDI adapter
7. Share your projects


If you have any trouble, please use the forum!

0. Ingredients

1x PCB (big round orange object)
1x 10k Ohm 0805 (R4)
1x 91 Ohm 0805 (RED, R2)
1x 390 Ohm 0805 (GREEN, R3)
1x 110 Ohm 0805 (BLUE, R1)
2x 10µF, 16V, tantalum, polarized, A3216
1x 10µF, 25V, ceramic, X5R, 1206
2x 100nF, 50V, ceramic, X7R, 0805
1x TS 2940 CW-5.0, voltage regulator, SOT-223
1x anti static bag
2x 10×1 female header (need cutting to size)
2x 3×2 male header
1x 6×1 male header
1x 3×1 male header
1x Atmega168-AU, TQFP-32 7×7
4x low profile jumper h=4mm
8x RGB LEDs PLCC6 5050 (ebay: JELEDHK, green very! efficient, R: 1.76V, G: 2.34V, B: 2.52V)

top

1. Identify all parts

The single biggest and most obvious component is the printed circuit board. Its orange color will make it stick out quite nicely.

4499653722_335f82a4dd_o 4499017467_1acde33a0c_o

The 8 RGB LEDs are easily recognized, as they’re white. The ATmega168 microcontroller sits like a fat black spider in its web. Both components require proper orientation and have orientation marks (dots, notches…).

4576774454_db92585fcc_o

The remaining components are all on the back side of the board.

4577038098_6bc25e9595_o

The brownish parts are unpolarized ceramic capacitors (C1, C2, C3). As long as they’re put to the right spot, orientation doesn’t matter. The black components are resistors, right spot required, orientation doesn’t matter (R1-R4). The somewhat larger and 4 legged IC is a low drop 5V voltage regulator and only fits in one orientation. The orange parts with the bar are polarized tantalum capacitors. They will blow up if orientation is wrong. The bar points to the anode (+). All the rest is just headers and jumpers. The 10pin female headers need to be cut to size before they fit. It is quite easy with a good and sturdy wire cutter. Take a look at the images in the soldering section.

If there are any missing parts, please let me know.

top

2. Solder it

Be sure to use plenty of flux. It is imperative that you keep soldering time and temperature at an absolute minimum. The resistors, ceramic capacitors and, to some degree, the ATmega168 are quite forgiving, but the tantalum capacitors and especially the RGB LEDs are easily damaged terminally!

There is no strict order for soldering, but I suggest putting on the ATmega168 as the first part and then continue with the 8 RGB LEDs. Then take care of the voltage regulator. The remaining resistors and capacitors go on as you please. The headers should be put on as the very last parts to avoid interference and burnt plastic.

Correct orientation of critical parts:

  • The bar on the tantalum capacitors (C4, C5) must point to the (+) mark on the PCB
  • The orientation notch on the RGB LEDs (D1-D8) must point to the center of the PCB
  • The orientation dot on the ATmega chip must match with the dot on the PCB

How to safely solder and test the RGB LEDs:

Due to a last minute change of the RGB LEDs, the silkscreen on the PCB is incorrect! Please assemble the LEDs as shown in the video.

top

2.1 Paying special attention to the RGB LEDs

As mentioned before these RGB LEDs don’t particularly like heat. Especially one pad of the green LED, the smallest one, overheats easily. In the picture below it is the middle pad at the bottom.

4576774330_9349213c6f_o

For this pad I advise extreme caution. If you have an adjustable soldering station (which I highly recommend), set the temperature to 240°C and you’ll be fine with Sn60Pb40 solder. Anything above that is likely to kill the LEDs. If you have a multimeter check if the LED works after having soldered the middle pads (top and bottom). Don’t use this pad for initial tacking! Use any other one, but not this one.

A damaged LED looks like this:

4772746012_342aca1808_o

Replacing the LED is the only way to ‘fix’ it.

top

2.2 Soldering tips:

As you should know by now, always keep the tip clean and shiny. Use flux. If you have an adjustable soldering station, don’t turn it too high. This will make the tip last longer, less black stuff will accumulate and the flux won’t boil off as quickly. Always make sure you touch the parts and pads long enough to make the solder flow properly to all spots. For this kit I’ve used these temperatures and Sn60Pb40 solder: 240°C for the RGB LEDs and the small parts including the ATmega chip. You’ll have to touch the LEDs’ pads a bit longer to make the solder flow everywhere, but at least the darn things won’t melt. 280°C for all the headers and the voltage regulator, as there’s much more copper to heat up.

top

3. Flash it

Your first step will be to make sure the 4 jumpers are placed correctly. For now it is recommended to keep the VSEL jumper in its default position, which is next to the mark on the PCB. Due to it being a low drop regulator, this will work in most cases. If you know exactly what you’re doing, do as you please.

The ISP_E jumpers must be removed for ISP programming, as the pins are shared with the LEDs. Once the bootloader has been flashed you can put them back and won’t have to touch them anymore. Pin1 of your programmer’s cable will be marked by a red wire and must line up with the arrow mark on the PCB.

Make sure to follow these instructions. It is extremely critical that the FUSE settings are correct, as a bricked chip requires quite some effort to be revived. The bootloader hexfile comes with the Arduino software and can be found in this folder: “/arduino-0018/hardware/arduino/bootloaders/atmega”.

3.1 Flash it – an update

As of now, all boards ordered as ‘assembled’ come preloaded with a short demo + ‘optiboot’. You’ll find a combined .hex file in the code repository. The fuse settings for this bootloader are different as well. For details, please have a look at Adding the board to the Arduino-IDE. For tinkerers: the correct fuse settings can be found in ‘boards.txt.modif’, which is in the code repository as well. Just download the latest .zip snapshot.

top

4. Be creative

For starters I recommend using the Arduino IDE! You should choose the ‘Arduino Pro or Pro Mini (3.3V, 8MHz) w/ ATmega168’ in the boards menu. This makes sure your code is compiled with the correct CPU frequency settings. Demo code for grabs. You’ll find all design files in KICAD format (including schematic as PDF and Gerger files for easy reproduction) there as well.

top

4.1 Arduino pin names

If you look at the demo code, you’ll find out that I didn’t use Arduino’s ‘digitalWrite()‘ and ‘pinMode()’ all the time, but replaced it with ‘direct port manipulation‘ to make it speedier.

If that should give you trouble when writing your own code initially, don’t worry! You CAN use the conventional Arduino way for most pins as well.

The LEDs are connected to these pins:

* all RED anodes go to: ‘PD6’ – equivalent Arduino pin: digital pin #6
* all GREEN anodes go to: ‘PD5’ – equivalent Arduino pin: digital pin #5
* all BLUE anodes go to: ‘PD7’ – equivalent Arduino pin: digital pin #7

* common cathode LED0: ‘PB0’ – equivalent Arduino pin: digital pin #8
* common cathode LED1: ‘PB1’ – equivalent Arduino pin: digital pin #9
* common cathode LED2: ‘PB2’ – equivalent Arduino pin: digital pin #10
* common cathode LED3: ‘PB3’ – equivalent Arduino pin: digital pin #11
* common cathode LED4: ‘PB4’ – equivalent Arduino pin: digital pin #12
* common cathode LED5: ‘PB5’ – equivalent Arduino pin: digital pin #13
* common cathode LED6: ‘PB6’ – equivalent Arduino pin: -none-
* common cathode LED7: ‘PB7’ – equivalent Arduino pin: -none-

For ‘PB6’ and ‘PB7’ you’ll have to use direct port manipulation. It’s not really hard, once you’ve wrapped your head around it!

The headers on the backside expose:

* SCL (‘PC5’) – equivalent Arduino pin: analog pin #5 / digital pin #19
* SCA (‘PC4’) – equivalent Arduino pin: analog pin #4 / digital pin #18
* ‘PC3’ – equivalent Arduino pin: analog pin #3 / digital pin #17
* ‘PC2’ – equivalent Arduino pin: analog pin #2 / digital pin #16

You’ll find a simple example to light a single LED the ‘Arduino way’ in the code repo. If you want to light up LEDs of different colour ‘at the same time’, you’ll have to use the supplied code running the interrupt routine. It relies of ‘persistence of vision’ and switches the LEDs on/off very quickly to give the desired effect.

top

4.2 Battery Power

To get proper color reproduction and brightness from the LEDs, you should at least supply 3.5V to it (bypassing the on-board regulator using the “VSEL” jumper). It will work at lower voltages, but colors tend to get somewhat reddish and dimmer. The hard bottom limit is the 2.7V brown-out-reset.

If for example you’d like to use 2 of these as improved tail lights for your bike, I suggest using 3x AAA cells. This would give about 4V in case of fully charged rechargeable ones, or about 4.5V for standard alkaline cells. Remember to stay below 5.0V, if the on-board regulator is bypassed. When the brown-out-reset finally kicks in at 2.7V, both types will be completely sucked dry and you won’t have wasted any energy in voltage regulators.

A ‘high-tech’ power supply could be constructed using 2x AA cells, battery clips, inductor, diode, a few capacitors and a 5V boost converter IC like a MAX756. Using a ‘Minty Boost‘ as inspiration is a good idea.

If you’d like to use 9V cells, which I don’t recommend (expensive, low capacity), set the “VSEL” jumper to its default position (1-2) and feed power to “Vin” and “-“. Please continue reading for more details on using “VSEL” correctly.

top

4.3 I²C / 2-Wire

As I²C devices only pull the SDA/SCL lines low, you need pull-up resistors to the supply voltage! It may be the case that the libraries supplied with the Arduino IDE enable internal pull-up resistors, but they are only weak pull-ups. It may be necessary to add dedicated 4.7kΩ resistors to make it work reliably.

top

4.4 Voltage regulator

4063089542_f137845222_o

The on-board low-drop voltage regulator can be used or bypassed by setting the position of the “VSEL” jumper. In its default position (1-2, indicated by the little triangle) the “Vin” contacts are routed through the regulator and you can use voltages from 6-12V DC to power the device via the “Vin” and “-” contacts. In the (2-3) position the regulator is bypassed and “Vin” is directly connected to “+”. Therefore you may only use DC voltages up to 5V, just like on all the other pins of the device.

When would you want to bypass the voltage regulator? If you want / need to power a chain of boards with 5V or less:

5303765304_b35e464f1a_o

To insure that the boards get the correct voltage, I recommend to inject power every 8 units. This is limited by the voltage drop in the copper traces and the brown-out-reset kicking in.

top

5. Hacks, Mods

5.1 More light hack

If all you care for is getting the most BANG out of the little bugger and don’t mind color balance much, you can use 91Ω resistors for all colors. The green LEDs gain the most out of this hack, so everything gets a little greener. Yellow becomes a greenish yellow, but white is still white though. The blue LED get a little brighter, but not much. I’d post pictures or a video showing the effect, but my camera is saturated already. The current going through the LEDs (and the micro) is still safe and nothing should fry.

top

5.2 Extremely more light hack

This one doesn’t affect white balance, everything just gets brighter ;-)

It needs some changes in the code as well. Essentially each color is now driven by 2 GPIO pins in parallel resulting in more current going through the LEDs. You’ll need 3 fine wires and another set of 3 resistors (390Ω, 91Ω, 110Ω). Just decreasing the resistors that are already in there would over-stress the output drivers. The bottom left (GREEN – 390Ω) goes to the AVR pin #32 (PD2), the middle (RED – 91Ω) to #1 (PD3) and the right (BLUE – 110Ω) to #2 (PD4).

4951718255_8008a7610a_o

4952308740_e5102f69fa_o

The code necessary to drive this can be found in the GIT repository. It should be considered as ‘experimental’. If you should choose to apply this hack to your board, make sure to only switch the anodes (e.g. RED_A, RED_A2) at the same time. If e.g. RED_A2 is not used, it must first be declared as an input ( DDRD &= ~(1 << RED_A2) ) and 2nd the internal pull-up resistor should be off ( PORTD &= ~(1 << RED_A2) ). Otherwise it will quasi short RED_A to GND. It doesn't instantly kill the board as there are resistors in there, but nevertheless it's not good practice.

This hack pushes the AVR chip to its limits – and maybe even above. For example one possible and unfavourable LED state is just having _one_ LED statically on. As long as you keep two or more LEDS lit it should be OK. Using the full RGB PWM mode or the 7 color mode is somewhat safer, as the LEDs are multiplexed. Nevertheless if the chip dies I blatantly refuse to be responsible. You’ve been warned.

top

6. Upload code

Connect your favourite USB/TTL adapter to the board and upload using the bootloader. Make sure the pinout matches the silkscreen on the board.

6.1 Adding the board to the Arduino-IDE

This is easy. Locate ‘boards.txt’ in the arduino folder on your system and add the contents of ‘board.txt.modif’ to it. You can find that file on the code repository page. This provides two entries to the Arduino IDE boards list. One is set for uploading using the ‘optiboot’ bootloader, one for uploading using the ‘usbtiny’ AVR programmer. The correct fuse settings are in that file as well, in case you want to do all of this by hand. As of now, all boards will be preloaded with a demo routine + the ‘optiboot’ bootloader. A combined .hex file is in the code repository as well.

6.2 Upload code with an Arduino board (ArduinoISP)

1) Load the sketch “ArduinoISP” (File->Examples…) onto your Arduino board as you would upload any other program to that board, i.e. select the correct board type to match your Arduino board and press upload.

2) Connect the wires as shown below:

arduino_led_ring_upload

3) Change the board type to “RGB LED RING – ATmega168 / 8MHz RC OSC / ISP” and load the sketch you want to upload to the LED ring board. For this to work you must have finished the part about using the custom “boards.txt” with the Arduino IDE.

4) Change the programmer to “Arduino as ISP” (Tools->Programmer…)

5) Compile the sketch for the LED board as usual and then upload the code with “File->Upload Using Programmer”.

Please note that this method wipes the bootloader off the chip. If you should need it again, change the board type to “RGB LED RING – … optiboot 19k2 (default)” and use your ArduinoISP to burn the bootloader.

6.3 Upload code with an FTDI adapter

This should work if you got an assembled board from me. Select “RGB LED RING – ATmega168 / 8MHz RC OSC / optiboot 19k2 (default)” for the board, connect the adapter and compile / upload as usual.

In case this doesn’t work and you have another Arduino board at hand, step 6.2 should get you there. Next to using a dedicated AVR programmer, this method is the most reliable one. Unfortunately the internal RC oscillators of the AVR chips are not that precise, which may hinder reliable serial communication.

top

7. Share your projects

Please post a comment with a link to your creations!

top

This entry was posted in Arduino., DIY., Electronics. and tagged , , , . Bookmark the permalink.

17 Responses to RGB LED Ring — now available as DIY SMD kit !

  1. Kevin Groce says:

    I want two of them now lol :)

  2. robert says:

    Patience ;-) Monday is tomorrow. And if the FedEx driver makes it this time, all parts are here. I guess the last time he just didn’t want to walk to my place, hence no note was in my mailbox. The whole complex is barred for vehicles, maybe that’s why it said “…or business closed…” on the tracking page. This time he’s got my phone number, so I’m expecting a call like this: “… can’t get in… doesn’t say anything about walking… open the gate… mumble mumble…”

  3. robert says:

    The chips have arrived!

    I’ll check a few, put up some pictures on flickr and do the inevitable math, so yous can see how much ‘at cost’ really stands for. It will be significantly cheaper than e.g. an Arduino Lilypad – and I’m almost cutting my own throat here ;-)

  4. eugene says:

    Wow, great work.
    I have a different POV on my bike wheel.

    Where did you find the library part for the plcc6 5050 or did you create it.
    Would you be willing to share the library part? for eagle?

    thanks

  5. robert says:

    I whipped it up myself, which wasn’t hard. But as I solely use KiCAD, I can’t provide any eagle files. I don’t know if there is a KiCAD –> Eagle converter out there.

    I suppose it won’t be any help, but the symbol is embedded in rgb_led_toy.cache.lib and the footprint is embedded in rgb_led_toy.brd. Both are ASCII files and you could search for “RGB_SMD”.

  6. eugene says:

    Thanks for sharing!

  7. Pingback: Electronics-Lab.com Blog » Blog Archive » RGB LED Ring

  8. PCB says:

    Hi!
    Do you accept paypal, and where can I download a free eagle PCB plotter software, is it okay to use your project to my school project if you don’t mind?
    Best,
    Gian PCB guy

  9. robert says:

    Yes, paypal is ok with me. Just google for eagle and cadsoft and you’ll get the link straight away. But the ‘freeware’ licensed version is size limited. Therefore I use KiCAD for my projects. And yes again, you can use my project for whatever you want.

  10. Pingback: RGB LED Ring V2 — sequels don’t have to be bad | My 2µF

  11. Yvett says:

    Hi

    I would like to know if you have this ring size 25mm outer diameter I would like to buy 10?

  12. robert says:

    Unfortunately I don’t have anything smaller than this. The outer diameter is about 43.5mm

  13. Tom says:

    I’m fairly new to the whole arduino scene. I’ve litterally just bought one of your led rings which arrived last week and a arduino uno r3. I’ve wired it upto the arduino as you documented, making sure to remove my atmega328. Installed ardunino ide for windows, modified/updated the boards.txt, put the hex file into the optiboot folder and added ShiftPWM and neopixel libraries. However I’ve hit a road block when trying to upload to the atmega168. In my ardunino IDE, The Board is set to ‘RGB LED RING – ATmega168 / 8MHz RC OSC / optiboot 19k2 (default)’. Programmer is default on AVRISP mkII. I’ve checked to ensure the right com port is selected. But if i try for example to upload the neopixel demo, im just hit with the following error: “avrdude: stk500_getsync(): not in sync: resp=0x00”

    Any ideas where I’m going wrong or how I can troubleshoot this?
    Thanks,
    Tom

    • robert says:

      Give me a second and I’ll try to replicate what you’ve got.

    • robert says:

      I’ve revised the instructions (steps 6.2 / 6.3) and switched to a more reliable method of uploading code. The issue you may have run into is the inherent instability (frequency drift) of the micro-controllers internal clock generator (cheap RC-oscillator). This can throw off the serial communication.

      Using the Arduino board with the ArduinoISP sketch is the most reliable way to upload code, next to using a dedicated AVR programmer.

      Big plus: you don’t have to remove the chip anymore.

Comments are closed.