Hardware setup
I am using custom hardware driven by a TIVA TM4C (specifically, TM4C123GXL) to control a microgrid with battery energy storage, solar panels, four loads controlled by relay, and a SIM900 GSM GPRS module. Users can push buttons to toggle relays, or send an SMS to toggle relays.
Three ADCs record battery voltage, total load current, and total load power.
I am writing C code using Keil u4.
What I'm trying to do
- Log the relay states and ADC voltages on a regular interval (once per minute?) as well as each time a user manually toggles a load
- Periodically (once an hour?) send the accumulated data via GPRS to an http server
This data can be used to make sure the microgrid algorithm is functioning optimally and properly handling solar resource availability, battery state, user inputs, etc.
My question
- Do these time intervals make sense? Should I log more or less often? Transmit more or less often?
- Should I use EEPROM to store the values before transmitting, or just hold them in memory, since it's a short time interval?
- What's the best way to implement timers? I have several 32-bit timers with 16-bit subtimers, and several 64-bit timers with 32-bit subtimers. I'm unclear on how/why to use different timer arrangements for different tasks.