## Solar powering an Attiny or Arduino with a capacitor, or just use AA? Part 2

As I had a 10.000uF (0.01F) capacitor and was awaiting my supercapacitors, I was wondering if I could perhaps use that, just to carry a circuit through the night.

With the aid of a 9 Volt Solarpanel (and a resistor) the 10.000uF capacitor was charged to 10Volts fairly quickly (it was a sunny day).

The charge in that can be calculated by 1/2*0.01*10² =0.5Ws. But as we can only use it at 5 Volt level in reality that is 0.125 Ws.
Also, as we take 1.8 Volt as our lower limit, we have to subtract 0.0126 Ws, leaving us with 0.109Ws.

With the earlier stated power consumption of 13.8uWatt that leaves us with about 7900 seconds or 2 hours and 12 minutes, which is obviously not enough to carry us through the night.
Yet, I wanted to test whether I was on the right track, so I used the following circuit to connect my circuit to the fully charged capacitor:

As it turned out, my circuit lasted for 1 hour and 25 minutes before it appeared to be dead, which i guess is close enough to the calculation, considering it was an old (>20 yrs) capacitor that might have suffered and maybe  had a bit of a leak current. Now before I get criticized that I am not taking into account that the capacitor is also discharged  during the day because it has to feed the circuit then as well… yes that is true, but I merely wanted to see if the capacitor could store enough load to begin with, to carry me through the night, which it cant. The charge -and thus the capacitor- would need to be at least  some 9 times bigger (so a 100.000uF minimally). I could have figured that all out just by calculation, but nothing beats a field test to see if calculations are right.

Anyway, while waiting for my supercapacitors to arrive (aliexpress) I had some time to think about what solarcell to use. The 9 Volt (5 Watt I seem to remember) seemed definite overkill, but from a few old gardenlamp I had some small solarpanels that delivered 2.5 Volt. I could put 3 of those in series (as they only give 2.5 Volt on a sunny day). I had no idea what Wattage they are but they are used to charge a 1.2V 40mAh NiCad, and some 300mAh NiCad. The latter seemed a better choice.
Ofcourse I could buy a solarpanel, but I first wanted to try with what I had available.

In part 1 I calculated a 1.5 Farad capacitor at 5 Volt is charged up to 19.5 Joule or 19.5 Wattseconds.
So if one wants to charge that capacitor with say a 5 Volt 1 Watt solarpanel one would need  a minimum of 19.5 secs to charge it (if we forget about a series resistor for a while).

Thriftstores sell these small solar Garden lights  usually for less than a euro. They have a small solarcell and inside a circuit build around an YX8018 IC that charges a single NiCad cell. Sometime sometimes a very small one (40mah)  sometimes a bigger one (800mAh). They need a full day of sun to charge and at dark an LED  lights up for a few hours. Now suppose the small solarpanels from my garden light are indeed enough to charge a 1.2 V 40mAh cell if left to charge for say 8 hrs.
The cells are  1.2 *40 mWh =48 mWh. If charged over 8 hrs that leaves a solar cell of 6mW. As the cells give 2.5 Volt in bright sun light, I would need 2 which then gives a total of 12mW (this is just theoretical, it is very low for a solarcell). So if I need a charge of 19.5W.s, that comes down to (19500/12=) 1625 secs or 27 minutes or 0.5 hrs to charge the 1.5 Farad capacitor. That is doable (if we  forget about the poweruse in the daytime).
In that 0.5 hrs obviously 13.8uW*0.5=6.2uWh is used just for the working of that circuit, which is small enough to ignore in terms of charge time. So, if a 1.5 Farad takes 0.5 hrs to charge, my 10.000uF should take 20/100 m or  12 secs. Lets see.
Now before I go on, just a word of warning: the calculations I do are partly limit calculations and do not always take all practical realities into account. For instance, a 5 Volt 12mW cell will be able to deliver 12/5=2.5mA. However if one tries to load an empty capacitor  with a series resistor of say 100 Ohm, then the max current that is requested is 50mA, obviously the photo cell cannot deliver that so the voltage drops and therefore the classical natural log curve of  charging a capacitor will not be followed. For any given moment the curve will follow the natural log curve for the  voltage at that moment, leading to a longer charge time.
Just a word: One could use the innards of the cheap garden light so, including the circuit around XY8018 IC to charge the caps, if one brings it up to 5 Volt. Various  circuits for that exist. I however decided to keep it simple and do a straight laod from  one or more  fotovoltaic cells.
Nevertheless, as halfway through my experimentations my Ultracaps arrived from Aliexpress (very fast delivery), it didnt seem much use to experiment with the 10.000uF any longer, so in Part 3 We go to the real work.
By the way, someone has already done some work on this.

## Solar powering an Attiny or Arduino with a capacitor, or just use AA? Part 1

If you have a processor in a remote location that you cannot or will not bring a psu cable to, you have several options of supplying it with energy.
Batteries come to mind and these could be rechargeable or not, or one can use a capacitor. After all, those store energy as well. To make a capacitor a viable option, obviously it needs to be a big one (in capacity, not especially in size), and one has the option of adding a solar cell to it.
As I wanted to feed an attiny that is somewhere in my garden and that is asleep most of the time and as I had some idle solar panels  (9 Volts, 2 Volts) those seemed  suitable to use, but as they do not provide much energy during the night, I needed to store that energy as well. As storage Nicads or even a LiPo came to mind. A Lipo I discarded as it takes some extra circuitry to do any decent charging. A nicad obviously needs some consideration in charging and discharging  as well, but they are more tolerant albeit that a deep discharge is usually not appreciated by them, nor is a constant charge.
Therefore I also considered using a “supercapacitor” I have a capacitor of 10.000uF but one can hardly call that a supercapacitor, but nowadays supercapacitors are readily available at modest prices. They would be easy to use in a charging circuit (basically a resistor would be enough) and they don’t mind frequent  charge and discharge. As their charge is  limited, obviously I would need a solar-cell, so the only thing I needed to see is if they would carry my application ‘through the night’

The Charge of a capacitor is expressed in Coulomb (symbol C).
this can be expressed as:

C=F * V  (where of course ‘F’ stands for the capacity in Farad)
Energy in Joule is expressed as:
J=C*V
Which is:
F*V*V  of F.V²
However, at a given voltage and capacity only half of the energy is available to charge the capacitor hence the energy in the capacitor will be:
J=½ * F *V²
and Joules can also be expressed as ‘Wattseconds’:
J=W *s

So if we calculate the number of Joules in the capacitor at 5.1 Volt:
J=0.5 * 1.5 * 5.1² = 19.5 J
Now obviously we will not all use those as the attiny kinda stops working at 1.8 Volt. If we calculate the number of Joules still left then we come to
J=0.5 * 1.5 * 1.8² = 2.43 J
So the amount of usable energy comes to 19.5-2.43= 17J (rounded down)

From an earlier project on  an attiny13 that was put to sleep only to awake every so many seconds, I found out that the current consumption was 5.5 uA at 5 Volt. Now obviously it will consume a bit less when the voltage drops, so lets assume 4uA at an average of 3.45 Volt (The average voltage being (5.1+1.8)/2=3.45 Volt).
We can calculate the average power consumption as V*I:
3.45 * 4*10⁻⁶ = 13.8 uWatt
as we have 17 Joules available and 17 joules being 17 Ws (Wattseconds) we can calculate the time:
J=W*s
s=J/W
s=17/(13.8 *10⁻⁶)
s=17/13.8  *10⁶
s=1.23 *10⁶
s=1230 000 sec (1,23 million seconds)
that is:
20.531 min, is
342 hrs is
14 days
Now this is just an approximation as there might be some current leakage. The processor will need to do something when awake, like flash a  led or send something, so it will probably not make the full 14 days, but that is not important as it is obviously enough to carry us through the night and probably an overcast day as well.

So how would this be if I used normal AA batteries or NiCad batteries?
As example for regular alkaline batteries  I will take the ubiquitous Philips  LR6. Fortunately someone else already calculated the energie stored in these batteries  at  1986 mAh at a discharge of 100mA. As the performance of these batteries is increasing when the discharge decreases, I will use 2000mAh for my calculations.
If one uses 3 of those to get to 4.5 Volts that will be a total of 9000mWh or 9 Wh.
Again, we will not be able to use this all as we have 1.8 Volt as lower limit, so we will be stuck with 3.6 Wh that we cant use, leaving  5.4 Watthour usable energy.
The average Voltage on the  processor will be:
(4.5+1.8)/2=3.15 Volts.
the average power consumption thus is:
3.15* 4*10⁻⁶ = 12.6uW
as we have 5.4 Wh available we can again calculate the time:
h=5.4/12.6 * 10⁶
h=0.428571 *10⁶
h=428571 hr
=17857 days
=592 months
=50 years
Wow. Why would anybody want to use anything else but LR6 batteries ?
Well for several reasons: 3 of those batteries take more space and eventhough they tend to perform well at low temperatures and low discharge rate, we all have experienced that Alkaline batteries left in a hardly used device tend to leak, even destroying that device by its corrosive leaking. Advantages and disadvantages of alkaline batteries are discussed here.
Nevertheless using alkaline batteries can be a good choice, but don’t forget to change them.

Using NiCad batteries gives a somewhat similar calculation. Suppose we use 3 cells of 1.2 Volt 2000mAh (or 2Ah).
Total energy will be 3.6*2= 7.2 Wh
useable energy will be (3.6-1.8)* 2=3.6 Wh
the average voltage we set at (3.6+1.8)/2=2.70 Volt
The average power consumption will be:
2.7* 4*10⁻⁶ = 10.8uW  (V*I)
The time will thus be:
h=(3.6/10.8) * 10⁶
=333333 hr
=38 yrs
Now if that only was true. My experience with  for instance solar garden lights (that often only have an 800mAh cell)  is that they usually dont last through the winter… and mind you, those are being recharged (which could contribute to their demise).
Nevertheless they may be a good choice.

In a following article I will discuss some practical examples