Quantcast
Channel: Desert Home
Viewing all articles
Browse latest Browse all 218

Alternatives to Cosm (Pachube), Part 2

$
0
0
(edited heavily on Dec 11, look below to see why)
Previously <link> I discussed the possible use of Sen.se as an alternative to Cosm.  This is becoming important to me because Cosm seems to be slowing down over time.  The users on their forum have brought this to the developers attention and there have been responses, but I'm having trouble loading a single day of data without a server error and failure to display the data.  So, I just tried out another offering emoncms.org.  It's pretty darn compelling.

The problem with most of the services that I've investigated though is there just isn't enough documentation on what it does, how it does it, where it stores the data, etc.  This is somewhat true of emoncms, but at least there's enough (including its forum) to actually use it.  It took me most of an afternoon to prowl through enough documentation and user comments to get it working.  The part that held me up the most was finding out how to get my data to the service.  It turns out that it's relatively easy to have an Arduino send the data to the service and then construct graphs and things using emoncms tools.

However, there are a number of odd problems relating to embedding their graphs into a blog page.  When I first put this page up I had a multigraph and a gauge that showed real time usage.  The problem was that using the scripts turned off the scroll bar for the page.  That's a bit unacceptable, so I edited the page to remove the visual display.  There are also a few display problems when using their dashboard, but it mostly works.  Here's the link to my dashboard with gauges and graphs that indicate real time data <link>.

Like I said, this is a very compelling site.  One problem may be that this site is open source and maintained by a community of interested users.  That means that it will grow quickly and capabilities will be added as they are thought of and users make the changes (unfortunately, it's the same for bugs).  That makes it somewhat unpredictable.

I can deal with that.


Like I said though, it's a bit tough to find out how to send data from an Arduino to the site.  I got it to work with minimal trouble after searching a lot on the site and its forum.  Here's a code snippet to illustrate how to do it:


The Arduino Sketch

void sendEmoncmsData(){
  char dataBuf[100];

  if(emoncms.connected()) // already trying to get data, just leave
    return;
  // construct the data buffer so we know how long it is
  strcpy_P(Dbuf2, PSTR("{RealPower:%d, PowerFactor:0.%d, PowerVoltage:%d.%02d, PowerFrequency:%d.%02d, InsideTemp:%d, OutsideTemp:%d}"));
  sprintf(dataBuf,Dbuf2,
    (int)round(realPower),
    (int)(powerFactor*100),
    (int)rmsVoltage,
    (int)(((rmsVoltage+0.005) - (int)rmsVoltage) * 100),
    (int)(frequency),
    (int)(((frequency+0.005) - (int)frequency) * 100),
    (ThermoData[0].currentTemp + ThermoData[1].currentTemp)/2,
    (int)round(outsideSensor.temp));
    Serial.println(dataBuf); // take this out when you've got it working
//    return;  // so you can see the buffer before you actually send it
  strcpy_P(Dbuf,PSTR("emoncms Connecting..."));
  Serial.print(Dbuf);
  if(emoncms.connect()){ // set a limit on how long the connect will wait
    strcpy_P(Dbuf,PSTR("OK..."));
    Serial.print(Dbuf);
    tNow = now();
    strcpy_P(Dbuf,PSTR("GET http://emoncms.org/input/post?apikey=secretnumbers &json="));
    emoncms.write(Dbuf);
    emoncms.write(dataBuf);
    emoncms.write("\n");
    emoncms.stop();
  }
  else {
    strcpy_P(Dbuf,PSTR("failed..."));
    Serial.print(Dbuf);
    emoncms.stop();
    while(emoncms.status() != 0){
      delay(5);
    }
  }
}

See, it's a simple json interaction that names the variable that you want to save data for.  emoncms will create the data store and name it for you.  All maintenance for the data can be done from their site.

This could well become my new cloud storage for data.

Viewing all articles
Browse latest Browse all 218

Trending Articles