Mood-Cube (Li-ion Mood Light)




Introduction: Mood-Cube (Li-ion Mood Light)

About: I'm a student at UW-Milwaukee studying computer science with a passion for electronics. I'm always working on a project or thinking of new ideas. If you have any questions about any of my instructables, or w...

In the electronic's section of everyone seems to show great affection for LEDs. After reading many articles, I thought it'd be a good time to contribute to the plethora of LED projects. Presenting... Mood-Cube! This small "cube" consists only of one RGB led and a tiny arduino chip (the attiny85), but it packs a punch. It has four modes, 1.Rainbow Fade 2.RGB Fade 3. Random Blink 4. Color Chooser, as well as a speed-adjusting potentiometer. It all runs on a 3.7 volt lithium-ion battery, which charges via USB, that has a battery life of about 3 hours (of constant use). The Mood-Cube's RGB LED's light is optimized by diffusion from its black-white acrylic case to make it shine brightly, while sustaining a long battery life. The "cube" is a great project for all skill-types since, It uses minimal components, and it still has the customization that any electronics/computer guru would want!

Before we start, I need to give credit where it is due. This project was inspired by Leone Lab's PixelBrite. I insist that you visit their page and check out their project. After creating my own PixelBrite, I thought of how I could create the same type of LED art but smaller and cheaper, so more people could make their own. So as a tribute to the PixelBrite, I present the Mood-Cube!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Parts

List of parts:

-Attiny85 (with socket)

-1 RGB LED (Common Cathode)

-A 3.7V Li-ion battery (I salvaged mine from a broken digital picture frame key-chain)

-Molex connectors (optional)

-1 push-button switch

-1 two-way slide switch

-1 10k Potentiometer (any value will do)

-4 50 ohm resistors (anywhere between 40 and 80 is OK)

-Female headers (for programming attiny85 after it is soldered)

-Perfboard (mine was 5cm by 7cm)

-Black-white acrylic sheet


List of tools:


-Soldering Iron (with rosin)

-Another Arduino to program the attiny85 (such as: Arduino Uno, Mega, Duemilanove, etc)

-Hot glue gun


As always, many of these values are only suggestions (such as resistor values). If you are a normal person, unlike me, and do not have any li-ion batteries laying around, you can always use a external power supply to suit your needs.

Step 2: Breadboarding!

For this build I'm going to assume that you know how to program an attiny85. For those of you who do not know, here is a awesome instructable that explains how. For all of you Arduino Mega users, you will use pins 50-53 instead of the ones depicted in the link, (due to the placement of the MISO, MOSI, and SCK).

Sorry for assuming so many things about you, but I'm going to also assume you know how to read a schematic too.

Once we are on the same page, we can implement the schematic (see the attached pictures). It's up to you, but I suggest getting the circuit built, then worrying about the code. We will address the code in the following step.

Chart of what-goes-where (attiny "pin"s do not mean the physical pins)

*****COMPONENT****|**ATTINY "PIN" (see attiny pinout for pin numbers)**

...........LED RED........|...........0

......LED GREEN .......|...........1

.........LED BLUE........|...........2

....POTENTIOMETER |...........3

.........BUTTON .........|............4

For those who learn by watching, here is a video of my breadboard implementation:

Step 3: The Code

Before we begin discussing code, It is important that you understand the basics of any programming language. I will be using terms and keywords that I assume you know so it is well worth a few minutes to watch some simple YouTube videos on programming before continuing.

With only one button and knob we have to find a way to navigate through animations. I used a state-based method. Using a switch, each time the digitalRead(button) is LOW (since we connected it to ground), we will have the program change states.

It is important to know that to make the RGB LED change to any color, we must use what is known as PWM (Pulse Width Modulation). This is basically a means of using a digital pin to do variable amounts of work. Instead of either being ON or OFF, (100% work or 0%), the pin can do any percentage of work between HIGH and LOW. However, the attiny85 only has two pins capable of PWM (0 and 1). So in the code, I have included a method (which is NOT my work) named softPWM. (AKA Software PWM). This allows us to use PWM on anyone of the attiny's pins! (See the picture for visual representation, picture from

Side note: To have states change using the button while inside of a loop( or other busy work), we could use interrupts. However, for simplicity's sake, I just used simple "if" logic to break out of loops or return from methods if digitalRead(button) is LOW.

Also please note that the "rainbow fade" effect code was actually a contribution from a different instructable: . I suggest you give it a look/favorite for it is a well worded instructable on a similar project.

I have uploaded the code as a text file. To use it simply copy the content into your arduino sketch and upload to the attiny85!

Step 4: Find the PERF Layout!

Before we heat up the soldering iron, lets make a list of priorities of what we need from the perfboard layout. We need:

1.The LED to be the highest component by several centimeters

2.Access to buttons/knobs/switches externally

3.A maintainable design

4.Room to place our Li-ion battery (for external charging).

To make the LED the highest component, just used the long leads on the LED to give it some height. It would be a better design of you were to add some support to the LED; however, this method "works".

To have access to inputs such as buttons, we will need to drill some holes in the case and screw in our inputs for external control. So lets make sure that our inputs are all able to reach a side of the "cube" where our control panel will be.

To make this a maintainable product, I opted to use molex connectors for each input. This is so that replacing a button/pot/switch will not interfere with the main board, and so we can swap out parts easily.

To access the li-ion battery from the outside, I simply hot glued the charging board with the battery to my perfboard, you could use screws or even molex connectors too.

There's much more to consider for the layout of this project, but it would be too much content to write in this instructable. So I'll once again assume you have some good intuition! Lets move onto soldering!

Step 5: Soldering

Once you've played around with the circuit, we can put it onto a piece of perfboard. Review what we talked about in the last step before you begin soldering. To save myself time, I'll quote my last instructable's (555 Pocket Synth) soldering tips:

-Keep your breadboard implementation nearby while soldering so you have a reference other than the schematic to use.

-When soldering a component with more than one lead (or pin), to ensure that it is soldered tightly to the perfboard, solder one lead (or pin) onto the board first. Then check if the component is straight, if its not then heat the lead and adjust until it is. This technique is a lot more effective than soldering in an entire 8 pin integrated circuit (such as the 555), then learning that it isn't in the perfboard straight.

-Get a desoldering iron. These are optional, but highly recommended. They are good for salvaging parts off of electronics and fixing major mishaps in your projects.

-Use resistor's long leads to make connections. It is a lot more efficient than using tons of wires. -Use lots of hot glue to ensure that your circuit is permanent and to keep resistor leads from touching other components/conductive surfaces.

-Use an exacto knife (or any knife) to troubleshoot for shorts. I always run a knife between suspicious connections that may be touching, to scrape away any excess metal that may be joining them. -Remember electrolytic capacitors have a negative lead and a positive lead, while ceramics do not.

-Try not to touch the tip!

Be sure to solder female headers to each pin of the attiny85 for programming on the perfboard!

Step 6: The Case

What sets this mood-light apart from the rest, is its stylish case. The material I used was "black-white acrylic". It is rather hard to find so you will probably have to order it online, but it is well worth the wait

But before we touch the acrylic, It is good to make model using paper first. (See pictures 1-2).

Once you have your acrylic, we can begin making the cube. We are going to need six pieces. Four being 3 1/2 by 3 inches and two being 3 inch squares. IMPORTANT NOTE!: I have not added the thickness of the acrylic to these measurements. BEFORE YOU CUT, add the thickness of your material my measurements!

To cut your acrylic I suggest drawing out all the cuts that need to be made and taking your sheet to your local hardware store, or Home Depot (since they are a kind sponser of, and ask that they cut it for you. I got mine $1 per cut, and the cuts were perfect. Otherwise, you could use a blade/table saw to make the cuts yourself! (See pictures 3-5)

After all the pieces are cut, we can drill holes for our external inputs. A dremel tool works great for this, (a power drill will work too). We need to cut four holes, (for our knob, button, two-way switch, and li-ion charging port). You can choose where to drill them (sketch cuts with pencil first), but I found my configuration is pretty efficient (See pictures 5 and 7)

Now we can arrange these pieces into a cube! There are many ways you could attach the pieces: hot glue, acrylic-based glue, hinges, screws. I would suggest having a hinge on the side for maintenance.

Before you seal the cube, we have to arrange the main board and all the inputs. Begin by removing the inputs (from the molex connectors), and screwing them into the holes you drilled in the case. Next find a way to fasten your main board to the bottom (in the inside) of the case. I suggest using screws. Connect your inputs (via molex connectors) to the main board. And finally cut a piece of posterboard/foamboard the size of the cube's center, (with a LED sized hole in the center), and slide it over the LED to hide wires and protect the circuit. (See pictures 6-13)

Now just seal up the entire cube and your Mood-Cube is ready to glow!

Step 7: Enjoy!

Congratulations, you have made your own mesmerizing Mood-Cube! You can use it to accent any room by using its four color functions. I found that the "color chooser" function works great if you want to match the cube to a color scheme in a room. Or allow the cube to set you to sleep with its rainbow function. I hope you have learned a bit about PWM, attinys, and programming. I would like to give one final thanks to the maker of PixelBrite, and other makers of LED art. Thank you for reading!

Lamps and Lighting

Participated in the
Lamps and Lighting

Battery Powered Contest

Participated in the
Battery Powered Contest

Be the First to Share


    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Finish It Already Speed Challenge

      Finish It Already Speed Challenge

    4 Discussions


    7 months ago

    Love the black acryllic look! What kind of acryllic is it specifically? Wouldn't black acryllic normally block all of the light i.e opaque?


    Awesome project!!!! I'd like to make it too, but i have only Common Anode RGB leds.

    Do you thing there's something to change in the code? Or just the wiring?


    Reply 5 years ago

    Thanks for your interest in the project! And yes I believe there will need to be a change in code as well as the wiring. I'll get back to you on the specifics, but there are plenty of other instructables showing the code differences from common cathode and anode leds for you to look at in the meantime!