In this mini-DIY project, we will make a color-flashing coconut tree.
It has two 3W RGB LEDs using, which generate multicolor flashing effects. Also, a tiny 8-pin microcontroller ATtiny85 generates eye-catching colorful LED-chasing effects. It is battery-operated, and the battery is rechargeable so it does not require a power connection through wires. It can be placed anywhere and can be taken anywhere (fully mobile and portable). It is also easy to build and fun, including circuit making, wiring, soldering, crafting, cutting, watercolor painting, model making, etc.
First, we shall start with the circuit diagram, followed by circuit connections and working/operations, and finally, we will see how to prepare the complete model and outlook of a showpiece.
Schematic diagram
The complete circuit uses only four to five components, one module, and a battery cell. There are two 3W RGB LEDs, two 330E current limiting resistors, a microcontroller ATtiny85, an SPDT ON-OFF switch, and an LI-Ion battery charging module TP4056.
Circuit connections
RGB LED has 3 LEDs – Red, Green, and Blue. The anode terminals of all 3 LEDs are shorted and connected to +Ve output through a current limiting resistor. The cathode terminals are connected to pins 5, 6, and 7 of ATtiny85, as shown. Cross connections for R, G, and B LEDs are made in between 2 LEDs to generate two different colors at the same time from both RGB LEDs
The circuit is given power through a 3.7 [email protected] mAh Li-Ion battery cell. TP4056 module is used to charge the cell through any USB charger. The cell is connected between B+ and B- terminals. Its out+ and out- terminals are connected to the +ve supply and gnd of the circuit through the switch.
An SPDT type ON-OFF switch is connected between out+ and circuit supply to on/off power to the circuit.
Circuit working and operation
The microcontroller ATtiny85 turns ON and OFF Red, Green, and Blue LEDs one by one in a different sequence and generates different colors like Yellow, Orange, Magenta, Cyan, etc. Please refer to the table given below.
As the table shows, when any pin is given logic 0, it turns ON any one LED (red, green, or blue) in both RGB LEDs and generates two different colors. When two pins are low — two LEDs are turned ON, and that will generate combined colors (Yellow, Magenta, Cyan). RGB LEDs generate two colors simultaneously because of cross connections in R, G, and B inputs.
All three red, green, and blue LEDs are turned ON and OFF randomly at different rates (at different delays) so that it can generate the eye-catching multicolor chasing effect.
The software program is downloaded into the internal FLASH of ATtiny85 to turn ON/OFF all three red, green, and blue LEDs (the programming part is discussed afterward).
TP4056 module provides power to the circuit through a Li-Ion cell. When the cell discharges, the module charges the cell using a USB charger (any mobile phone charger can be used). There are two LEDs, red and blue, on the TP4056 module. Red LED indicates the charging of the cell, and a blue LED indicates the cell is fully charged.
Now let’s see how these circuits, battery cells, charging modules, etc. all, are housed inside the box and how the complete item is prepared.
As shown in the figure, the battery cell, circuit, and charging module are all packed inside a housing box of cardboard. The housing is painted using watercolor to look at a seashore. Three holes (openings) are provided — one for micro-USB connectors and two for two RGB LEDs. Two semi-transparent glue sticks are fixed precisely over the top of the LEDs so the LED light will fade through them. Plastic cut-outs like coconut tree leaves are fixed on the top of glue sticks using Fevicol glue to give them a coconut tree-like look. Then, you simply charge the Li-ion cell using any mobile USB charger through the TP4056 module, and when it is fully charged (indicated by the blue LED on the module), switch on the showpiece and enjoy a flashing colorful effect.
Software program
The program for the ATtiny85 microcontroller is written and compiled in Arduino IDE. The Arduino IDE supports the ATtiny85 microcontroller also. To see how to download the program into the internal flash memory of ATtiny85, please go through my tutorial article series on ATtiny85.
Here is the program for ATtiny85 compiled using Arduino IDE.
.gist-data{ height:250px; // Any height overflow: auto;
}
Youtube link for the article
RGB LED decorative tree using ATtiny85 – YouTube
You may also like:
Filed Under: Arduino, Arduino, Electronic Projects
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.