2021-05-08

Easy Addition of Solar Energy Supply to Homebrew Project

#hardware

#software

These days I received some more parts for tinkering. Yes, all environmentally questionable electronics. The better news is probably, that I did put a solar charge controller to use, after having it for many months. And the good news is: it actually just worked.

Solar Energy, medium size

The charger is a thing offered by crowdsupply.com[a]. It has its price, but already setting the thing up was so nice, that for me it is already worth every cent. The charger controller is accessible via i2c. The documentation is top notch[b], the firmware, code for the Pi and Arduino projects are available, too. Very nice.

I added a 12V/10W Solar panel and a 10Ah battery (these are the new items).

Controller

The project that the above is providing energy for, is a Atmel Atmega644pa controller plus some periphery to serve as a remote sensor station. It features:

Firmware

The controller cannot do anything at all unless enhanced by a bit of machine readable code. The most common languages for this kind of endeavour seems to be C. However, due to some unforseen quirk of spacetime along my personal trajectory, I prefer Forth, with the occasional sprinkle of AVR Assembly language. More precisely I use AmForth[f].

So the firmware for this particular controller does actually very little, it sleeps most of the time:

Yes well, this could be done differently, of course. And no, the data records are not signed, and not secured in any way against spoofing or denial of service. But the format is simple. And I decided a long time ago, that I will just collect this data for visual inspection. No automated action is derived other than the data collector (a perl script) sending an email message, if a given station ceases to report for more than one hour.

Easy?

The main reason why I write this mostly uninteresting event down, is this: In the past weeks I spent more than 20 hours to get to grips with a Bosch Sensortec BME280 sensor. Using this with C firmware is not difficult. But the official code and documentation leaves much to be desired by me. Remember, I chose Forth over C. So I have to understand all the quirky bits about going from the raw readings to human readable physical dimensions. The C compiler does an outstanding job to select the correct (signed or unsigned, for any given length) operations on the raw data. I failed to see everything I needed and gave up on the calculation of the pressure. I managed to get plausible results for temperature and relative humidity. Never before have I seen such an awkward interface --- oh well. Yes there are working implementations in Forth. I found one for msp430, but I didn't understand the code in sufficient detail, sorry!

However, talking to the charge controller was a breeze and I got the values I wanted and understood them in something like 2 hours. Very nice! Thanks!

Cheers,

Erich

References

[a] makerPower Solar on crowdsupply.com

[b] user guide on github

[c] home of TheStack on sourcehut.org

[d] AATiS Homepage (German), AS622 Bausatz

[e] The Mighty Ohm Geiger counter project

[f] AmForth project

See also

/en/2019/20190324-TheStack-first-prototypes.gmi

Home