Temperature Alert System

By Kaveri Govindan

g_kaveri@yahoo.com

Fall 2010, Mobile Computing

Motivation and novelty of the project

We envision a world where everyday smart devices and objects are connected by fully integrating them to the Web, forming a 'Web of things'. Examples include Wireless Sensor Networks, Ambient devices, household appliances, etc.

This project is about the design and development of a Temperature alert system. Though there are products in the market that alert when sensed temperature goes above/below threshold values, I wanted to have more control over how the temperature data is used. As a computer programmer, I aimed to develop a web service that monitors temperature and other readings from a sensor via HTTP, and actuate custom processes based on the data readings. Our web service is expected to monitor temperature readings in an environment where temperature has to be maintained between fixed lower and upper thresholds. The web service can be configured by users to send out alerts if the temperature values go above or below the threshold levels. SunSPOT devices have been chosen to serve as sensors. Developing a web service that talks to sensors would require me to have sensor device specific programming skills. To simplify this for me, the SEAP approach (Sensor enablement for the average programmer) was explored.


Related work

HTTP (Hyper text transfer protocol) is the foundation of data communication on the world wide web. HTTP works as a request response protocol. A server application will reside on a host computer and listen for incoming requests. A client, such as a web browser can make a request, that the server application will process and issue a response back to the client.

This architecture can be extended to form the 'web of things' by including devices as end points.

A device can post its data to the web application via HTTP. The application can process and store the data; and also actuate other devices or processes based on the data. However, programming a device to send/receive data via HTTP requires significant knowledge of the device specific APIs and protocols. This can be a challenge for the average programmer. SEAP approach (Sensor enablement for the average programmer) attempts to simplify this programming effort

SEAP is an approach to reduce the complexity of the device integration to the web. It advocates the use of middleware components that reside on the device and help to transmit sensor and actuation data using the standard HTTP protocol. For programmers and other users, this makes interaction with the sensor device easier as they can rely on known web programming patterns.

SEAP software components run on the remote device. When the sensor device has data to send, the SEAP component packages the data and opens an HTTP connection to a configured URI. The SEAP component also manages native function invocation on the device in response to HTTP requests. This reduces the programming effort to simply integrating web application components to the SEAP components. The programmer can remain agnostic of the sensor device's native APIs


Illustration 1: SEAP approach



Design of system

Hardware:

SunSPOTs were chosen to serve as a temperature sensor and an actuator. They were chosen because they are designed from the ground up to make it easy for programmers to write applications. They have an embedded microprocessor that runs Java. A Java programmer can use standard Java development  tools couple with their suite of technologies to enable the internet of things.

The basic unit includes accelerometer, temperature and light sensors, radio transmitter, eight multicolored LEDs, 2 push-button control switches, 5 digital I/O pins, 6 analog inputs, 4 digital outputs, and a rechargeable battery. We will use the temperature sensor for this project.

Software

The system consists of three software components: 1) the Web Service, 2) ProjectSensor Midlet and the 3) ProjectActuator Midlet.

Web Service:

This is developed using Java Web Component technologies (Java Servlets and Java Server Pages) and is served by an Apache Tomcat container. MySQL database served as a data store.

The web service provides end-points for the sensors to post data and retrieve commands. For example: A sensor would talk to http://localhost:8080/post to post its data and an actutator would talk to http://localhost:8080/command to retrieve commands for itself.

A user can access the web application via a browser. The user interface displays the sensor data in a graphical form. It also allows the user to configure an email notification when the sensed temperature goes above or below user-defined threshold levels.  The web service monitors the temperature data it receives and sends out email alerts if necessary.

ProjectSensor midlet:

The midlet was developed using the SunSPOT sdk and Java MicroEdition. It is deployed on the sensor SunSPOT. It periodically retrieves sensor data (currently set to every 30 seconds), opens a HTTP Connection to our web service end point and POSTs data.

ProjectActuator midlet:

The midlet was developed using the SunSPOT sdk and Java MicroEdition. It is deployed on the actuator SunSPOT. It periodically makes a request to our web service to retrieve commands for itself. The Midlet then proceeds to perform device specific function calls based on those commands.


Illustration 2: Design



How to use the system

1) Install the required software

·         Apache Tomcat web server (http://tomcat.apache.org/)

·         Java 6 (http://www.oracle.com/technetwork/java/javase/downloads/index.html)

·         MySQL database (http://dev.mysql.com/downloads/)

·         SunSPOT sdk (http://www.sunspotworld.com/SPOTManager/index.html)

2) Deploy and Run the Web application. This is distributed as a war file. This war file may be deployed directly into the Apache Tomcat container.

3) Deploy and run ProjectSensor and ProjectActuator Midlets on the sensor and actuator SunSPOTs.

4) Navigate to the application using a browser. You can view a graph of recent data received, and set up temperature thresholds  and notifications.

5) When the temperature at the sensor SunSPOT goes above/below the configured thresholds, the email notification will be sent out. Also, the actuator SPOT will blink  its onboard LEDs.


Screen shots from the web application


 




Downloads

ProjectActuator code

ProjectSensor code