Watt Eye has a simple purpose - monitor pulses that comes from the home electric meter, measure the interval between the pulses and compute the real-time energy being consumed, broadcast that onto the network using UDP packets so that CouchCalendar has something to do and display, and publish the data to a web server, where it can be used (graphed or placed into a db).

Dependencies:   IniManager mbed HTTPClient SWUpdate StatisticQueue mbed-rtos NTPClient Watchdog SW_HTTPServer EthernetInterface TimeInterface

Features:

  • Reads the time between pulses (which the home electric meter emits as IR for each Watt consumed).
  • Once every 5 seconds, it broadcasts this via UDP to the network, so other nodes can listen to this real-time data.
  • Once every 5 minutes, it posts statistics to a web server for logging.
  • Once a day, it checks the web server to see if there is a SW update (and if so it downloads, installs, and activates it).
  • It syncs to a configured NTP server, but doesn't actually use this information for anything.
  • It hosts a web server, but this is not being used at this time.

So, this is a rather expensive piece of hardware to monitor a single pulse, and yet it is easy to imagine enhancing this:

  • Read the water meter in a similar manner.
  • Read the gas meter in a similar manner.

And even then, there will be many left-over port pins for other uses.

Revision:
2:649d91b93824
Parent:
1:04ab0a3d07f1
Child:
3:5c3ba12d155b
--- a/main.cpp	Sun Jul 27 17:47:58 2014 +0000
+++ b/main.cpp	Mon Jan 18 21:30:15 2016 +0000
@@ -359,7 +359,7 @@
         timeFor5m = timenow;
     
     if ((timenow - timeFor5m) >= 60) { // 300) {
-        pc.printf(" tnow: %d, t5m: %d\r\n", timenow, timeFor5m);
+        //pc.printf(" tnow: %d, t5m: %d\r\n", timenow, timeFor5m);
         sendToWeb = true;
         timeFor5s = timeFor5m = timenow;
         stats5s.EnterItem(iKW);
@@ -367,12 +367,13 @@
         TransmitEnergy(true, iKW, stats5s.Min(), stats5s.Average(), stats5s.Max(),
             stats5m.Min(), stats5m.Average(), stats5m.Max());
     } else if ((timenow - timeFor5s) >= 5) {
+        sendToWeb = true;
         timeFor5s = timenow;
         stats5s.EnterItem(iKW);
         TransmitEnergy(false, iKW, stats5s.Min(), stats5s.Average(), stats5s.Max(),
             stats5m.Min(), stats5m.Average(), stats5m.Max());
     }
-    if (count != lastCount) {
+    if (sendToWeb) { // count != lastCount) {
         lastCount = count;
         pc.printf("%8.3fs => %4.3f (%4.3f,%4.3f,%4.3f) iKW, (%4.3f,%4.3f,%4.3f) KW 5m\r\n",
             (float)elapsed/1000000,