Control Arduino from Xively dashboard

This is getting frustrating!

I have fully functional code that uploads 5 data values through a data stream to Xively. Everything updates correctly, displays correctly, etc.

One of those values is the status of an irrigation pump. It can be on or off.

I was hoping to use Xively as the remote control for this pump. i.e. change a value on the Xively dashboard and respond to that value in the sketch:

void loop()
{
  int getReturn = xivelyclient.get(feed, xivelyKey);
  if (getReturn > 0) {                                      // assumes 0 is a fail, anything else is OK
    Serial.println("Datastream is: ");
    for (iDatastream == 0; iDatastream < 5; iDatastream++)
    {
      Serial.println(feed[iDatastream]);
    }
    Serial.println ("Feed(4) value :");
    Serial.println (feed[4].getFloat(), DEC);        // should return the current value from xively
  } else {
    Serial.println ("HTTP error ");
  }
  
  // update pump status from Xively - for debugging only
  Serial.print("Feed(4) get() from Xively: ");
  float feed4value = feed[4].getFloat();            // expecting a value from Xively
  Serial.println(feed4value, DEC);

// etc....

Now this DOES report the last posted value to Xively when posted FROM the Arduino but when I use the Xively dashboard to change the value in edit channel window, the value received from feed[4].getFloat() is always the last posted value, not the recently changed value. Furthermore, the value seen in the dashboard reverts after a few seconds to the last posted value. !

So is there a bug in the Xively library or is there another way to use the dashboard to change a datapoint??

Any help appreciated

(yes I have all the latest libs from Xively)

It all works now. The trick was to separate the feeds so that the data stream to be changed from Xively ...get() was not included in the ...(put) feed.

Also setString() and setInt(), getString() and getInt() are not implemented in the Xively Arduino library yet. getInt() does not call a compiler error however it does not seem to do anything - no error, no return.

:roll_eyes:

Hey thanks for the post. Did you look into any other data logging and dash-boarding tools before you decided on Xively? I'm interested in logging , reporting and dash boarding some thermostat and other home automation data centrally with the long term ability to control from the web as well. I have an internal HTML solution that I've been using but it seems like there's an easier way to do this without the learning curve on analytic's.

Yes we tried a few systems, but in most cases the support and reliability were not sufficient.

Xively kinda works. Documentation for the Arduino and the support of other datatypes in the stream is really not sufficient for our needs. The Xively system does provide graphing which is nice, and there is a data logging ability (3 months I think) so for many applications it will do the job.

That said, we are probably a month away from completing a data collection/logging/mining application designed around XML with a PHP/mySQL back-end running on our small server farm. This allows both monitoring and control as well as conditional/automated events via the micro controller or any other web connected device.

When the time comes we will be able to offer that as a free service with open-source s/w for non-commercial users.

I would be interested in hearing from other potential users about the features that this system should offer.

Currently the XML dataset allows:

Identification of the source location with geolocation details one site per XML file
multiple devices are possible, e.g. BeagleBone in Greenhouse A
<SENSOR_ID> multiple sensors per device with ID, Name, Type description, Datatype (Integer, Float, Long, Text, Boolean, etc), Data value, Data unit (Celsius, number, text, etc)
<ACTUATOR_ID> multiple actuators per device with ID, Name, Type description, Datatype, Value to send, Data unit

multiple reports of the values of the actuator data. This can be controlled by any authorized device such as smartphones, PCs or other micro controllers. Can also be a separate XML file on a different computer/database.
<ACTUATOR_ID> multiple actuators per device with ID, Name, Status, Datatype
</ACTUATOR_REPORT>

[font=Courier]
<SITE>
<SITE_ID>CAN-001</SITE_ID>
<SITE_NAME>Abbotsford R&D</SITE_NAME>
<SITE_GEO_LAT>49.067616</SITE_GEO_LAT>
<SITE_GEO_LONG>-122.260776</SITE_GEO_LONG>
<SITE_GEO_ELEV>48.00</SITE_GEO_ELEV>
<DEVICE>
<DEVICE_ID>C-001-MEGA</DEVICE_ID>
<DEVICE_NAME>MEGA Ethernet ServerTest module</DEVICE_NAME>
<DEVICE_TYPE>Arduino MEGA</DEVICE_TYPE>
  <SENSOR_ID>
  0000001
    <SENSOR_NAME>DS18B20 on workbench</SENSOR_NAME>
    <SENSOR_TYPE>DS18B20</SENSOR_TYPE>
    <SENSOR_DATATYPE>FLOAT</SENSOR_DATATYPE>
    <SENSOR_VALUE>0.00</SENSOR_VALUE>
    <SENSOR_DATA_UNIT>Celsius</SENSOR_DATA_UNIT>
  </SENSOR_ID>
  <SENSOR_ID>
  0000002
    <SENSOR_NAME>Potentiometer on A0</SENSOR_NAME>
    <SENSOR_TYPE>ANALOG></SENSOR_TYPE>
    <SENSOR_DATATYPE>INTEGER</SENSOR_DATATYPE>
    <SENSOR_VALUE>96</SENSOR_VALUE>
    <SENSOR_DATA_UNIT>Number</SENSOR_DATA_UNIT>
  </SENSOR_ID>
......... etc

  <SENSOR_ID>
  0000006
    <SENSOR_NAME>RTC Clock on I2C (D20/21)</SENSOR_NAME>
    <SENSOR_TYPE>DS1307</SENSOR_TYPE>
    <SENSOR_DATATYPE>DATETIME</SENSOR_DATATYPE>
    <SENSOR_VALUE>2014-2-19 7:47:59</SENSOR_VALUE>
    <SENSOR_DATA_UNIT>DATETIME</SENSOR_DATA_UNIT>
  </SENSOR_ID>
  <ACTUATOR_ID>
  A13
    <ACTUATOR_NAME>Motor controller on pin D3</ACTUATOR_NAME>
    <ACTUATOR_TYPE>L298</ACTUATOR_TYPE>
    <ACTUATOR_DATATYPE>INTEGER</ACTUATOR_DATATYPE>
    <ACTUATOR_VALUE>-30</ACTUATOR_VALUE>
    <ACTUATOR_DATA_UNIT>NUMBER</ACTUATOR_DATA_UNIT>
   </ACTUATOR_ID>
</DEVICE>
  <ACTUATOR_REPORT>
    <ACTUATOR_ID>A13</ACTUATOR_ID>
    <ACTUATOR_TYPE/>
    <ACTUATOR_STATUS/>
    <ACTUATOR_DATATYPE/>
    </ACTUATOR_REPORT>
</SITE>
[/font]

sounds like an interesting project. For my self i would like a service that provides the following features for free (obviously nothing is life is truly free):

Data:

  • Ability to define data data definition and primary keys
  • Ability to have multiple sets of data. Not just one table/database.
  • Support for ‘putting’ via JSON, XML and CSV.
  • ability to store 2 - 5 GB of data
  • Ability to download data in various formats

Access:

  • Access from Arduino via HTTP
  • Access from PC via python (for non Ethernet (Serial) projects)
  • Access from browser for reporting
  • Access from browser for sending HTTP commands to device or python. (for non Ethernet (Serial) projects)

Administration:

  • Access from web for administration and management
  • Access from Arduino/micro controller for maintenance
  • Access from python for administration/maintenance

Reporting:

  • Historic reporting
  • Live data reporting
  • Custom report writing
  • Widgets
  • Charts and graphs
  • Access from Web Browser and Mobile device
  • Focus on clean graphics and ease of use.

As a hobbyist i find that i enjoy the electrical engineering, fabrication and most of the software development for my projects. When i start to get overwhelmed is trying to take a solution that I’ve provided and make it easy to access and understand for other people eg… my wife kids friends family. Sure one can spend a few hours each day learning each piece of the process but that costs significant time and doesn’t provide a way for one to really focus on the ‘fun’ aspects of the hobby. Let me know if you have any further questions.

Thanks for the input !

Sounds like we are fairly close to matching those requirements - although the data admin side will need to wait for a while.

We are going to offer this to the non-commercial community with some obvious limits, such as update frequency, total storage space, etc. Maybe we will offer a service with fewer limitations for a small monthly fee.

The plan is to make the interface open source so that developers can design apps to interact with the data.

sounds cool. I look forward to seeing it in production.