This instructable will explain how to:
* connect a DS18B20 temperature sensor to an arduino
* read from the sensor using the 1-wire interface
* send that data to xively.com directly from the arduino
* view the resulting graph on the internet

http://xively.com is an Internet of Things host that generates graphs based on data you provide. In this example I am going to use it to monitor the temperature in my room. It's not a hackerspace, my wife keeps it far too tidy for that.

Step 1: Parts list

* Arduino with ethernet shield
I have an arduino Uno clone and a wiznet 5100 shield.
* Power supply (it can be powered via the USB port)
I was fortunate that my router has USB ports that provide the 5v output meaning the arduino  is powered whenever the router is and saves a plug, electricity, the environment and the  future of the world.
* DS18B20 temperature sensor
* RJ45 network cable connected between the arduino and your router
<p>This setup will prevent you from using the capabilities of this perfectly designed IC. That is the adressing multiple IC's (temperature readouts) on the same line. </p>
<p>Hi. is there a way to give their own names sensors (data streams)? Eg. Kitchen, living room, etc. I have 6 sensors.</p>
<p>Hi<br>The lines to change are<br>&lt;code&gt;// Define the strings for our datastream IDs</p><p>char sensorId[] = &quot;temp&quot;;&lt;/code&gt;<br>specifically, change &quot;temp&quot; to each of your device names eg &quot;garage temp&quot;</p>
<p>I have been thinking about this for sensor 1 = kitchen, sensor 2 = living room and so on. Where to enter the name of the second third and subsequent sensors? Everyone must have a different name.</p>
<p>I want to make circuit b using 4 sensors and 4 single resistor sensor connections print.4 sensor enough for my seven-inch screen. Is there another Arduino, or need</p>
<p>Hi. if someone was able to run it with multiple sensors (5)?</p>
<p>for multiple sensors in the end of the code after Serial.println(&quot;Uploading it to Xively&quot;); </p><p>replace </p><p>datastreams[0] = { <br> XivelyDatastream(sensorId, strlen(sensorId), DATASTREAM_FLOAT), <br> };</p><p>with</p><p>XivelyDatastream datastreams[0] = XivelyDatastream(sensorId, strlen(sensorId), DATASTREAM_FLOAT);</p><p>Worked for me, hope that helps.</p>
<p>slightly corrected and in my code runs on multiple sensors.</p><p>I just have a problem with the naming of streams. What I mean is that the individual data struienia zwoimi call names and not the serial numbers of sensors.</p>
<p>silver111,</p><p>May I ask what you did to get multiple sensors working? I'd like to add additional temp probes but haven't been having much luck.</p>
<p>Error:</p><p>Serial.println(&quot;Uploading it to Xively&quot;);<br> datastreams[0] = {<br> XivelyDatastream(sensorId, strlen(sensorId), DATASTREAM_FLOAT),<br> };</p><ul><li>------------------------</ul>sketch_feb13d.ino: In function 'void loop()':<br><p>sketch_feb13d:178: error: expected primary-expression before '{' token<br>sketch_feb13d:178: error: expected `;' before '{' token</p>
<p>Hi. if you were able to run the project with multiple sensors?</p>
There is a missing after the , in that line. I will have a look shortly and get b back to you.
<p>Error,</p><p>Please give solution...</p><p>IP address:</p><p> Chip = DS18B20</p><p>Current temperature: 33.13 celsius</p><p>Uploading it to Xively</p><p>xivelyclient.put returned -3</p>
<p>Connection and setup done but not working...</p>
<p>Greg; Hi. As with rparkera and sidbin below, I have the same problem with the multiple sources sketch that they have.</p><p>I get the following errors:</p><p>Multiple_Xively.ino: In function 'void loop()':</p><p>Multiple_Xively:179: error: expected primary-expression before '{' token</p><p>Multiple_Xively:179: error: expected `;' before '{' token</p><p>Multiple_Xively:188: error: expected `}' at end of input</p><p>You were going to get back to sidbin, but don't seem to have done so.</p><p>And for the record, I have only just started using Arduino as it's the most practical solution (I think) to a long running temperature monitoring problem I have.</p><p>Thanks...!</p>
<p>Hi there - great instructable. Many thanks </p><p>Did you ever get back on sidbin's query? I have exactly the same problem. The single datastream works fine - but I can't get the multiple sources working. Help!</p>
<p>Some other example to use for xively reporting - use it to track URL performance..</p><p><a href="http://linuxadvices.blogspot.ru/2014/02/log-url-performance-in-xively.html" rel="nofollow">http://linuxadvices.blogspot.ru/2014/02/log-url-performance-in-xively.html</a></p>
<p>Works for me thank you to share it</p>
<p>here is my feed:</p><p><a href="https://xively.com/feeds/163946092" rel="nofollow">https://xively.com/feeds/163946092</a></p><p>But I don't think it's public yet. Can you help me with that?</p>
<p>It works for me :)</p>
hi i have followed your instructable and it works great! <br> <br>im am thinking of adding some xtra ds18b20 sensors and wonder how to adress them any hints? <br> <br>thanks <br> <br>Nico <br>
Just plug them in in parallel. The code will read them in order. <br>To update more than one datastream, look at the dataStreams[] parts of the code. <br>
<p>Thanks for the tutorial. I tried it and its working great with 1 sensor, but i cant see how to get a second or more sensors working. Any chance you could elaborate on the above a little more? Thanks in advance...</p>
Hi guys I need your help, <br> <br>I've followed all the steps in this great tutorial but it doesn't work for me. <br> <br>I keep on getting &quot;No more addresses&quot; in the serial monitor and xively is not receiving any datapoints. <br> <br>What does this mean and how could it be solved? <br> <br>It would be really great if one of you could help me
Hey guys I have a problem. <br>I would like to add more sensors (DS18B20) and it fails. <br> <br>Could you help me i am a beginner. <br> <br>Thank you in advance for your help <br> <br>standa
Hi, <br>Thanks for your intructable ! :-) <br>It worked perfectly for 9 minutes, but now it's not sending anything&hellip; <br>What is the problem ?
Hi Zenius :) <br> <br>Are you powering the Arduino from a steady power supply? <br>Have you tried resetting the Arduino? <br>Mine has been running pretty much continuously since it was set up with no issues apart from when the network cable became loose a couple of times. I think it has also only been turned off a couple of times too when I was sorting out round the router. <br> <br>Get back to me :)
Hi there! Im trying to use your xively code but Im getting an &quot;i&quot; was not declared in this scope error. Would you know why this might be ? Im a bit new to arduino
Fixed in the code.<br><br>I missed the line<br>int i;<br>after<br>float celcius;<br><br>I apologise for the oversight.
Thx a lot. Now it works perfect
Glad I could help :)<br><br>What's your xively link so I can see it working? :)
This is my link. https://xively.com/feeds/1172808344 Tried to get a second temp read working but luck so far
I have everything wired up the same way as in your sketch except I don't seem to be getting any data from the sensor. When i use the example one wire sketch specific to the sensor it has no problems. any ideas?
I apologise, I forgot to do the actual reading of the chip in the above code :P <br> <br>You need to add the following <br> <br>for ( i = 0; i &lt; 9; i++) { // we need 9 bytes <br> data[i] = ds.read(); <br> <br>after <br> <br>ds.write(0xBE); // Read Scratchpad <br> <br>
Please help, everything is fine just unable to get data from 18B20 Sensor it show IP address: <br>Chip = DS18B20 <br>Current temperature: 0.00 celsius <br>Uploading it to Xively <br>xivelyclient.put returned 200 <br>i have double check the connection is correct. <br>
I apologise, I forgot to do the actual reading of the chip in the above code :P <br> <br>You need to add the following <br> <br>for ( i = 0; i &lt; 9; i++) { // we need 9 bytes <br> data[i] = ds.read(); <br> <br>after <br> <br>ds.write(0xBE); // Read Scratchpad <br> <br>
I apologise, I forgot to do the actual reading of the chip in the above code :P <br> <br>You need to add the following <br> <br>for ( i = 0; i &lt; 9; i++) { // we need 9 bytes <br> data[i] = ds.read(); <br> <br>after <br> <br>ds.write(0xBE); // Read Scratchpad <br> <br>

About This Instructable


51 favorites


Bio: Focussing currently on supplying open source software to the masses. I supply linux CDs and DVDs across Europe, as well as mirror various open source ... More »
More by gregoryfenton: LinkIt One Tutorials - #14 Traffic lights LinkIt One Tutorial #13 - Send a tweet LinkIt One tutorials - #0 Fix that pesky Serial port!
Add instructable to: