Friday, March 31, 2017

Calculating Amp Hours and Watt Hours

In previous posts we have described how to make a volt/amp/watt meter to measure power consumption, or production (solar, wind, etc). I never fully explained the watt hour and amp hour calculation, so here is a sample sketch that assumes you are measuring voltage and current with the appropriate sensors.

I'm flushing the daily data every 24 hours, but keeping a running total. You could save this data to a sd card or publish it to a web server.

This is much easier to read on a LCD instead of the serial monitor.


float volts = 120; // get value from voltage sensor
float amps = 100; // get value from current sensor
float watts = volts * amps;
float kwh;
unsigned long totalET;
float dailykwh;
float totalkwh;

void setup() {


void loop() {
  uint32_t ts1 = millis();
  delay(1000); //reports at 1 second intervals
  uint32_t ts2 = millis();

  // print the time interval in seconds
  uint32_t ts3 = (ts2-ts1)/1000;
  totalET = totalET + ts3;
  Serial.print("Seconds: ");

  kwh = watts * ts3 / 3600000;
  dailykwh = dailykwh + kwh;

  Serial.print("Volts: ");
  Serial.println(volts, 4);
  Serial.print("Amps: ");
  Serial.println(amps, 4);
  Serial.print("Watts: ");
  Serial.println(watts, 4);

  //Serial.print("Current Ah: ");
  // numbers so small it's not relevant.
  //Serial.println(kwh/volts, 4);
  //Serial.print("Current KWh: ");
  // numbers so small it's not relevant.
  //Serial.println(kwh, 4);

  Serial.print("Daily Ah: ");
  Serial.println(dailykwh/volts, 4);
  Serial.print("Daily KWh: ");
  Serial.println(dailykwh, 4);
  totalkwh = totalkwh + dailykwh;
  Serial.print("Total KWh: "); //from reboot
  Serial.println(totalkwh, 4);
  if (totalET >= 86400){ //restart every 24 hours
  ts1 = 0;
  ts2 = 0;
  totalET = 0;
  dailykwh = 0;

Wednesday, March 29, 2017

Outlook lost it's search capability?

This is a bit off topic for this blog, but since Outlook is a common email client, I thought I'd pass along a little tip.

All of a sudden, Outlook started responding to searches with "No Results Found". Called Microsoft, and wonder of wonders, they sent out a bum patch. While they are attempting to fix, there is a work around. Revert back to a working build.

In Outlook, click File, Office Account, and set Update Options to Disabled.

Open a cmd prompt as administrator (right click on the command prompt icon and choose More, run as administrator).

In the cmd prompt, type (or copy / paste):

cd %programfiles%\Common Files\Microsoft Shared\ClickToRun

press Enter, then do the same with this command:

officec2rclient.exe /update user updatetoversion=16.0.7571.2109

This will run a lengthy update, but when finished, Outlook will have it's search back.

Set a calendar reminder to turn the updates back on in a month or so.

Related Posts Plugin for WordPress, Blogger...