Enter Your Electronics & Design Project for a chance to win a $200 shopping cart! Back to homepage | Project14 Home | |
Monthly Themes | ||
Monthly Theme Poll |
I hadn't planned to submit an entry for the Recycling & Retrofitting challenge as I just didn't have any good ideas. However, the extended deadline and the recent lockdown meant that I had today spare so I thought - why not try something!
I had in mind to improve a small solar powered LED light that I have had in my garden for several years now that has ceased to function, due to battery failure. I wanted to replace the low powered battery with something bigger to create more light as well as microprocessor control to achieve a more satisfying LED flashing and illumination. So that is what I have done. Below is a video illustrating the original solar powered LED display thingy.
The video below shows the disassembled parts of the original solar powered LED display.
My aim with this upcycle was to replace the 1.2V Ni-MH battery with a 3.7V LiPo battery and charger. The solar cell only produces about 2V maximum so it couldn't be used to charge the LiP, hence the need for a USB charger. If I ever get a suitable solar cell of 5V or so that it may be possible to wire this into the LiPo charger. The LiPo battery is then used to power a DigiSpark ATtiny85 PCB to control a three colour LED as well as providing the potential for low power operation. The system diagram is illustrated below. The LED has a common Anode so when connection to ATtiny85 outputs the output needs to be low to turn on the LED. With a three colour LED it is possible to create most colours in addition to the main RED, BLUE and GREEN. I have only selected an additional WHITE (all the LEDs on) as colour mixing the LEDs is somewhat of a challenge and I didn't have the time.
The video below illustrates the new system before it is installed into the case. It is relatively simple and straight-forward. Sadly, due to the use of DuPont connectors it is a bit too large to fit into the original case, which is a shame. But, with more time and some rewiring I think it would be possible. Something for the future.
At this point I started to run out of time so the software is relatively simple. The main fragment is listed below:
while (1)
{
// LEDs on
pinMode(RED, OUTPUT);
pinMode(BLUE, OUTPUT);
pinMode(GREEN, OUTPUT);
REDfadeinout();
BLUEfadeinout();
GREENfadeinout();
WHITEfadeinout();
digitalWrite(RED, OFF);
digitalWrite(BLUE, OFF);
digitalWrite(GREEN, OFF);
pinMode(RED, INPUT);
pinMode(BLUE, INPUT);
pinMode(GREEN, INPUT);
rnumb = random(4000);
delay(rnumb);
// CPU sleeping LEDs off
LEDsoffSleeping();
} /* while */
I have created four functions to control the three LEDs, one for RED, one for BLUE, one for GREEN and one for WHITE (all the LEDs on). I have used for loops to create a fade in and a fade out and used random numbers to determine the amount of fade in and the amount of fade out, plus a random delay between sequences. The RED LED Function is listed below.
void REDfadeinout(void)
{
long randnumb;
int redindex;
int cindex;
randnumb = 0;
redindex = 0;
cindex = 0;
digitalWrite(BLUE, OFF);
digitalWrite(GREEN, OFF);
// Fade in the RED LED
randnumb = random(REDmaxfadein);
for (redindex = 1; redindex < randnumb; redindex++)
{
for (cindex = 0; cindex < 5; cindex++) // Repeat 10 ties
{
digitalWrite(RED, ON);
delayMicroseconds(redindex);
digitalWrite(RED, OFF);
delayMicroseconds(randnumb - (redindex - 1));
} /* for */
} /* for */
// Fade out the LED
randnumb = random(REDmaxfadeout);
for (redindex = randnumb; redindex > 0; redindex--)
{
for (cindex = 0; cindex < 5; cindex++) // Repeat 10 ties
{
digitalWrite(RED, ON);
delayMicroseconds(redindex);
digitalWrite(RED, OFF);
delayMicroseconds(randnumb - (redindex - 1));
} /* for */
} /* for */
} /* REDfadeinout */
The LED sequence is always the same: RED - BLUE - GREEN - WHITE, just due to the lack of time but it would be easy to create a random sequencing of colours as well.
Sadly, due to the use of DuPont connectors it is a bit too large to fit into the original case, which is a shame. But, with more time and some rewiring I think it would be possible. Something for the future. So I used the top off a starch spray can as the new base and the final working system is shown in the following video. It all works although it is not quite as low power as I wanted, but with some additional programming it will be possible to significantly reduce the current requirement, thereby extending the battery life before it needs recharging.
The LEDs are on for a period of approximately 4 seconds with an average current of about 15 mA. This is followed by a sleep period of 8 seconds which takes a current of 0.7 mA. This averages out to
((4 x 15) = (8 x 0.7))/12 = 5.5 mA
So a 1000 mAhr LiPo battery should last 1000/5.5 = 182 hours, or 7.6 days and should last until after Christmas Day.
So, there we are, a mostly fully working multi-colour battery powered upcycled LED display. In reality I have only reused the glass glow used to disperse the light, but with a bit of reworking it would be possible to use the bottom case as well But it looks OK and I'm going to add it to my Christmas decorations. It should last for three or four days before the battery needs recharging.
Dubbie
Top Comments