'via Blog this'
This is how to push high resolution real-time data from Arduino-based temperature sensor to your web page without any server-side coding.
Arduino is a great device for collecting, storing and transferring data from various sensors but there are times you need to make your data accessible from any place over the internet, like I did for room temperature in my study.
That’s when this solution may come handy.
The solution utilises a cloud-based real time web publishing tool Partcl.com that allows you to publish any data with about 0.1 second latency.
First you will need:
- Temperature sensor TMP102 on sparkfun breakout board
- Arduino Ethernet (which is in fact is Arduino + Ethernet Shield)
- wires
- ethernet cable
-power adaptor for Arduino
- Free account on Partcl.com (when registered you will get your publishing and web keys which you will put into Arduino code and in http code on your website)
Arduino is a great device for collecting, storing and transferring data from various sensors but there are times you need to make your data accessible from any place over the internet, like I did for room temperature in my study.
That’s when this solution may come handy.
The solution utilises a cloud-based real time web publishing tool Partcl.com that allows you to publish any data with about 0.1 second latency.
First you will need:
- Temperature sensor TMP102 on sparkfun breakout board
- Arduino Ethernet (which is in fact is Arduino + Ethernet Shield)
- wires
- ethernet cable
-power adaptor for Arduino
- Free account on Partcl.com (when registered you will get your publishing and web keys which you will put into Arduino code and in http code on your website)
Remove these ads by Signing Up
Step 1Connect the sensor as shown on the picture.
Connect the sensor as shown on the picture.
Image is taken from incredibly good blog http://bildr.org
I often use it as a reference
Image is taken from incredibly good blog http://bildr.org
I often use it as a reference
« Previous Step | Download PDFView All Steps | Next Step » |
You said: "If you have DHCP and can not specify a fixed IP address, you will need another library and slightly different code. I will be more then happy to provide any additional instructions if needed."
I do have DHCP and would like the details. I'm not up to speed on interfacing Arduino to the internet, so that would be quite helpful. Also, can you tell me if it's possible to add this data to my dyndns.org web page where I have my Foscam IP camera displayed or is that a totally different animal. If it's possible, I would appreciate it if you could point me in the right direction, so I can proceed to figure it out!
Thanks!
Sorry for the delay,
For the second question, yes it will work everywhare.
The first question:
below it is a "modern solution"
You have to upgrage your Arduino IDE to 1.0 and then the code should read:
(minor changes)
It will deal with DHCP
#include
#include
#include
// Enter a MAC address and IP address for your controller below.
byte mac[] = {0x??, 0x??, 0x??, 0x??, 0x??, 0x??}; //Mac Address of Arduino Ethernet Shield or Ethernet Board
char serverName[] = "www.partcl.com";
int tmp102Address = 0x48;
// Initialize the Ethernet client library
// with the IP address and port of the server
// that you want to connect to (port 80 is default for HTTP):
EthernetClient client;
void setup() {
// start the serial library:
Serial.begin(9600);
SPI.begin();
Wire.begin();
// start the Ethernet connection:
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
while(true);
}
delay(1000);
Serial.println("connecting...");
}
void loop()
{
Wire.requestFrom(tmp102Address,2);
byte MSB = Wire.receive();
byte LSB = Wire.receive();
int TemperatureSum = ((MSB << 8) | LSB) >> 4; //it's a 12bit int,
using two's compliment for negative
float celsius = TemperatureSum*0.0625;
Serial.println(celsius,2);
if (client.connect(serverName, 80)) {
client.print("GET
/publish?publish_key=ENTER_YOUR_PUBLISHING_KEY_HERE&id=temp_test&value=");
client.print(celsius, 2);
client.print(" HTTP/1.1\r\n");
client.print("Host: partcl.com\r\n");
client.print("User-Agent: Arduino For Teh Win!\r\n");
client.print("Accept: text/html\r\n");
client.println("Connection: close\r\n");
client.println();
delay(300);
}
client.stop();
}
You said I would need another library, but the above code shows no library , only the #. Did you forget to add them?
Thanks
Sorry, I think it was some parsing trick here ))
in IDE 1.0 Ethernet library deals with DHCP
so oinclude the same libraries as in step 3
About Temperature sensor TMP102,Whether it can replace by DS18B20?
Thanks.
net0040@gmail.com
Kind regards