While I was finalizing e-snowflake project, I imagined that single RGB 5050 LED would create nice rainbow effect if placed inside a ball like ping-pong. You can find plenty of such projects on the net, this one was heading to embed everything within ping-pong, battery included. The design challenge was to create PCB small enough to fit into ping-pong, design electronic on/off power switch and to supply LED with forward voltage drop higher than battery voltage.
The core part producing rainbow effect is MCU driving single RGB LED. Most of the hardware complexity manifests in two other concepts: step-up voltage regulator with stabilizer and electronic on/off power switch. Let me discuss all three major design parts.
Single attiny13 MCU drives 5050 RGB diode and using phase modulation of driver lines any rainbow color and brightness can be produced. The T3 transistor was introduced to isolate cathode LED lines when connected to ISP programmer. In theory when programming PORTB pins should be in default state, i.e. high-impedance, keeping T3 in high-impedance too. In practice when ISP programmer is working LED is blinking with dim light anyway – it means that in next schematic version R7 and T3 would be simply dropped.
Voltage regulator part is responsible for keeping voltage higher than battery can supply and stabilizing it when battery voltage drops over time. Higher voltage is necessary to keep LED operating because green and blue components have 3.1-3.3V of voltage drop in working conditions. The lithium-ion CR3032 button-battery that was chosen gives 3.1V when fresh and decrease output voltage down to 2.2V at 95% of its lifetime (see attached charts) and cannot power-on RGB LED.
The solution is based on LM2660 charge-pump in voltage doubling configuration giving output voltage from 6V down to nearly 4V. Changing voltage over time would lead to LED brightness dimming over time as well as 6V power supply would also exceed maximum rating for MCU. The LM1117 low-power step-down regulator is adjusted with R5-R6 divider to create 4.0V on output placed below doubled voltage of discharged battery. LM1117 introduces voltage dropout when input voltage is close to stabilized voltage – from datasheet it ranges from 1.1-1.3V for 100-800mA of load current respectively. I observed however that for fully operating device with 20mA current load dropout was even lower, measured as 1V. For my design it means that when input voltage drops below 5.0V (2.5V on battery), it is no longer stabilized and LM1117 output also drops down below 4V. Good news however is that 2.5V on battery is at the 90% of its lifetime; what’s more visible brightness drop happens when battery voltage is even lower, around 2.4V which is when the battery is almost dead.
To save on large components to fit on 40mm diameter PBC I skipped filtering capacitor between IC2 and IC3. Despite voltage ripple at the level of 120mV (at 4.0V and load of 20mA) and 10kHz frequency (charge-pump oscillator) the MCU works stable. Since analog part is not used, like ADC, weak filtering is not an issue here.
The last area of circuitry is “electronic power switch”. The idea behind is that one tact-switch can bootstrap power-line as well as initiate power-down phase later on. When device is powered off, pressing tact switch drives T2 and powers on the whole circuitry. While it is still pressed MCU has to drive T1 to keep T2 conducting after tact-switch is released. When the system in powered on, another depression of tact-switch can drive another pin of MCU which can react and cut off T1 and T2 effectively, leading to power down of the whole circuitry. Credits for this subsystem go to the Melanie from PIC forum where you can find detailed description.
This part was similarly complex to e-snowflake. Auto-router has problems fitting thick wires onto the tinny board. I had to route couple wires move nearly 1/3 of other wires and vias which took me nearly two hours (I am not a “speedy gonzales” of Eagle, that is the other part of the story). Having design ready I repainted on PNG file pads for tact-switch to solder it in horizontal position and let button stick outside of PCB boundaries – this way button can be easily exposed through the hole in ping-pong ball.
For more details, click: Rainbow glowing ping pong Using ATTing 13