• No problem! Yes, adding batteries instead of a capacitor is a great idea. There's actually an example of it here: http://www.espruino.com/Small+Solar+Powe­red

    The problem with your current setup is the voltage from the solar cell is a bit too low... I mean, you can charge 2xAA cells with it, but that's only really 2.4v which isn't really enough to run Espruino reliably. In the link above the solar cell gave out 4.5v or so (I think) under a bright light, which was enough to charge a Lithium Ion battery.

    But assuming you did find a cell that could give a voltage that could charge a battery that Espruino can run off, you've got this problem where Espruino runs off 3.3v (usually) and can only measure voltages between 0v and what voltage it runs off (3.3v), and the battery will have to be more than that.

    So to measure the voltage, you need a 'potential divider'. Just get two equal resistors of a relatively high resistance (around 100k ohms) and connect them together in the middle, then across the battery. Then connect the middle to 'C0'.

    It's a bit like connecting two elastic bands... the voltage of the middle will be halfway between the voltage of the two ends, so now all you have to do is to measure the voltage on C0 and multiply it by 2 to get the battery voltage.

About

Avatar for Gordon @Gordon started