Part 1/2: Vaccine Temperature Monitoring with the Raspberry Pi


This two-part blog post is a guide on how to implement the specific hardware and software solution used as part of a quality improvement project for a primary care clinic to monitor fridge temperatures which contain vaccines.

Part 1 of 2: Introduction, Preamble, Hardware Requirements, Software Packages/Prerequisite Readings.

Time Required: 6-12 hours
Yields: A low-cost and accurate automatic temperature logging and notification device with a web-server interface.


An important aspect of vaccine safety is appropriate storage and handling. Some challenges that clinics and medical centres might face is appropriate temperature monitoring. In addition to guidelines with respect to optimal humidity light exposure, public health agencies in both the US (CDC) and Canada (PHAC) enforce an acceptable temperature storage range between 2 deg. C and 8 deg. C. There are also well defined, standardized protocols in place when storage temperatures fall out of this range (i.e., a cold chain incident).

In Canada, there is no standardization with respect to the fridges and temperature measuring devices used. In most clinics, temperatures are recorded manually into hand-written notebooks during office hours. PHAC recommends checking fridge temperatures at least twice a day. Most probes will continuously monitor temperatures as well as keep track of the range of values recorded (max, min). With these PHAC recommendations and monitoring guidelines in place, we run into the following issues:

  • is used by the default interface anyways
  • Vaccine temperature monitoring is not closely followed. Outside of office hours or during holidays; although some temperature measuring devices can measure minimum and maximum values, important information is missing on the duration of that temperature and whether it is relevant for assessing vaccine safety.
  • There is inherent human error in recording temperatures manually. Was that a 3 or 8? Was that a 7 or 9?Especially if your handwriting looks like garbage and your vision makes it barely legal to drive.
  • There is no way to notify admin staff remotely in real time. Some more expensive devices might have alarms, but it is a challenge to notify a user remotely that fridge temperatures have reached critical values.
  • During power outages, a temperature vs. time profile is not available. By automatically logging temperature even during a power outage where the temperature might fall temporarily outside critical values, the information on how long this critical event lasted can be useful in deciding if vaccine integrity is intact or broken; this can mean the difference between disposing of vaccines and keeping them and represents a significant potential for cost savings to the healthcare system

From the perspective of public health agencies, enforcing this is difficult from a human resources perspective; inspections are at conducted at least annually and require public health nurses to travel to each clinic to properly inspect what are mostly handwritten logs full of numbers.

There has been somewhat of a push to implement better solutions to monitor vaccine temperatures more closely. With the release of small single-board computers and controllers such as the Raspberry Pi or Arduino, and existing projects that have used these systems with GPIO-connected temperature probes, automated temperature monitoring solutions that are quite precise and accurate, can be homebrewed at quite low cost. Quite a few of these projects have been done from home monitoring thermostats to for brewing purposes, and indeed for vaccine temperature monitoring which feeds data directly into an EMR

(B) Preamble

I know exactly what you’re thinking; why implement another software solution if so many are already out there? Well, in order to not just autonomously measure temperature but to add to this solution by implementing features which directly address aforementioned issues outlined above – especially with respect to off-site notification of critical values and representing data in a way that is platform-independent and NOT integrated with EMR – this way,  data representation can be standardized and more clinics can adopt this. Using widely available, low cost hardware and open-source code with good documentation lowers the barrier to adopting this solution and is hopefully in effective avenue in slowly standardizing a solution for public health to use this.

As a result, I wanted to implement the following features with the temperature monitoring software:

  • remotely accessible web-server hosted directly on the Pi which displays information for a single or multiple sensors in graphical format; i.e. via Google Code

  • This two-part blog post is a guide on how to implement the specific hardware and software solution used as part of a quality improvement project for a primary care clinic to monitor fridge temperatures which contain vaccines.Part 1 of 2: Introduction, Preamble, Hardware Requautonomous polling temperature values from the temperature probe connected to the Pi
  • network functionality with automatic e-mail or text-message based notifications if a measured temperature is within a critical or near-critical value, allowing administrators to act on this before vaccine integrity is affected
  • network-independent temperature logging in case of network failure, so that values can be retrieved once network access is restored
  • auxillary power in case of power outage for continued operation and monitoring
  • easily defined protocols (e.g. rsync, ssh) that can be used to administer or have multiple Pi-based sensors to interact with each other in a similar setting
  • additional redundancies for: database backup

Fortunately, there are lots of open-source software packages, APIs and command-line tools that we can be strung together along with some simple PHP, Javascript and Python code to achieve the functionality above.

(C) Materials Required:

C-1: Hardware:
The hardware for this project consists of:

  • Raspberry Pi (any model). I am using the Raspberry Pi 2 but there wouldn’t be any issue with using the lower-cost model A+ or older model B/B+. Webserver performance might suffer with these models so you YMMV. There might be a follow-up post with this if I am able to get my hands on the RPi Zero.
  • Networking device: I am using a WiFi dongle as there are no closeby ethernet ports near the fridge, but any raspbian/linux-compatible networking device (from ethernet available on the larger raspberry Pis to dongles/adapters) will do just fine.
  • DS18B20 Temperature Probe: any variety of these are available. In order to ensure reliability, precision and accuracy, ensure that they come with a proper datasheet. The datasheet for the probe being used by this project is readily available.
  • GPIO jumper cables and 4.7K-ohm resistor: this is required as part of the wiring scheme from the temperature sensor to the GPIO ports.
  • 3-pole Screw-terminal, solder or breadboard: how you chose to wire the probe together is up to you. I am using a 3-pole screw terminal to allow easy replacement of the probe without re-soldering the resistor and jumper wires together, in case components fail or (inevitably) mistakes are made.

C-2 Software:
We need to install (via apt-get and gem) the following freely available software in order to implement the features we need (an iso image of the pre-configured raspbian with software preloaded is in the works on this project’s github page):

  • webserver software: Apache with PHP, Javascript and Python support
  • programming languages: Python, Javascript
  • database packages: SQLIite3 with php-sqlite3 and python sqlite3 support libraries
  • CLI emailing software: mailx
  • CLI twitter software (for free non-email based text messaging by using twitter’s text-message notifications): t (it’s just called “t” or CLI-Twitter); in linux, this can be installed through ruby (see the t project page for details)
  • Google charts API: this is a javascript file that can be used offline or directly from google’s website – used for graphical representation of chart data pulled off of the SQLite database
  • Bootstrap API if you wish to design your own webpage, but bootstrap is used by the default interface anyways

More details about the specific software packages, configuration and code will be posted in Part 2.