putting xively codings into my project

how do i put in xively codings into my project? in order for me to show the results from the xively website. i’ve already sign up and added the channel " temperature" on my xively account.

int sensorValue = 0;
float voltage = 0;
int count = 0;
int Rdiff = 0;
int DeltaR = 0;
float DeltaT = 0;
float Temp = 0;

unsigned Thermistor_Temp[16]={-10,-5,0,5,10,15,20,25,30,35,40,45,50,55,60};
unsigned Thermistor_R[16]={42506,33892,27219,22021,17926,14674,12081,10000,8315,6948,5834,4917,4161,3535,3014,1};
unsigned long T1, T2, Thermistor_Read;
void setup()
{
  Serial.begin(9600);
}

void loop()
{
  sensorValue = analogRead(A0);
  
  Serial.println("The digital value at A0 is : ");
  Serial.println(sensorValue);
  
  voltage = sensorValue*(5.0/1023);
  
  Serial.println("The analog voltage at A0 is : ");
  Serial.println(voltage);
  
  T1 = (5.0*1000)/voltage;
  T2 = T1 - 1000;
  Thermistor_Read = 10000000/T2;
  
  Serial.println("The resistance value of the thermistor is : ");
  Serial.println(Thermistor_Read);
 
  
  if(Thermistor_Read < Thermistor_R[0] && Thermistor_Read > Thermistor_R[1])
    {
      DeltaR = Thermistor_R[0] - Thermistor_R[1];
      Rdiff = Thermistor_R[0] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[0] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[1] && Thermistor_Read > Thermistor_R[2])
    {
      DeltaR = Thermistor_R[1] - Thermistor_R[2];
      Rdiff = Thermistor_R[1] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[1] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[2] && Thermistor_Read > Thermistor_R[3])
    {
      DeltaR = Thermistor_R[2] - Thermistor_R[3];
      Rdiff = Thermistor_R[2] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[2] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[3] && Thermistor_Read > Thermistor_R[4])
    {
      DeltaR = Thermistor_R[3] - Thermistor_R[4];
      Rdiff = Thermistor_R[3] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[3] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[4] && Thermistor_Read > Thermistor_R[5])
    {
      DeltaR = Thermistor_R[4] - Thermistor_R[5];
      Rdiff = Thermistor_R[4] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[4] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[5] && Thermistor_Read > Thermistor_R[6])
    {
      DeltaR = Thermistor_R[5] - Thermistor_R[6];
      Rdiff = Thermistor_R[5] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[5] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[6] && Thermistor_Read > Thermistor_R[7])
    {
      DeltaR = Thermistor_R[6] - Thermistor_R[7];
      Rdiff = Thermistor_R[6] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[6] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[7] && Thermistor_Read > Thermistor_R[8])
    {
      DeltaR = Thermistor_R[7] - Thermistor_R[8];
      Rdiff = Thermistor_R[7] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[7] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[8] && Thermistor_Read > Thermistor_R[9])
    {
      DeltaR = Thermistor_R[8] - Thermistor_R[9];
      Rdiff = Thermistor_R[8] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[8] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[9] && Thermistor_Read > Thermistor_R[10])
    {
      DeltaR = Thermistor_R[9] - Thermistor_R[10];
      Rdiff = Thermistor_R[9] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[9] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[10] && Thermistor_Read > Thermistor_R[11])
    {
      DeltaR = Thermistor_R[10] - Thermistor_R[11];
      Rdiff = Thermistor_R[10] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[10] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[11] && Thermistor_Read > Thermistor_R[12])
    {
      DeltaR = Thermistor_R[11] - Thermistor_R[12];
      Rdiff = Thermistor_R[11] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[11] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[12] && Thermistor_Read > Thermistor_R[13])
    {
      DeltaR = Thermistor_R[12] - Thermistor_R[13];
      Rdiff = Thermistor_R[12] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[12] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[13] && Thermistor_Read > Thermistor_R[14])
    {
      DeltaR = Thermistor_R[13] - Thermistor_R[14];
      Rdiff = Thermistor_R[13] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[13] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[14] && Thermistor_Read > Thermistor_R[15])
    {
      DeltaR = Thermistor_R[14] - Thermistor_R[15];
      Rdiff = Thermistor_R[14] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[14] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[15] && Thermistor_Read > Thermistor_R[16])
    {
      DeltaR = Thermistor_R[15] - Thermistor_R[16];
      Rdiff = Thermistor_R[15] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[15] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
  
  else
    {
      Serial.println("");
      Serial.println("It is Out Of Range");
    }   
      delay(1000);    
}

I have no idea what xively is but you do realize that you need your arduino to connect to the Internet for this to work. You also need an api of some sort from xively so the arduino can parse the data.

Xively are bound to have a tutorial to this effect hidden away somwhere. There is also a xively forum which might be helpful.

You need two libraries, called xively.h and httpclient.h, or words to that effect.

You need to look out for three snippets of code to add to your existing.

  1. Defining the datastream and feed names in the preamble

  2. connecting the datastreams to the temperature values in the setup

  3. Adding the put command in the loop. This just a single line, followed by a confirmation. The line looks like

ret= xivelyclient.put(feed, Key);

and the confirmation back is hopefully "200"

would this link https://www.openhomeautomation.net/internet-of-things-arduino-wifi/ help me? i mean, if i were to follow these steps, comparing and editing my current progress on my program, how should i edit it into my progression?

httpclient library from https://github.com/amcewen/HttpClient (https://github.com/amcewen/HttpClient/archive/master.zip)
Xively library from https://github.com/xively/xively_arduino (https://github.com/xively/xively_arduino/archive/master.zip)

I myself use thingspeak.com. Pretty easy for me to send my data to this website.

OK, now it’s time for me to shoot my mouth off. I think both of the above links are junk.

However,

  1. the first para in the openhome article is relevant - using xively makes more sense than trying to set up your own server. The rest is unintelligible.

  2. At least the instructable has all but one of the libraries one would expect to see and the missing one is only relevant to the DS18B20. By virtue of that, it doesn’t merit further reading, but I guess it would work.

The following may be of use. I put it togther for Cosm, hence the word cosm instead of xively, but it worked with xively unchanged and should still. If you used the new libraries and changed the names accordingly, it will probably be OK. Note that the Xively procedure is essentially the same as in the Instructable. Confirmation comes back to the serial monitor. Other serial print commands are somewhat redundant. The three snippets I alluded to in my previous are evident.

The sensor code is essentially that from Hacktronics, and uses their address sniffer.

/*
From cosm library example and lifts from a lot of others
particularly from Stanley in Kuala Lumpur.
Use your own DS18B20 addresses, keys etc.
Note that the feed id is in line 42.
*/
#include <OneWire.h>
#include <DallasTemperature.h>
#include <SPI.h>
#include <Ethernet.h>
#include <HttpClient.h>
#include <Cosm.h>

byte InThermo[8]={0x28, 0x69, 0xC2, 0xB0, 0x03, 0x00, 0x00, 0X9F};
byte OutThermo[8]={0x28, 0x7A, 0x8B, 0xC0, 0x03, 0x00, 0x00, 0x2F};
#define ONE_WIRE_BUS 3
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

char cosmKey[] = "l6a yours here z0g";

int sensorPin = 3;

// Define the strings for our datastream IDs
char sensorId0[] = "InThermo";
char sensorId1[] = "OutThermo";

const int bufferSize = 100;
char bufferValue[bufferSize]; // enough space to store the string we're going to send
CosmDatastream datastreams[] = {
CosmDatastream(sensorId0, strlen(sensorId0), DATASTREAM_FLOAT),
CosmDatastream(sensorId1, strlen(sensorId1), DATASTREAM_FLOAT),
};
// Finally, wrap the datastreams into a feed
CosmFeed feed(83153, datastreams, 2 /*put your number here */);

EthernetClient client;
CosmClient cosmclient(client);

void setup() {
Serial.begin(9600);

sensors.setResolution(InThermo, 12);
sensors.setResolution(OutThermo, 12);

Serial.println("Starting multiple datastream upload to Cosm...");
Serial.println();

while (Ethernet.begin(mac) != 1)
{
Serial.println("Error getting IP address via DHCP, trying again...");
delay(10000);
}
}

void loop() {

int ret=0;
//get the values from the DS8B20's
sensors.requestTemperatures();
Serial.println("Read sensor value ");

float InTemp = (sensorValue(InThermo));
float OutTemp = (sensorValue(OutThermo));
// float Drain = (sensorValue(DrainThermo));

datastreams[0].setFloat(InTemp);
datastreams[1].setFloat(OutTemp);

Serial.println(datastreams[0]);
Serial.println(datastreams[1]);

Serial.println("Uploading it to Cosm");
ret = cosmclient.put(feed, cosmKey); // SEND FEED TO COSM
Serial.print("cosmclient.put returned ");
Serial.println(ret);

Serial.println();
delay(10000);
}

//sensorValue function
float sensorValue (byte deviceAddress[])
{
float tempC = sensors.getTempC (deviceAddress);
return tempC;
}

yeah, If you know php or any other web server language, it would be a heck easier to work with.

i’ve got my arduino xively linked to my hotspot. my next step is to edit my coding, adding xively codes onto my program.

int sensorValue = 0;
float voltage = 0;
int count = 0;
int Rdiff = 0;
int DeltaR = 0;
float DeltaT = 0;
float Temp = 0;

unsigned Thermistor_Temp[16]={-10,-5,0,5,10,15,20,25,30,35,40,45,50,55,60};
unsigned Thermistor_R[16]={42506,33892,27219,22021,17926,14674,12081,10000,8315,6948,5834,4917,4161,3535,3014,1};
unsigned long T1, T2, Thermistor_Read;
void setup()
{
  Serial.begin(9600);
}

void loop()
{
  sensorValue = analogRead(A0);
  
  Serial.println("The digital value at A0 is : ");
  Serial.println(sensorValue);
  
  voltage = sensorValue*(5.0/1023);
  
  Serial.println("The analog voltage at A0 is : ");
  Serial.println(voltage);
  
  T1 = (5.0*1000)/voltage;
  T2 = T1 - 1000;
  Thermistor_Read = 10000000/T2;
  
  Serial.println("The resistance value of the thermistor is : ");
  Serial.println(Thermistor_Read);
 
  
  if(Thermistor_Read < Thermistor_R[0] && Thermistor_Read > Thermistor_R[1])
    {
      DeltaR = Thermistor_R[0] - Thermistor_R[1];
      Rdiff = Thermistor_R[0] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[0] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[1] && Thermistor_Read > Thermistor_R[2])
    {
      DeltaR = Thermistor_R[1] - Thermistor_R[2];
      Rdiff = Thermistor_R[1] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[1] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[2] && Thermistor_Read > Thermistor_R[3])
    {
      DeltaR = Thermistor_R[2] - Thermistor_R[3];
      Rdiff = Thermistor_R[2] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[2] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[3] && Thermistor_Read > Thermistor_R[4])
    {
      DeltaR = Thermistor_R[3] - Thermistor_R[4];
      Rdiff = Thermistor_R[3] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[3] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[4] && Thermistor_Read > Thermistor_R[5])
    {
      DeltaR = Thermistor_R[4] - Thermistor_R[5];
      Rdiff = Thermistor_R[4] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[4] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[5] && Thermistor_Read > Thermistor_R[6])
    {
      DeltaR = Thermistor_R[5] - Thermistor_R[6];
      Rdiff = Thermistor_R[5] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[5] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[6] && Thermistor_Read > Thermistor_R[7])
    {
      DeltaR = Thermistor_R[6] - Thermistor_R[7];
      Rdiff = Thermistor_R[6] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[6] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[7] && Thermistor_Read > Thermistor_R[8])
    {
      DeltaR = Thermistor_R[7] - Thermistor_R[8];
      Rdiff = Thermistor_R[7] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[7] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[8] && Thermistor_Read > Thermistor_R[9])
    {
      DeltaR = Thermistor_R[8] - Thermistor_R[9];
      Rdiff = Thermistor_R[8] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[8] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[9] && Thermistor_Read > Thermistor_R[10])
    {
      DeltaR = Thermistor_R[9] - Thermistor_R[10];
      Rdiff = Thermistor_R[9] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[9] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[10] && Thermistor_Read > Thermistor_R[11])
    {
      DeltaR = Thermistor_R[10] - Thermistor_R[11];
      Rdiff = Thermistor_R[10] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[10] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[11] && Thermistor_Read > Thermistor_R[12])
    {
      DeltaR = Thermistor_R[11] - Thermistor_R[12];
      Rdiff = Thermistor_R[11] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[11] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[12] && Thermistor_Read > Thermistor_R[13])
    {
      DeltaR = Thermistor_R[12] - Thermistor_R[13];
      Rdiff = Thermistor_R[12] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[12] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[13] && Thermistor_Read > Thermistor_R[14])
    {
      DeltaR = Thermistor_R[13] - Thermistor_R[14];
      Rdiff = Thermistor_R[13] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[13] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[14] && Thermistor_Read > Thermistor_R[15])
    {
      DeltaR = Thermistor_R[14] - Thermistor_R[15];
      Rdiff = Thermistor_R[14] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[14] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
    else if(Thermistor_Read < Thermistor_R[15] && Thermistor_Read > Thermistor_R[16])
    {
      DeltaR = Thermistor_R[15] - Thermistor_R[16];
      Rdiff = Thermistor_R[15] - Thermistor_Read;
      DeltaT = (Rdiff*5.00)/DeltaR;
      Temp = Thermistor_Temp[15] + DeltaT;
      Serial.println("The temperature of the room is : ");
      Serial.println(Temp);
      
      delay(3000);
    }  
  
  else
    {
      Serial.println("");
      Serial.println("It is Out Of Range");
    }   
      delay(1000);    
}

i think this code could help out. but i cant really understand how i should put it in.

anybody could re-write the program for me? =)

any helps for this?

anybody could re-write the program for me? =)

Moving this to Gigs and Collaborations.

anybody could help?