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 3:5c3ba12d155b, committed 2016-01-18
- Comitter:
- WiredHome
- Date:
- Mon Jan 18 21:50:17 2016 +0000
- Parent:
- 2:649d91b93824
- Child:
- 4:0a7567195e4b
- Commit message:
- Actual update of all libs.
Changed in this revision
--- a/EthernetInterface.lib Mon Jan 18 21:30:15 2016 +0000 +++ b/EthernetInterface.lib Mon Jan 18 21:50:17 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/EthernetInterface/#e6b79f0ccd95 +http://developer.mbed.org/users/WiredHome/code/EthernetInterface/#664fdba28cd5
--- a/EthernetStatus/EthStatus.cpp Mon Jan 18 21:30:15 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -#include "mbed.h" -#include "EthStatus.h" - -// This function returns the current status of connection. -bool get_link_status(void) -{ - uint32_t tmp = lpc_mii_read_data(); - return (tmp & DP8_VALID_LINK) ? true : false; -} - -// This function returns the status of transmission. -int get_transmission_status(void) -{ - uint32_t tmp = lpc_mii_read_data(); - if(tmp & DP8_FULLDUPLEX) { - return 2; // "FULL DUPLEX"; - } else { - return 1; // "HALF DUPLEX"; - } -} - -// This function returns the speed of the connection. -int get_connection_speed() -{ - uint32_t tmp = lpc_mii_read_data(); - return (tmp & DP8_SPEED10MBPS) ? 10 : 100; -} - -// This function returns the current value in the MII data register. -uint32_t mii_read_data(void) -{ - return lpc_mii_read_data(); // 16-bit MRDD - address 0x2008 4030 -} -
--- a/EthernetStatus/EthStatus.h Mon Jan 18 21:30:15 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ -#ifndef ETHSTATUS_H -#define ETHSTATUS_H - -#include "lpc_phy.h" - -/** \brief DP83848 PHY status definitions */ -#define DP8_REMOTEFAULT (1 << 6) /**< Remote fault */ -#define DP8_FULLDUPLEX (1 << 2) /**< 1=full duplex */ -#define DP8_SPEED10MBPS (1 << 1) /**< 1=10MBps speed */ -#define DP8_VALID_LINK (1 << 0) /**< 1=Link active */ - -bool get_link_status(void); - -// This function returns the status of transmission. -int get_transmission_status(void); // 1 = 1/2 duplex, 2 = full duplex - -// This function returns the speed of the connection. -int get_connection_speed(void); // 10 or 100 Mb - -// This function returns the current value in the MII data register. -uint32_t mii_read_data(void); - - -#endif // ETHSTATUS_H \ No newline at end of file
--- a/HTTPClient.lib Mon Jan 18 21:30:15 2016 +0000 +++ b/HTTPClient.lib Mon Jan 18 21:50:17 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/WiredHome/code/HTTPClient/#96da7c08b5d0 +http://mbed.org/users/WiredHome/code/HTTPClient/#d9e2d1c96b75
--- a/IniManager.lib Mon Jan 18 21:30:15 2016 +0000 +++ b/IniManager.lib Mon Jan 18 21:50:17 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/WiredHome/code/IniManager/#4947b8c244e9 +http://mbed.org/users/WiredHome/code/IniManager/#57b93035ad82
--- a/NTPClient.lib Mon Jan 18 21:30:15 2016 +0000 +++ b/NTPClient.lib Mon Jan 18 21:50:17 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/WiredHome/code/NTPClient/#7ad0af977056 +http://mbed.org/users/WiredHome/code/NTPClient/#2f607bafc29e
--- a/SWUpdate.lib Mon Jan 18 21:30:15 2016 +0000 +++ b/SWUpdate.lib Mon Jan 18 21:50:17 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/WiredHome/code/SWUpdate/#1d318666246c +http://mbed.org/users/WiredHome/code/SWUpdate/#253e7da56ff9
--- a/SW_HTTPServer.lib Mon Jan 18 21:30:15 2016 +0000 +++ b/SW_HTTPServer.lib Mon Jan 18 21:50:17 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/WiredHome/code/SW_HTTPServer/#c8fa31e6fe02 +http://mbed.org/users/WiredHome/code/SW_HTTPServer/#3fc773c2986e
--- a/TimeInterface.lib Mon Jan 18 21:30:15 2016 +0000 +++ b/TimeInterface.lib Mon Jan 18 21:50:17 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/WiredHome/code/TimeInterface/#49f36b489b64 +http://mbed.org/users/WiredHome/code/TimeInterface/#1de342fa7840
--- a/Watchdog.lib Mon Jan 18 21:30:15 2016 +0000 +++ b/Watchdog.lib Mon Jan 18 21:50:17 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/WiredHome/code/Watchdog/#2873f068f325 +http://mbed.org/users/WiredHome/code/Watchdog/#e0f547e22dd5
--- a/main.cpp Mon Jan 18 21:30:15 2016 +0000 +++ b/main.cpp Mon Jan 18 21:50:17 2016 +0000 @@ -15,9 +15,8 @@ #ifdef WIFLY #include "WiflyInterface.h" #else -#include "EthernetInterface.h" // ver 41 +#include "EthernetInterface.h" // ver 51 #endif -#include "EthStatus.h" #include "SW_HTTPServer.h" @@ -308,11 +307,7 @@ bool NetworkIsConnected(void) { -#ifdef WIFLY return eth.is_connected(); -#else - return get_link_status(); -#endif } void PulseRisingISR(void) @@ -487,11 +482,8 @@ if (0 == eth.connect()) { linkup = true; ShowIPAddress(true); -#ifdef WIFLY -#else - int speed = get_connection_speed(); + int speed = eth.get_connection_speed(); pc.printf("Connected at %d Mb/s\r\n", speed); -#endif SoftwareUpdateCheck(true); SyncToNTPServer(); // we hope to have the right time of day now wait(5);
--- a/mbed-rtos.lib Mon Jan 18 21:30:15 2016 +0000 +++ b/mbed-rtos.lib Mon Jan 18 21:50:17 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/#ff95651f53c7 +http://mbed.org/users/mbed_official/code/mbed-rtos/#3d9d2b8b8f17
--- a/mbed.bld Mon Jan 18 21:30:15 2016 +0000 +++ b/mbed.bld Mon Jan 18 21:50:17 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/6f327212ef96 \ No newline at end of file