An important part of the circuitry driving the solar charger (at least to me) was granting it the ability to calculate the position of the sun for a given date/lat/long/etc…
Well apparently that’s too much to ask of my little ATMega2560 controller. He’s only loaded with 8K of onboard memory. That means that while he’s doing things like updating the display on the LCD screen, multiplexing the 7 segment output, and monitoring voltages and temperatures of the panels he shits himself when trying to recalculate the position of the sun. The controller freezes up and makes my boner sad.
Now for the choose your own adventure portion of our meganerd saga.
To overcome this memory limit I have a few options:
- Try to optimize the code using shorthand integer mathematics to get roughly-right solar position calculations.
- Add an external 128K RAM chip to the controller, which boosts my total available memory to 136K but robs me of 24 output pins.
- Re-implement the software in C or Assembly on a Parallax Propeller microcontroller board, which supports multithreading but would require more external circuitry as it uses 3.3V logic levels instead of 5V.
- Offload the heavy duty calculations to a PC and add a network interface to the controller to ping the PC for this data on a set interval (weak).
- Ditch the calculations and do analog sun-hunting with light sensors (lame).
Since this post doesn’t really have any possible images and pictures are nice here’s Burt Bacharach:
Comments welcome, I’ll be making my decision today.