Web Based Thermometer

154

1

1

Posted

Introduction: Web Based Thermometer

First Time Author Contest 2018

This is an entry in the
First Time Author Contest 2018

Some years ago tombrew made TempBug, a web based Thermometer. He used an Electric Imp Card and a thermistor as sensor. I followed his instructions and for years I was able to monitor ambient temperature remotely. Recently the sites TempBug needed to work properly became unreachable and so I had to find a solution.

You need an Electric Imp account:

https://impcentral.electricimp.com/login

And a ThingSpeak account:

https://thingspeak.com/

Both are free for basic tasks. Connect the TMP36 sensor, insert the USB cable and the Electric Imp card. Perform BlinkUp with your Android or iOS smartphone to connect the Imp to your WiFi network. As a last step you need to copy and paste the Agent and Device code in your impcentral Development Device Product:

AGENT

local thingspeakUrl = "http://api.thingspeak.com/update"; local headers = { "Content-Type": "application/x-www-form-urlencoded", "X-THINGSPEAKAPIKEY":"XXXXXXXXXXXXXXXX" };

local field = "field1";

function httpPostToThingspeak (data) { local request = http.post(thingspeakUrl, headers, data); local response = request.sendsync(); return response; }

device.on("updateTemp", function(temp) { local response = httpPostToThingspeak(field +"="+temp); server.log(response.body); });

DEVICE

hardware.pin8.configure(ANALOG_IN);

function getTemp() { local supplyVoltage = hardware.voltage(); local voltage = supplyVoltage * hardware.pin8.read() / 65535.0;

local c = (voltage - 0.5) * 100 ; local c_str = format("%.01f", c); server.log("Current temp is "+c_str+" °C");

agent.send("updateTemp", c_str); }

imp.onidle(function() { getTemp(); server.sleepfor(30); });

Step 1:

Since spaces, returns and parentheses are important, you can check the way they should look by clicking on the above picture.

Step 2:

Here you can see what can be achieved after all the hard work...

Good Luck!

Share

Recommendations

  • Epilog Challenge 9

    Epilog Challenge 9
  • First Time Author Contest 2018

    First Time Author Contest 2018
  • Paper Contest 2018

    Paper Contest 2018
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

Comments

That's a neat simple setup :)