Last January, we had some trouble with the heat in my office. Specifically, the kind of trouble wherein the heat is not on, you turn it up, and it still not on. This went on for more than a few days, and finally ended a day or two after we got an email announcing that the heat was broken and speculating that it had probably been down for a few days. My teammates and I laughed a bit at this - we knew exactly when the heat had stopped working. We had a continuous record of the temperature in the office going back months, with 10-minute resolution.

You can do this too, and it's quick, cheap, and easy! This little gadget is built around an electric imp, and you can push the data from the imp out to anywhere you want. In my case, I found it handy to push the data to Sparkfun's Data Stream service, which stores the data for free. Even better, I can use imp.guru's Sparkfun Data Stream frontend to get nice graphs of the data I've collected.

This project takes about an hour to two hours, if you've never done a project with an electric imp before, and when you're done you'll have a thermometer that you can toss anywhere with WiFi and collect data for months to years on a single battery, depending on how often you check the temperature.

Step 1: Gather the Parts

Here are the parts you'll need to build your internet-connected thermometer:

  1. An electric imp (currently available on Sparkfun and Adafruit) - $30
  2. An electric imp breakout board (again, Sparkfun or Adafruit) - $12.50
  3. A 9V battery - $2.00
  4. A 9V battery clip, like this one from Sparkfun (we're just going to cut the end off of it, so the connector doesn't matter) - $1.25
  5. A big capacitor, like this one on Digikey (220 uF, 50V). Make sure it's at least rated to 16V if you're going to connect it to a 9V battery, or you'll have a bad time. - $0.40
  6. A 100kΩ resistor, preferably 1% tolerance, like this one on Digikey. - $0.10
  7. An NTC (negative-temperature-coefficient) Thermistor. I used this one on Digikey. It needs to have a room-temperature resistance equal to your resistor (#6) - this one is 100kΩ at room temperature. - $3.25

Parts total: $49.50

You'll need some tools and supplies, as well:

  1. Soldering iron
  2. Solder
  3. A bit of foam tape or other thick, double-sided tape for securing the battery to the breakout board
  4. Angle cutters / wire cutters
  5. Wire strippers
  6. A smart phone for using BlinkUp to put the imp on your wifi network
  7. A computer to program the imp

Alright! Let's get started!

<p>I'm getting the error &quot;cannot convert the string&quot; on this line:</p><p>assert(typeof(data == &quot;table&quot;));</p><p>I know this is trivial, but I'm trying to understand it. I think the parentheses are misplaced and it should be:</p><p>assert(typeof(data) == &quot;table&quot;);</p><p>but I still get the error &quot;cannot convert the string&quot;. Any idea why?</p>
<p>This device looks to fit my needs exactly, but does anyone know what the accuracy is at temperatures of -20 degrees Celsius +/- 15 degrees C.?</p>
<p>The accuracy would be dependent on the thermistotr you select. The IMP and database provide .01 degree resolution using the agent and device code.</p>
<p>If you're looking for serious accuracy, then thermistors aren't necessarily the best way to go. You should look at digital sensors instead, which are pre-calibrated - there's going to be a new environmental sensor demo board for the imp to replace the current one on Amazon shortly...</p>
<p>Hello! I'm planning on doing this project to keep track of temperature in our office. I can only find a 10K thermistor on adafruit. Would this work if I use a 10k resistor with it but do everything else the same?</p><p>Link to the thermistor: <a href="https://www.adafruit.com/products/372" rel="nofollow">https://www.adafruit.com/products/372</a></p><p>Thank you!</p>
<p>Late reply but: yes, you can. The measurement is ratiometric so as long as the bias resistor matches the thermistor 25C temperature you're all set.</p>
<p>Hi all,</p><p>I'm afraid Tom went to go and make rockets at SpaceX so he can't answer questions on tempbug anymore, but you can always go to the imp forums at forums.electricimp.com to post questions on things like data.sparkfun.com</p>
<p>Sorry if this has already been asked, but can you tell me how to push two pieces of data to data.sparkfun.com at once. I'm using a temp - humidity sensor. I've figured out how to log once piece of data but not both at once. Can you tell me how to modify the stream.push function to send two pieces of data a once (temp and humidity)?</p><p>Thanks</p>
<p>I'd like to bump jrwst36's comment. This Instructable is awesome, though I think it would be even more awesome if 2 thermistor temperatures were pushed to Sparkfun. That would help code newbies (like me) a lot! </p>
<p>My temp bug stopped working and I an trying to reconnect. When I point the imp to my phone it &quot;gathers data&quot; but then notifies me the the connect was unsuccessful....what am I doing wrong?</p>
<p>Howdy Tom!</p><p>I love this project! It does exactly what I need. The construction went very smooth. I am sending the data to spark fun and then graphing it via analog.io, very cool. I have but one problem. The temp that the bug is sending is incorrect. I left the default Fahrenheit read function, but I am getting 150-151 as the readings. Do you think I damaged the thermistor when installing? </p>
<p>I bought a new thermistor, the data sheet b_therm value was slightly different (4540). I unsoldered the original thermistor and installed the new one, being very cautious to not overheat the wires during installation. The unit worked, but the temp was still incorrect. Now it reported 141.x as the reading. After watching the graph for several days it appears the temp is off approximately 69 degrees fahrenheit. So, like any knowledge-less hack, I modified the read_f() function to subtract 69 from the calculated value for degrees in fahrenheit. Yeah, so this is giving me what is &quot;about&quot; the right temp. But even I (as an Aggie and avid practioneer of Aggie Engineering) know there is nothing useful or reliable going on here. Might anyone have some insight as to what I am missing.</p>
<p>The breakout board I got from Sparkfun did not have jumper terminals; luckily I had some around to solder on myself...</p>
<p>This device looks to fit my needs exactly, but does anyone know what the accuracy is at temperatures of -20 degrees Celsius +/- 15 degrees C.?</p>
Awesome tutorial, how do you graph the data?<br><br>Also, the time stamp on the Sparkfun Stream is 3 hours ahead of the device. Any thoughts?
<p>Hi there. It's fantastic. So straightforward, worked first time and tells me exactly how (and if) my solar PV panels are heating my hot water through an ImmerSUN device. I didn't thin k it wasm but this Tempbug proves it is doing exactly as it should. I have it monitoring the hot-water pipe leading out of the tank. I would really like to also be able to monitor the 9v battery voltage too, so I know when to change the battery. I have tried to follow Lathyrus's code, but I get completely lost. and very cold feet! Are there any <strong>simple</strong> lines of code I can insert into Tombrew's code that will give me this, without breaking what already works? If it ain't broke ...! Thank you all. I am alos using Luke Beno's excellent Analog.io to see the data logged in Sparkfun, as imp.guru is no longer available. Brilliant!</p>
<p>Hi there and thanks for the tutorial. I built the TempBug on a breadboard and when it runs I get nothing in the datastream. I the code, I only changed the b_therm value (4600 for my thermistor) and obviously, the keys from sparkfun.</p><p>The log shows something like:</p><p>expecting: batteryvoltage, temp</p><p>2015-06-16 20:45:03 UTC+3[Status]Device connected</p><p>2015-06-16 20:45:03 UTC+3[Status]Device disconnected</p><p>2015-06-16 20:45:03 UTC+3[Device]sleeping until 1434477601000</p><p>2015-06-16 20:45:03 UTC+3[Agent]PUSH: 400 - 0 batteryvoltage missing from sent data.</p><p>Any ideas on where I could start troubleshooting?</p><p>Thanks in advance,</p><p>Marius</p>
<p>Well ... this is just random. Now I soldered the parts on the breakout board and I get single digit values :|</p>
<p>UPDATE: The cod will work only if I remove the &quot;batteryvoltage&quot; tag from sparkfun. But now I'm getting huge values for my temp in celsius ... 150 degrees</p>
<p>This is the first time I've ever made anything like this. I found the instructions to be very detailed and helpful. But I'm not sure why I can't get my Tempbug to work. Here is an example of the idea log I am getting:</p><table><tbody><tr><td>2015-05-30 23:16:14 UTC-7</td><td>[Status]</td><td>Device connected</td></tr><tr><td>2015-05-30 23:16:15 UTC-7</td><td>[Device]</td><td>ERROR: the index 'device' does not exist</td></tr><tr><td>2015-05-30 23:16:15 UTC-7</td><td>[Device]</td><td>ERROR: at main:63</td></tr><tr><td>2015-05-30 23:16:20 UTC-7</td><td>[Status]</td><td>Device disconnected</td></tr><tr><td>2015-05-30 23:16:20 UTC-7</td><td>[Status]</td><td>Device connected</td></tr><tr><td>2015-05-30 23:16:20 UTC-7</td><td>[Device]</td><td>ERROR: the index 'device' does not exist</td></tr><tr><td>2015-05-30 23:16:20 UTC-7</td><td>[Device]</td><td>ERROR: at main:63</td></tr><tr><td>2015-05-30 23:16:25 UTC-7</td><td>[Status]</td><td>Device disconnected</td></tr></tbody></table><p>Can you help me understand what I may have done wrong and how I might be able to fix it?</p>
<p>Could you use a 9v wallwart or a USB wall charger instead of a battery(you could use a small solar panel and run indefinetly) ? And, could you print the data to an excel sheet? Could you manage several of these and have them all printed in one excel?</p><p>This Seems more practical for me at least. Im no expert but these conversions dont seem very difficult.</p>
Wow! Despite not having soldered anything for about 30 years, I was able to build this thermometer without any real difficulty in a couple of hours, and I understand how it works! Thanks Tombrew for the excellent instructions. The only problem I had was that the guy in Maplins gave me the wrong size fixed resistor, so the first time I built it the reading in my livingroom was a chilly -159 degrees C... but with the correct 100k Ohm resistor everything is fine. I also couldn't get blinkup to work with my Sony Android phone so I had to borrow my wiffe's iPhone to do the setup. And getting Xively (Cosm) to draw graphs was tricky until I figured out that I needed a MASTER API key, available under the Settings tab.
<p>Follow-up: The tempbug has been running smoothly in my attic for 9 months now. My first 9 volt battery lasted only a month, checking the temperature every 15 mins. So I changed the interval to 2 hours and my second battery lasted 6 months. I also noticed that the first temperature reading in each cycle is a bit higher than the others (by about 0.5 degree, I don't know why) so I modified the code to ignore the first reading and average the next 10:</p>2014-07-14 06:00:08 UTC+1[Device]ignore: voltage: 3.315 temp: 19.4 C2014-07-14 06:00:08 UTC+1[Device]loop: 0 voltage: 3.313 temp: 18.9 C2014-07-14 06:00:08 UTC+1[Device]loop: 1 voltage: 3.311 temp: 18.4 C2014-07-14 06:00:08 UTC+1[Device]loop: 2 voltage: 3.311 temp: 18.2 C2014-07-14 06:00:08 UTC+1[Device]loop: 3 voltage: 3.311 temp: 18.1 C2014-07-14 06:00:08 UTC+1[Device]loop: 4 voltage: 3.313 temp: 18.2 C2014-07-14 06:00:08 UTC+1[Device]loop: 5 voltage: 3.309 temp: 18.3 C2014-07-14 06:00:08 UTC+1[Device]loop: 6 voltage: 3.311 temp: 18.2 C2014-07-14 06:00:08 UTC+1[Device]loop: 7 voltage: 3.313 temp: 18.2 C2014-07-14 06:00:08 UTC+1[Device]loop: 8 voltage: 3.311 temp: 18.6 C2014-07-14 06:00:08 UTC+1[Device]loop: 9 voltage: 3.311 temp: 18.1 C<p>Building and programming the Imp was so much fun that I bought 2 more and made a phone-controlled electric gate opener, and a gizmo for forcibly rebooting my Wowwee Rovio...</p><p>Thanks again Tombrew for the great intro and instructions!</p>
<p>how did you change to a 2 hour interval? was it in the code inserted into electric imp? if so where?</p>
<p>Here's the complete Device and Agent code that I'm using. It logs the temperature on odd-numbered hours (1 a.m., 3. a.m. etc). It uploads to Xively the temperature (Celsius), WiFi signal strength, battery voltage, and lag (how long it took to do the measurement cycle).</p><blockquote><br></blockquote><blockquote>//KW tempbug device code v2 20nov2013</blockquote><blockquote>// April with a 100k resistor from 3V3 to pin9 and 100k NTC Thermistor from pin9 to pin8</blockquote><blockquote>// pin8 TEMP_READ_EN_L - drive low to enable temp reading (great for batteries!)</blockquote><blockquote>// pin9 ANALOG NTC value</blockquote><blockquote>// benchmarking runtime: first tick with hardware.micros</blockquote><blockquote>local tick = hardware.micros();</blockquote><blockquote>// turn on WiFi powersave to reduce power consumption when awake</blockquote><blockquote>// WiFi is not used until line 44 (no communication with agent until end of program)</blockquote><blockquote>imp.setpowersave(true);</blockquote><blockquote>// Configure Pins</blockquote><blockquote>// pin 8 is driven high to turn off temp monitor (saves power) or low to read</blockquote><blockquote>hardware.pin8.configure(DIGITAL_OUT);</blockquote><blockquote>hardware.pin8.write(1);</blockquote><blockquote>// pin 9 is the middle of the voltage divider formed by the NTC - read the analog voltage to determine temperature</blockquote><blockquote>hardware.pin9.configure(ANALOG_IN);</blockquote><blockquote>// all calculations are done in Kelvin</blockquote><blockquote>// these are constants for this particular thermistor; if using a different one,</blockquote><blockquote>// check your datasheet</blockquote><blockquote>const b_therm = 4450;</blockquote><blockquote>const t0_therm = 298.15;</blockquote><blockquote>// turn on the thermistor network</blockquote><blockquote>hardware.pin8.write(0);</blockquote><blockquote>// gather several pin9 ADC and battery voltage readings and average them </blockquote><blockquote>// (just takes out some noise)</blockquote><blockquote>local val = 0;</blockquote><blockquote>local v_high = 0;</blockquote><blockquote>//skip first measurement (always low)</blockquote><blockquote>imp.sleep(0.01);</blockquote><blockquote>local val_now=hardware.pin9.read(); </blockquote><blockquote>local v_high_now=hardware.voltage();</blockquote><blockquote>local v_therm = v_high_now * val_now / 65535.0;</blockquote><blockquote>local r_therm = 100000.0 / ( (v_high_now / v_therm) - 1);</blockquote><blockquote>local ln_therm = math.log(100000.0 / r_therm);</blockquote><blockquote>local t_therm = (t0_therm * b_therm) / (b_therm - t0_therm * ln_therm) - 273.15;</blockquote><blockquote>local t_str = format(&quot;%.01f&quot;, t_therm);</blockquote><blockquote>local batt_str = format(&quot;%.03f&quot;,v_high_now);</blockquote><blockquote>server.log(&quot;ignore: voltage: &quot; +batt_str +&quot; temp: &quot; +t_str+&quot; C&quot;);</blockquote><blockquote>//then measure 10 times</blockquote><blockquote>for (local i = 0; i &lt; 10; i++) {</blockquote><blockquote> imp.sleep(0.01);</blockquote><blockquote> val_now = hardware.pin9.read();</blockquote><blockquote> v_high_now = hardware.voltage();</blockquote><blockquote> v_therm = v_high_now * val_now / 65535.0;</blockquote><blockquote> r_therm = 100000.0 / ( (v_high_now / v_therm) - 1);</blockquote><blockquote> ln_therm = math.log(100000.0 / r_therm);</blockquote><blockquote> t_therm = (t0_therm * b_therm) / (b_therm - t0_therm * ln_therm) - 273.15;</blockquote><blockquote> t_str = format(&quot;%.01f&quot;, t_therm);</blockquote><blockquote> batt_str = format(&quot;%.03f&quot;,v_high_now);</blockquote><blockquote> server.log(&quot;loop: &quot; +i +&quot; voltage: &quot; +batt_str +&quot; temp: &quot; +t_str+&quot; C&quot;);</blockquote><blockquote> val += val_now;</blockquote><blockquote> v_high += v_high_now;</blockquote><blockquote>}</blockquote><blockquote>val = val/10;</blockquote><blockquote>v_high = v_high / 10.0;</blockquote><blockquote>// turn the thermistor network back off</blockquote><blockquote>hardware.pin8.write(1);</blockquote><blockquote>// scale the ADC reading to a voltage by dividing by the full-scale value and multiplying by the supply voltage</blockquote><blockquote>local v_therm = v_high * val / 65535.0;</blockquote><blockquote>// calculate the resistance of the thermistor at the current temperature</blockquote><blockquote>local r_therm = 100000.0 / ( (v_high / v_therm) - 1);</blockquote><blockquote>local ln_therm = math.log(100000.0 / r_therm);</blockquote><blockquote>local t_therm = (t0_therm * b_therm) / (b_therm - t0_therm * ln_therm) - 273.15;</blockquote><blockquote>// format into a string for the string output port</blockquote><blockquote>local t_str = format(&quot;%.01f&quot;, t_therm);</blockquote><blockquote>server.log(&quot;Current temp is &quot;+t_str+&quot; C&quot;);</blockquote><blockquote>// update the current battery voltage with a nicely-formatted string of the most recently-calculated value</blockquote><blockquote>local batt_str = format(&quot;%.03f&quot;,v_high);</blockquote><blockquote>server.log(&quot;Battery Voltage is &quot;+batt_str);</blockquote><blockquote>// benchmarking runtime</blockquote><blockquote>local tock = hardware.micros();</blockquote><blockquote>server.log(format(&quot;Read cycle took %d us&quot;, (tock-tick)));</blockquote><blockquote>local lag = ((tock-tick)/1000000.0);</blockquote><blockquote>local lag_str = format (&quot;%.06f&quot;,lag);</blockquote><blockquote>//log WiFi signal strength</blockquote><blockquote>function ReportRSSI() {</blockquote><blockquote> local rssi = imp.rssi();</blockquote><blockquote> if (rssi &lt; -87) {</blockquote><blockquote> server.log(&quot;WiFi signal is: &quot; + rssi + &quot; dBm (0 bars)&quot;);</blockquote><blockquote> }</blockquote><blockquote> else if (rssi &lt; -82) {</blockquote><blockquote> server.log(&quot;WiFi signal is: &quot; + rssi + &quot; dBm (1 bar)&quot;);</blockquote><blockquote> }</blockquote><blockquote> else if (rssi &lt; -77) {</blockquote><blockquote> server.log(&quot;WiFi signal is: &quot; + rssi + &quot; dBm (2 bars)&quot;);</blockquote><blockquote> }</blockquote><blockquote> else if (rssi &lt; -72) {</blockquote><blockquote> server.log(&quot;WiFi signal is: &quot; + rssi + &quot; dBm (3 bars)&quot;);</blockquote><blockquote> }</blockquote><blockquote> else if (rssi &lt; -67) {</blockquote><blockquote> server.log(&quot;WiFi signal is: &quot; + rssi + &quot; dBm (4 bars)&quot;);</blockquote><blockquote> }</blockquote><blockquote> else {</blockquote><blockquote> server.log(&quot;WiFi signal is: &quot; + rssi + &quot; dBm (5 bars)&quot;);</blockquote><blockquote> }</blockquote><blockquote> return rssi;</blockquote><blockquote>}</blockquote><blockquote>local rssi = ReportRSSI();</blockquote><blockquote>//attempt to send it to Xively...</blockquote><blockquote>agent.send(&quot;Xively-temp&quot;, t_str); // send data to Xively</blockquote><blockquote>agent.send(&quot;Xively-lag&quot;, lag_str); // send data to Xively</blockquote><blockquote>agent.send(&quot;Xively-battery&quot;, batt_str); // send data to Xively</blockquote><blockquote>agent.send(&quot;Xively-rssi&quot;, rssi); // send data to Xively</blockquote><blockquote>// wake up every 2 hours on odd-numbered hours (prevents drifting on slow DHCP)</blockquote><blockquote>imp.onidle( function() {</blockquote><blockquote> local secsToEvenHour = (1+ 120*60 - (time()%(120*60)) );</blockquote><blockquote> local secsToOddHour = secsToEvenHour - (60*60);</blockquote><blockquote> if (secsToOddHour &lt; 0) {secsToOddHour += (120*60);}</blockquote><blockquote> local snoozelength = secsToOddHour;</blockquote><blockquote> server.log(&quot;snoozing for &quot; + (snoozelength / 60) + &quot; minutes and &quot; + (snoozelength % 60) + &quot; seconds&quot; );</blockquote><blockquote> server.sleepfor(snoozelength);</blockquote><blockquote>});</blockquote><blockquote>// full firmware is reloaded and run from the top on each wake cycle, so no need to construct a loop</blockquote><blockquote>##################### CUT HERE ######################</blockquote><blockquote>//KW tempbug agent code v2 20nov2013</blockquote><blockquote>//********************BEGIN XIVELY********************</blockquote><blockquote>//Code written by @beardedinventor modified for use by Joel Wehr</blockquote><blockquote>API_Key &lt;- &quot;pdyL6p9fp9zVtakiNqFGTaKGXPwqnMuxCdfM7258b1D8D6LI&quot;; //Type your Xively API Key</blockquote><blockquote>Feed_ID &lt;- &quot;1282406454&quot; //Type your Feed ID</blockquote><blockquote>/// Channel_ID &lt;- &quot;thermistor&quot;; //Type your Channel ID -- modified by KW - see bottom of program</blockquote><blockquote>Xively &lt;- {}; // this makes a 'namespace'</blockquote><blockquote>class Xively.Client {</blockquote><blockquote> ApiKey = null;</blockquote><blockquote> triggers = [];</blockquote><blockquote> constructor(apiKey) {</blockquote><blockquote> this.ApiKey = apiKey;</blockquote><blockquote> }</blockquote><blockquote> /*****************************************</blockquote><blockquote> * method: PUT</blockquote><blockquote> * IN:</blockquote><blockquote> * feed: a XivelyFeed we are pushing to</blockquote><blockquote> * ApiKey: Your Xively API Key</blockquote><blockquote> * OUT:</blockquote><blockquote> * HttpResponse object from Xively</blockquote><blockquote> * 200 and no body is success</blockquote><blockquote> *****************************************/</blockquote><blockquote> function Put(feed){</blockquote><blockquote> local url = &quot;https://api.xively.com/v2/feeds/&quot; + feed.FeedID + &quot;.json&quot;;</blockquote><blockquote> local headers = { &quot;X-ApiKey&quot; : ApiKey, &quot;Content-Type&quot;:&quot;application/json&quot;, &quot;User-Agent&quot; : &quot;Xively-Imp-Lib/1.0&quot; };</blockquote><blockquote> local request = http.put(url, headers, feed.ToJson());</blockquote><blockquote> return request.sendsync();</blockquote><blockquote> }</blockquote><blockquote> /*****************************************</blockquote><blockquote> * method: GET</blockquote><blockquote> * IN:</blockquote><blockquote> * feed: a XivelyFeed we fulling from</blockquote><blockquote> * ApiKey: Your Xively API Key</blockquote><blockquote> * OUT:</blockquote><blockquote> * An updated XivelyFeed object on success</blockquote><blockquote> * null on failure</blockquote><blockquote> *****************************************/</blockquote><blockquote> function Get(feed){</blockquote><blockquote> local url = &quot;https://api.xively.com/v2/feeds/&quot; + feed.FeedID + &quot;.json&quot;;</blockquote><blockquote> local headers = { &quot;X-ApiKey&quot; : ApiKey, &quot;User-Agent&quot; : &quot;xively-Imp-Lib/1.0&quot; };</blockquote><blockquote> local request = http.get(url, headers);</blockquote><blockquote> local response = request.sendsync();</blockquote><blockquote> if(response.statuscode != 200) {</blockquote><blockquote> server.log(&quot;error sending message: &quot; + response.body);</blockquote><blockquote> return null;</blockquote><blockquote> }</blockquote><blockquote> local channel = http.jsondecode(response.body);</blockquote><blockquote> for (local i = 0; i &lt; channel.datastreams.len(); i++)</blockquote><blockquote> {</blockquote><blockquote> for (local j = 0; j &lt; feed.Channels.len(); j++)</blockquote><blockquote> {</blockquote><blockquote> if (channel.datastreams[i].id == feed.Channels[j].id)</blockquote><blockquote> {</blockquote><blockquote> feed.Channels[j].current_value = channel.datastreams[i].current_value;</blockquote><blockquote> break;</blockquote><blockquote> }</blockquote><blockquote> }</blockquote><blockquote> }</blockquote><blockquote> return feed;</blockquote><blockquote> }</blockquote><blockquote>}</blockquote><blockquote>class Xively.Feed{</blockquote><blockquote> FeedID = null;</blockquote><blockquote> Channels = null;</blockquote><blockquote> constructor(feedID, channels)</blockquote><blockquote> {</blockquote><blockquote> this.FeedID = feedID;</blockquote><blockquote> this.Channels = channels;</blockquote><blockquote> }</blockquote><blockquote> function GetFeedID() { return FeedID; }</blockquote><blockquote> function ToJson()</blockquote><blockquote> {</blockquote><blockquote> local json = &quot;{ \&quot;datastreams\&quot;: [&quot;;</blockquote><blockquote> for (local i = 0; i &lt; this.Channels.len(); i++)</blockquote><blockquote> {</blockquote><blockquote> json += this.Channels[i].ToJson();</blockquote><blockquote> if (i &lt; this.Channels.len() - 1) json += &quot;,&quot;;</blockquote><blockquote> }</blockquote><blockquote> json += &quot;] }&quot;;</blockquote><blockquote> return json;</blockquote><blockquote> }</blockquote><blockquote>}</blockquote><blockquote>class Xively.Channel {</blockquote><blockquote> id = null;</blockquote><blockquote> current_value = null;</blockquote><blockquote> constructor(_id)</blockquote><blockquote> {</blockquote><blockquote> this.id = _id;</blockquote><blockquote> }</blockquote><blockquote> function Set(value) {</blockquote><blockquote> this.current_value = value;</blockquote><blockquote> }</blockquote><blockquote> function Get() {</blockquote><blockquote> return this.current_value;</blockquote><blockquote> }</blockquote><blockquote> function ToJson() {</blockquote><blockquote> local json = http.jsonencode({id = this.id, current_value = this.current_value });</blockquote><blockquote> server.log(json);</blockquote><blockquote> return json;</blockquote><blockquote> }</blockquote><blockquote>}</blockquote><blockquote>client &lt;- Xively.Client(API_Key);</blockquote><blockquote>//********************END XIVELY********************</blockquote><blockquote>device.on(&quot;Xively-temp&quot;, function(v) {</blockquote><blockquote> channel1 &lt;- Xively.Channel(&quot;temperature&quot;);</blockquote><blockquote> channel1.Set(v);</blockquote><blockquote> feed1 &lt;- Xively.Feed(Feed_ID, [channel1]);</blockquote><blockquote> client.Put(feed1);</blockquote><blockquote>});</blockquote><blockquote>device.on(&quot;Xively-lag&quot;, function(v) {</blockquote><blockquote> channel1 &lt;- Xively.Channel(&quot;lag&quot;);</blockquote><blockquote> channel1.Set(v);</blockquote><blockquote> feed1 &lt;- Xively.Feed(Feed_ID, [channel1]);</blockquote><blockquote> client.Put(feed1);</blockquote><blockquote>});</blockquote><blockquote>device.on(&quot;Xively-rssi&quot;, function(v) {</blockquote><blockquote> channel1 &lt;- Xively.Channel(&quot;WiFi&quot;);</blockquote><blockquote> channel1.Set(v);</blockquote><blockquote> feed1 &lt;- Xively.Feed(Feed_ID, [channel1]);</blockquote><blockquote> client.Put(feed1);</blockquote><blockquote>});</blockquote><blockquote>device.on(&quot;Xively-battery&quot;, function(v) {</blockquote><blockquote> channel1 &lt;- Xively.Channel(&quot;battery&quot;);</blockquote><blockquote> channel1.Set(v);</blockquote><blockquote> feed1 &lt;- Xively.Feed(Feed_ID, [channel1]);</blockquote><blockquote> client.Put(feed1);</blockquote><blockquote>});<br></blockquote>
<p>Great. Thanks! How would I have it run every 6 hours starting at 8:00 am? I can see where to do it every 6 hours - just 60 *6. But how would I make it start the 6 hour cycle at 8:00 am, 2:00 pm, 8:00 pm, or 2:00 am? </p>
<p>Here are the graphs on Xively for 3 months</p>
<p>And here's what my code writes to the Electric Imp IDE log window every 2 hours.</p>
<p>Is there a way to send the remaining battery life data as well as the temperature reading?</p>
<p>This is really great and the simple to follow instructions got me up and running very easily. I'm trying to take this to the next level now and I've created an amazon cloud instance with Phant.io running. I'm not a great coder, certainly not for squirrel, and I was wondering what I need to change in the IMP agent code to redirect to my own cloud instance running Phant.io rather than sparkfun. Any help much appreciated. </p>
<p>Thanks for making this easy to build! but I'm having a problem Xively isn't allowing any new accounts now. so i have this but have no where to sent the info. i tried to use another site thingspeak.com but the code wont work with the way its wired. i was wondering if you have any ides what i can do. thanks for any help you can give!</p>
Wondered if that would happen. <br><br>imp.guru has a nice graphing front end for devices like this. They built their front end on top of Sparkfun's data store. It looks pretty good - I should get around to switching my examples all over to it. Try it out here: http://imp.guru/<br><br>
<p>Hi, I just found a blog entry about temperature logging using the Electric Imp and using a graph from ThingSpeak here:</p><p><a href="http://www.slickstreamer.info/2013/09/electric-imp-solar-powered-temperature.html" rel="nofollow">http://www.slickstreamer.info/2013/09/electric-imp...</a></p><p>I'm a novice at programming, but do you think it would be possible to reuse the code from Slickstreamer in the Tempbug project?</p>
<p>Absolutely, though I haven't dug into slickstreamer at all. If you can send HTTP requests to post data, then the imp can do it!</p>
<p>Just updated this instructable to use Sparkfun and imp.guru, so no more Xively troubles!</p>
<p>What kind of wireless range does the imp have?</p>
<p>It's very good! Better than your phone or computer; it has the same WiFi chip in it your phone probably has, but the antenna isn't surrounded by a battery and a metal frame. </p>
<p>Similar to a laptop's wifi card. My Imp in the attic and the router is in the hallway 2 floors below it on the opposite side of the house. When the Imp's battery begins to run out, the WiFi signal it detects drops, and when if falls below about -93 dBm it can't connect anymore.</p>
<p>hah, finally read through all the comments and my Qs are answered. Thanks again for the writeup. This will be perfect for my situation!</p>
<p>wow! awesome instructions! I was planning on hacking sth together with an arduino I've got hibernating in a drawer since last xmas, but you won me over with this tutorial. </p><p>going to set this up in a utility room at home. I already set up a raspi webcam for visual access, now for temp readings. I've got water pipes that are at risk of freezing in severe weather and this puppy will help me set up alarm notifications for my computer and phone when the temp gets too low. </p><p>After that I plan on adding a wifi connected water sensor with notification to monitor for leaks. </p><p>If I have an outlet nearby I assume that I can simply use a usb power supply for the board instead of the battery, right?</p><p>I assume squirrel enables the option for sending temp readings to anywhere I like, right? I'm building a simple website with a dashboard of info from a bunch of devices, like a couple home security webcams i made with raspis and probably two or three of these tempbugs. Got any advice on whether SQLite would be a good choice or another database? Or perhaps I can tap into the Xively API to feed my webpage dashboard...</p><p>Thanks for a great project idea!</p>
<p>hello sir i need to build a wake up signal with int pin with other exisiting pins through pushbutton, like pin1 can be wake by pin2 and pin5 via pushbutton pressed..</p>
<p>I had the thermometer up on Xively yesterday, but was having trouble with measuring temperature. Then I tried to modify the code, made a mess, and then decided to start from scratch and got rid of everything on electric imp. I started by attempting to relink via BlinkUp and can't get it to link up. Any thoughts on how to get BlinkUp to work again?</p>
<p>You actually don't need to BlinkUp again; you can just edit the code in the model you've already created. When you hit &quot;build and run&quot; in the IDE, the code you have in the IDE is built and sent to the imp, wiping out the previous code. </p><p>BlinkUp is only needed when initially configuring or changing the WiFi credentials on the imp. As long as you're in the same Electric Imp account and on the same WiFi network you were on before, there's no need to do it again. </p><p>If you've lost your WiFi configuration and are now having trouble using BlinkUp to get it back, you can take a look at the documentation and tips on BlinkUp here: https://electricimp.com/docs/gettingstarted/1-blinkup/</p>
<p>Thanks for a great list of instructions. You really have done an outstanding job making this manageable for a for someone with limited tech skills! </p><p>I have been able to setup the code and the integration to Xively but am having trouble with the readings. The readings remain steady at say 50 for quite a while then spike up to 120 or plunge to -119. Sometimes they stay at say -10 for an extended period of time. Attached is a picture of the Xively graph.</p><p>Have tested the readings by placing the E-Imp next to hot and cold items but there is little fluctuation in the readings. </p><p>No doubt I have made a simple error somewhere but am struggling to find it.</p><p>For the moment the power supply is by USB from a laptop. Am planning on soldering on the battery once the readings work properly.</p><p>Any feedback or suggestions would be appreciated.</p><p>Thanks again!</p>
<p>Sounds like a flaky connection somewhere in your thermistor circuit. Go back over your solder joints and make sure they're all holding together properly. It might be a good idea to look up a tutorial on soldering if you're unfamiliar; I've covered the basics here but a more in-depth of cold solder joints and how to avoid them might save you some time. </p>
<p>Thanks for the instructions, there were one thing that was not mentioned in putting this together, the 2 pin jumper. I temporarily made one from wire. One problem that I am having is I am not getting temperature reads. The request log is running properly - there are request and responses - but nothing shows up in the graph to the left. Any thoughts?</p>
<p>Try to write the temperature as a server.log() statement in the Imp IDE first, to make sure the thermistor is working correctly, before you try to draw graphs in Xively. Uploading data to Xively is tricky - I eventually got something to work, but I don't really understand how it works! </p>
<p>I tried to build it--great, thorough, easily understandable instructions, but I am not getting any info posted to Xively. I copied the info for lines 7 and 8, and although the project seems to cycle as expected, the log states:</p><p>Posted to Xively: 120.21, got return code: 56, msg: &lt;html&gt;</p><p>&lt;head&gt;&lt;title&gt;400 Bad Request&lt;/title&gt;&lt;/head&gt;</p><p>body bg color=&quot;white&quot;&gt;</p><p>&lt;center&gt;&lt;hi&gt;400 Bad Request&lt;/hi&gt;&lt;/center&gt;</p><p>&lt;hr&gt;&lt;center&gt;nginx/1.1.19&lt;/center&gt;</p><p>&lt;/body&gt;</p><p>&lt;/html&gt;</p><p>I am getting no data posted, and the Request log sits empty with the &quot;waiting for requests area&quot; just cycling. Where have I screwed up? I could send you any additional information you request, if needed</p>
<p>Hi Lenny,</p><p>Sorry, that sounds frustrating! Let's look over your code on a direct message.</p>

About This Instructable



Bio: Developer at Electric Imp
More by tombrew:NeoWeather: Ambient Weather Indicator Imp Chef: Internet-Connected BBQ Thermometer imPrinter: the Electric Imp wireless, internet-connected thermal printer 
Add instructable to: