Real-time Room Temperature Upload

details

Testing name:Arduino 2560+W5100  Real-time Room Temperature Send to Pachube.com

Control Board:Arduino 2560

Result:Tep=**C,put the real-time room temperature onto Pachube.com, 10 seconds refreshes again;

First Step:Register an account on www.Pachube.com,Developer account is needed and you will get an API key when register successfully.

pic01.png

Pachube.com is a free website which could show the developer’s real-time data.It built-in API,so that user can send his sensor’s real-time data to his own feed data base.

Second Step:Build a  Material library like www.pachube.com/feeds/23408,then,you need to add a datastream.

pic0.png

Third Step:Piles the W5100 Ethernet board piles up onto the Arduino 2560.LM35 links to 2560’s PIN4.

pic4.png

Fourth Step:Input and compile the code that consist of 3 parts:

1.Set MAC addr、IP addr、API key and Feed ID;

2.Land on the Internet and transform the sensor’s data to degree centigrade,then send to Pachube.com;

3.Monitor the network linking condition and the sensor’s data.If its value is 200 explaining linking successfully,or failed;

1

Fifth Step:Observe your data on the Pachube website and make some changes in order to convenienting your test.

230226gq7ir1744kgpiq54

Code:

#include <Arduino.h>
#include <HardwareSerial.h>
 #include <ERxPachube.h>
 #include <Ethernet.h>
 #include <SPI.h>

byte mac[] = { 0xCC, 0xAC, 0xBE, 0xEF, 0xFE, 0x91 };
 byte ip[] = { 192, 168, 1, 177 };

#define PACHUBE_API_KEY "Your API_KEY"
 #define PACHUBE_FEED_ID Your Feed Id

int potPin = 4;
 float temperature = 0;
 long val = 0;

ERxPachubeDataOut dataout(PACHUBE_API_KEY, PACHUBE_FEED_ID);

void PrintDataStream(const ERxPachube& pachube);

void setup()

{
 Serial.begin(9600);
 Ethernet.begin(mac, ip);
 dataout.addData(0);
 }

void loop() {
 Serial.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
 val = analogRead(potPin);
 temperature = (val*0.0048828125*100);

dataout.updateData(0, temperature);
 int status = dataout.updatePachube();
 Serial.print("sync status code <OK == 200> => ");
 Serial.println(status);
 PrintDataStream(dataout);
 delay(10000);
 }

void PrintDataStream(const ERxPachube& pachube)
 {
 unsigned int count = pachube.countDatastreams();
 Serial.print("data count=> ");
 Serial.println(count);
 Serial.println("<Feed id>,<Temp value>");
 Serial.print(pachube.getIdByIndex(0));
 Serial.print(",");
 Serial.print(pachube.getValueByIndex(0));
 Serial.println();
 }

 

Open Source Project refer to:http://code.google.com/p/pachubelibrary/

PachubeArduino Library Addr:http://code.google.com/p/pachube … ip&can=2&q=

pic3.png

Testing name:Arduino 2560+W5100  Real-time Room Temperature Send to Pachube.com

Control Board:Arduino 2560

Result:Tep=**C,put the real-time room temperature onto Pachube.com, 10 seconds refreshes again;

First Step:Register an account on www.Pachube.com,Developer account is needed and you will get an API key when register successfully.

pic01.png

Pachube.com is a free website which could show the developer’s real-time data.It built-in API,so that user can send his sensor’s real-time data to his own feed data base.

Second Step:Build a  Material library like www.pachube.com/feeds/23408,then,you need to add a datastream.

pic0.png

Third Step:Piles the W5100 Ethernet board piles up onto the Arduino 2560.LM35 links to 2560’s PIN4.

pic4.png

Fourth Step:Input and compile the code that consist of 3 parts:

1.Set MAC addr、IP addr、API key and Feed ID;

2.Land on the Internet and transform the sensor’s data to degree centigrade,then send to Pachube.com;

3.Monitor the network linking condition and the sensor’s data.If its value is 200 explaining linking successfully,or failed;

1

Fifth Step:Observe your data on the Pachube website and make some changes in order to convenienting your test.

230226gq7ir1744kgpiq54

Code:

#include <Arduino.h>
#include <HardwareSerial.h>
 #include <ERxPachube.h>
 #include <Ethernet.h>
 #include <SPI.h>

byte mac[] = { 0xCC, 0xAC, 0xBE, 0xEF, 0xFE, 0x91 };
 byte ip[] = { 192, 168, 1, 177 };

#define PACHUBE_API_KEY "Your API_KEY"
 #define PACHUBE_FEED_ID Your Feed Id

int potPin = 4;
 float temperature = 0;
 long val = 0;

ERxPachubeDataOut dataout(PACHUBE_API_KEY, PACHUBE_FEED_ID);

void PrintDataStream(const ERxPachube& pachube);

void setup()

{
 Serial.begin(9600);
 Ethernet.begin(mac, ip);
 dataout.addData(0);
 }

void loop() {
 Serial.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
 val = analogRead(potPin);
 temperature = (val*0.0048828125*100);

dataout.updateData(0, temperature);
 int status = dataout.updatePachube();
 Serial.print("sync status code <OK == 200> => ");
 Serial.println(status);
 PrintDataStream(dataout);
 delay(10000);
 }

void PrintDataStream(const ERxPachube& pachube)
 {
 unsigned int count = pachube.countDatastreams();
 Serial.print("data count=> ");
 Serial.println(count);
 Serial.println("<Feed id>,<Temp value>");
 Serial.print(pachube.getIdByIndex(0));
 Serial.print(",");
 Serial.print(pachube.getValueByIndex(0));
 Serial.println();
 }

 

Open Source Project refer to:http://code.google.com/p/pachubelibrary/

PachubeArduino Library Addr:http://code.google.com/p/pachube … ip&can=2&q=

pic3.png

COMMENTS

Please Login to comment
  Subscribe  
Notify of