2
\$\begingroup\$

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

  1. Do these time intervals make sense? Should I log more or less often? Transmit more or less often?
  2. Should I use EEPROM to store the values before transmitting, or just hold them in memory, since it's a short time interval?
  3. 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.
\$\endgroup\$
  • 1
    \$\begingroup\$ Regarding your first question. SIM900 does have an integrated RTC, it also have a separate pin for RTC backup capacitor or battery. pin 26, VRTC. \$\endgroup\$ – Bence Kaulics Apr 11 '16 at 13:32
  • \$\begingroup\$ @BenceKaulics - thanks! I looked into this and realized I'm actually already using this - I just thought it was network time. Turns out the SIM900 just uses network time to set it's RTC. \$\endgroup\$ – LShaver Apr 12 '16 at 20:14
1
\$\begingroup\$

It's a long time now! I don't know if you still have interest in these questions, but anyway.

I believe the first two questions do not have a single/objective answer. The answer strongly depends on your application.

For example, regarding the first question: Is your hardware battery powered? If yes, then you should calculate the time intervals having the power consumption in mind and how often you want to change batteries. If you are not concerned about the power consumption, then it mostly depends on what you want to achieve! You should maybe ask yourself, why do you record these data? Is it because you need to react to something (like an overvoltage or an overcurrent), in which case you should perhaps sample more often or just to keep history? It is also a matter of how much memory you have available, how often you could sample etc.

Regarding the second question, I suppose the questions you should ask yourself are whether you care about losing sampled data in case a power-out occurs between two transmissions and whether you have enough internal memory in the processor to keep the data between two transmissions.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.