Arduino Basic Temperature Monitor

This Arduino code reads a Dallas Semiconductor One-Wire temperature sensor and reports to an Exosite Portal via the Ethernet Shield.


Overview

This article describes the hook-up information and code for a simple network connected temperature monitoring device based on the Arduino platform that sends temperature data to my Exosite portal with Exosite's basic HTTP API. On Exosite Portals, I have set up events on certain conditions (Temp less than 40 degrees for example) to alert me (via Email and SMS text) that the event condition exists. (SMS: Your Pipes are going to freeze!)

What is Arduino?

An open-source prototyping platform ... for all you ever need to know on Arduino, check out the Arduino website. The version of the platform used here has an Atmel ATmega328 microcontroller.

Hardware:

- Arduino Uno - Link
- Arduino Ethernet Shield - Link
- Dallas Semiconductor DS18B20 One-Wire Temperature Sensor - Datasheet
- A 4.7k ohm resistor
- A little wire and heat-shrink tubing (optional).

The Arduino Uno, Ethernet Shield, and temp sensor were all purchased from SparkFun.

Set-up

The Arduino Uno and Ethernet Shield are simple to connect, the Ethernet Shield plugs into the top of the Uno board and by plugging in the USB cable, both are powered and ready to go. The temp sensor requires a little breadboard work or soldering. I choose to create a little cable (~6 inches) to keep the temp sensor away from the heat coming off the boards. This DS18B20 sensor is great because it can be powered with the data signal using parasite power. I recommend reading up on the data-sheet on this option, but essentially the sensor grabs a little power off the signal line when it is a high logic level. So two-wires can be used, a ground and the signal with a 4.7k pull-up resistor on it to 5V. I chose the Arduino Uno's signal pin 7, since it is not being used for anything on the Ethernet Shield. I used enough wire for about 6 inches of length and once connected, used heat-shrink tubing to wrap it all up. (Note: I've tried putting these temp sensors right on the main board, but the heat from the power regulators and chips affects it greatly.)





Software

Note: This project page was updated in November, 2013 to include updated code for Arduino 1.0x and Exosite library version v2.1.1.
The Arduino IDE is easy to install and use, check out the installers here. It runs on Mac, Windows, and Linux. Once installed, create a new "sketch" and use the example application provided for the Exosite Library for your source code for the sketch.

The temperature monitor example application uses five libraries, two of the five are included in the Arduino install, those two are 'SPI' and 'Ethernet'. The third library required is for the one-wire interface. This library can be found on on the Arduino "Playground" section , specifically version 2.0. The Dallas Temperature Control library can be found here. (Thanks to all that have contributed to these existing libraries!).

The Exosite library (and application) can be found here.
(Note: as of November 1, 2013, this project's application code is an example available in the Exosite Arduino Library.)  


 
The actual code should be easy to understand. It uses the Ethernet library to set up a network connection and the Exosite library to write data to the Exosite One Platform.  It reads the temperature over the one-wire interface, and sends the value to the platform every 120 seconds with the Basic HTTP API from Exosite.  I left a lot of comments and debug serial messages in the code, taking these out would show there are very few lines of code.

User Configuration:
These parameters should be modified or reviewed in the code:
  • CIK - The Exosite CIK for your device (get from portals.exosite.com after adding a generic device)
  • MAC Address - The Ethernet MAC Address for your Ethernet chip (your local LAN may not like the default)
  • Arduino Digital Pin used for the Dallas OneWire (default is pin 7)

The Code - (Updated Nov, 2013)

Source code repository for example application: https://github.com/exosite-garage/arduino_exosite_library/tree/master/examples/TemperatureMonitor


What it looks like


I added three widgets to my example dashboard here.  One is the Line Graph, one is the Bar Chart, the other is the Overlay widget with a image that says 'Temperature:' and I've overlaid the data source value on top of it.






 


Have more questions? Submit a request

Comments