Introduction: Real-time Room Temperature on Your Website (no Javascript or Server Side Coding)

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)

Step 1: Connect 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

Step 2: Register on Partcl.com

Register on Partcl.com. 
After registration you will get a publishing key and a web key.  You will need them for the next steps.

Step 3: Upload the Arduino Code

Upload the Arduino code
Substitute Bold fields with the following information:
-Mac address of your board
-IP of the board in your network. 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.



#include <SPI.h>
#include <Ethernet.h>
#include <Wire.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {0x??, 0x??, 0x??, 0x??, 0x??, 0x??}; //Mac Address of Arduino Ethernet Shield or Ethernet Board
byte ip[] = {???,???,???, ???};  // IP address of the Arduino 
byte server[] = {67, 202, 35, 165}; // 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):

Client client(server, 80);

void setup() {
// start the Ethernet connection:
Ethernet.begin(mac, ip);
// start the serial library:
Serial.begin(9600);
SPI.begin();
Wire.begin();

// give the Ethernet shield a second to initialize:
delay(1000);

}

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()) {
   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();
}

Step 4: Create the Web Page

Create the following html page:
(DO NOT FORGET to substitute "ENTER_YOUR_WEB_KEY_HERE" with a real WEB KEY from your partcl.com home page)
-----------------------------------------------------------
<!DOCTYPE html>
<html>
    <head>
        <script id="partcl_client_script" web_key="ENTER_YOUR_WEB_KEY_HERE" src="http://partcl.com/partcl.full.js"></script>
    </head>
    <body>
        <partcl cell_id="temp_test"></partcl>
        <pchart cell_id="temp_test"></pchart>
    </body>
</html>

-----------------------------------------------------------
DO NOT FORGET to substitute "ENTER_YOUR_WEB_KEY_HERE" with a real WEB KEY from your partcl.com home page.
Later, instead of cell_id="temp_test" you may want to use any other name, just make sure you substituted the cell id in your controller code as well (it is located after the publishing key).
Both <partcl> and <pchart> tags have plenty of properties for "fine tuning". Please do not hesitate to ask if you are interested.
A number of functions, properties and methods in partcl API is growing so rapidly, that we just have no time to update the documentation in time ))

Instead of Arduino you may use a different connection technology. The main trick is to create a sensor system that will send HTTP GET requests to partcl.com.

Enjoy!

Comments

author
PeterE105 made it!(author)2017-03-12

Could i swap the temp sensor for a wheatstone bridge as its still just outputting a series of signals? also doing this wirelessly

author
fhovin made it!(author)2015-10-25

partcl.com doesn't exist anymore. If there are no other sites like that, this tutorial is outdated and should be removed or updates.

author
Konstantin+Dimitrov made it!(author)2016-01-23

Agree, also the code doesn't measure negative temperatures.

author
samzanjal made it!(author)2015-03-09

what about partcl.com it gives error if any other site is their let me know about it .

author
ndaniel5 made it!(author)2014-04-29

Helloo can u please do this for an arduino wifi shield ? thank u

author
rex1324q made it!(author)2013-11-06

Can you change this to accommodate multiple sensors? That would be ideal for my reptiles

author
jbeck12 made it!(author)2013-04-08

OLD
Serial.println(celsius,2);
if (client.connect()) {
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);
NEW
Serial.println(celsius,2);
if (client.connect()) {
client.print("GET /publish?publish_key=ENTER_YOUR_PUBLISHING_KEY_HERE&id=temp_test&value=");
client.print(celsius, 2);
client.println(" HTTP/1.0");
client.println("Host: partcl.com");
client.println();
delay(300);

author
Mape9800 made it!(author)2012-11-26

Is this tutorial still working? I have a arduino Ethernet board and Arduino IDE 1.0 installed. I have created the web page with the html code in the tutorial above. I have a Partcl account. I have entered the web key and the publishing key in both the arduino code and html code. My problem is that the web page is blank, no temperature appear on my site. Is there a problem with this tutorial or is it just me that is 'stupid'?

author
vespapierre made it!(author)2012-10-18

Anyway I would like to use temp sensor what can be go above 85 Celsius..upper limit can be 120-125 Celsius. What can I use? TMP112 is not reachable here in Hungary umfortunately.
Does POE has a limit of the lenght of the CAT5 cable usage?
Many thanks!

author
vespapierre made it!(author)2012-10-18

Hi,

Does the system still working fine? I would like to create this to monitor an air heating solar system. Should I start to order the parts?:):)

author
dbasmb made it!(author)2012-02-29

Thanks apasiechnikov for the details!

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!

author
apasiechnikov made it!(author)2012-03-04

Hi there.
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();
}

author
dbasmb made it!(author)2012-03-08

Thanks for the reply.

You said I would need another library, but the above code shows no library , only the #. Did you forget to add them?

Thanks

author
apasiechnikov made it!(author)2012-03-09


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

author
net0040 made it!(author)2012-01-20

Good Jobs.

About Temperature sensor TMP102,Whether it can replace by DS18B20?
Thanks.

net0040@gmail.com

1.jpg
author
apasiechnikov made it!(author)2012-01-20

Thank you. Sure it can be. Please refer to www.arduino.cc/playground/Learning/OneWire for hints.
Kind regards

author
LeskoIam made it!(author)2012-01-01

I have a similar set-up, just that I use LM35 and python to update my page, you can see it here: http://ardmon.leskos.netne.net

About This Instructable

85,030views

123favorites

License:

More by apasiechnikov:Real-time web control for light decorations (no server side coding)Real-time room temperature on your Website (no javascript or server side coding)
Add instructable to: