Power monitoring using Arduino

Another small but interesting project is power monitoring usage using Arduino.

The idea was to be able to get instant feedback on my home power consumption.

So I bought some CT sensor from EBay (9 euros/each) . The only problem is that I have a three phased installation. So instead of two phases as usual, (three wires) there are three phases and four wires.

The installation was made in two steps: first a breadbord connected to the CT sensor and the arduino, sending the information every ten seconds on OpenSensorCloud using an Eternet Shield.

EMon
As this worked fine, I’ve bought an a shield instead of my breadboard. This cost little bit but the result is much better than a custom one.

The advantage of having a three phase installation is that you can display each phase individually, so it gives you much more indication on what is currently hapenning. For instance, I no that on Phase 3 there is the heat pump installation, on phase 2 the kitchen, etc…

The result is visible here, you have a dashboard showing the instant consumption on each phase, as well as the daily total :
Emon

The sketch is here:
ArduinoCode
As a bonusI wanted something to display these data in the living room, so I used the spark core that I bought as an #IoT geek: the core is connected to the server and receive the data every ten seconds. This is probably not the optimum configuration (Ethernet -> Server -> Wifi -> Spark core) and I plan to do an updated version if a different connectivity. In the meantime, the result is quite nice: the core display the total consumption and the phase consumtion ona small olde display, as well as the usage graph of the last ten minutes.

The RGB led of the core is also used to provides feedback on power usage: green -> low usage, red, high usage

Bo_RURHIUAEGdMI_002

3 thoughts on “Power monitoring using Arduino”

  1. Hallo Thomas,
    I’m trying to send Temp data connected directly to the spark core to Opensensorcloud (using the HTTPCLIENT lib) but i cannot get a successful send, this is the part of the sending code , which does open the connection but and send data but the opensensorcloud server seem to reject it, that i do not see where can you look into this part of the code, I’m not sure at all if this is the right way to do it, i tried to modify a working code piece from ubidots.com , serial resulys are after the code:
    —————————————————-
    http_header_t headers[] = {
    //{ “Accept” , “*/*”},
    {“Content-Type”,”application/json”},
    {“X-ApiKey”,OSC_API_KEY},
    { NULL, NULL } // NOTE: Always terminate headers will NULL
    };

    void setup() {
    Serial.begin(9600);
    dht.begin();
    }
    void loop() {
    float h = dht.getHumidity();
    float t = dht.getTempCelcius();
    http_request_t request;
    http_response_t response;

    request.hostname = “api.opensensorcloud.com”;
    request.port = 80;
    request.path = “/device/”OSC_DEVICE;
    request.body = “{\”sensor_id\”:” + String(OSC_TEMP) + “,\”value\”:” + String(t) + “}”;
    http.post(request,response,headers);
    Serial.println(request.body);
    Serial.println(response.body);
    Serial.print(“TEMP = “);
    Serial.println(t);
    delay(2000);
    }
    —————————————-
    SERIAL MONITOR:

    HttpClient> Connecting to: api.opensensorcloud.com:80
    HttpClient> Start of HTTP Request.
    POST /device/544423472acae81248000021 HTTP/1.0
    Connection: close
    HOST: api.opensensorcloud.com
    Content-Length: 58
    Content-Type: application/json
    X-ApiKey: 1753f8d091ff37b11420dcd962e30329
    [{"sensor_id":544424b42acae8124800002b,"value":26.000000}]
    HttpClient> End of HTTP Request.

    HttpClient> Receiving TCP transaction of 128 bytes.
    HTTP/1.1 500 Internal Server Error
    Date: Wed, 22 Oct 2014 18:21:19 GMT
    Server: Apache/2.2.16 (Debian)
    X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.15
    Cache-Control: no-store
    X-XSS-Protection: 1; mode=block
    X-Content-Type-Options: nosniff
    X-Frame-Options: SAMEORIGIN
    Content-Length: 30
    Status: 500
    Vary: Accept-Encoding
    Connection: close
    Content-Type: text/html;charset=utf-8

    Internal Server Error
    HttpClient> End of TCP transaction.
    HttpClient> End of HTTP Response (781ms).
    HttpClient> Status Code: 500
    Internal Server Error
    TEMP = 26.00
    ——————————————-

Leave a Reply to aniston Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>