Address

Unit 1 - 6115 4 St SE Calgary AB T2H 2H9 Canada

Remote Temperature Monitoring

Source Code

Introduction

This project will show you how to create a remote temperature monitoring system using Phidgets. These systems are often used to ensure the temperature at a remote location (vacation home, server room, etc.) are not at dangerous levels. This system allows you to set a minimum temperature that you are comfortable with, and if the temperature drops below that limit, a notification will be sent. The program could easily be modified to send notifications if the temperature gets too high, or just to send notifications every day, hour, or minute!

Warning email with limit of 25°C

Hardware

Software

Libraries and Drivers

This project assumes that you are somewhat familiar with the basic operation of Phidgets (i.e. attaching and opening devices,
reading data, etc). If this is your first time building a Phidgets project with
C#, please refer to the C# page for instructions on how to setup your environment and get started.

Software Overview

A simple C# program was written for this project. At the top of the form the current temperature is displayed and it is updated every 30 seconds. Below
the temperature, there are a few settings:

Temperature Limit: If the temperature is consistently below this value for more than 5 minutes, the user will be notified. An email will then be sent every hour
until the temperature rises.

Send Notification To: Specify an email address that should be notified when the temperature drops below the threshold. Note:
many wireless providers offer an email to text option, so notification can be sent directly to a phone.

Program running with 10°C limit

Under the Email Settings tab, there are a few more options:

Server Address: email server address. If you aren't using Gmail, a quick Google search will result in articles like
this that will help you out.

Username: The email you would like to send notifications from. For this program I created a new Gmail account and allowed less secure apps to use it.

Password: Password for account.

Email Settings

After entering information into all the required fields, the status in the bottom right corner of the form will indicate that the program is running. After that, you can simply minimize the program and forget about it!

The program can be accessed from the system tray. Hovering over it with your mouse will show the state.

Code Overview

Code for this project is available in the TemperatureMonitor.zip file above. Before compiling the program, make sure you have the Phidget libraries installed on your computer.
Here is a quick overview of the code:

When the form loads, create a TemperatureSensor object and subscribe to attach, detach, and error events.

In the attach handler, set the DataInterval to 30 seconds.

In the event handler, update the temperature label and check if the temperature is below the limit. If the temperature is below the limit, increment a counter and exit. If the counter indicates that the temperature has been below the limit for 5 minutes, send a notification.

If a notification has been sent, start a 1 hour timer that will prevent any more notifications from being sent until the time has elapsed.

Phidget Code

When the form loads, a new temperature sensor is created and events are subscribed to.

In the event handler, the temperature label is updated and the decision to send a notification is made. If a notification is sent
a timer is started which will force the program to wait 1 hour before trying to send another.

Conclusion

Need help? Call us

+1 403 282-7335

Monday - Friday 8:00am - 4:00pm MDT

Connect with us

Phidgets Inc.

We believe in getting problems solved quickly and projects finished on time. That's why we specialize in making affordable, easy to use sensors and controllers that require minimal electronics knowledge.

Phidgets Inc.

We believe in getting problems solved quickly and projects finished on time. That's why we specialize in making affordable, easy to use sensors and controllers that require minimal electronics knowledge.