Friday, December 7, 2012

Alternatives to Cosm (Pachube), Part 2

(edited heavily on Dec 11, look below to see why)
Previously <link> I discussed the possible use of 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  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
  // 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}"));
    (int)(((rmsVoltage+0.005) - (int)rmsVoltage) * 100),
    (int)(((frequency+0.005) - (int)frequency) * 100),
    (ThermoData[0].currentTemp + ThermoData[1].currentTemp)/2,
    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..."));
  if(emoncms.connect()){ // set a limit on how long the connect will wait
    tNow = now();
    strcpy_P(Dbuf,PSTR("GET &json="));
  else {
    while(emoncms.status() != 0){

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.


  1. First of all, thanks for your blog; i've been following it and find it very interesting.
    You can have an instance of emonCMS at your own place and forget about all constraints that an open site can inflict.
    You can even run it in a Raspberry Pi (I've been doing it) thought it's a bit slow with real time graphs, but will be very lower power hangry. You can use other low power solutions (quad arm cores, 1 Gb mem) for a little bit more money (ODROID-U) which will run Android 4 and Ubuntu 4.
    Installing is very straigh forward (it's just a lamp - linux + apache + mysql + php).
    Good luck with your work!
    joao _ caldeira <.-a.t-.> msn dot c o m

  2. Thanks for the note Joao. I'm really considering the possibility of running a server for this at home. I'm not as interested in taking care of the data as I am in building devices to monitor and control my house, but a server at home that isn't subject to the problems of the internet is a cool idea.

    emoncms is the very first one that I've come across that can be used that way.

  3. I have loaded emoncms on my debian computer and have it working.
    Well, it is up. Digging through their stuff to figure out how to use it
    is painful. Thanks for the arduino example.
    Their instructions to install were pretty good.
    My Raspberry Pi is not working very good so not using it.
    Now I am in the struggle of trying to get a Dragrove from seeed studio
    working as a gateway from my XBee to my wireless network.

    R Kadrmas, New Hampshire

  4. Wow, I'm not the only person with an XBee network. Soon, half the people on the web will be automating and controlling their house. He he. Sorry to hear about the Pi, I've been wanting one of those.