Scaling an IoT deployment? Join our webinar on May 28th where we dive into real-world scaling pain points and how to overcome them.

Blues Developers
What’s New
Resources
Blog
Technical articles for developers
Newsletter
The monthly Blues developer newsletter
Terminal
Connect to a Notecard in your browser
Developer Certification
Get certified on wireless connectivity with Blues
Webinars
Listing of Blues technical webinars
Blues.comNotehub.io
Shop
Docs
Button IconHelp
Notehub StatusVisit our Forum
Button IconSign In
Sign In
Sign In
What’s New
Resources
Blog
Technical articles for developers
Newsletter
The monthly Blues developer newsletter
Terminal
Connect to a Notecard in your browser
Developer Certification
Get certified on wireless connectivity with Blues
Webinars
Listing of Blues technical webinars
Blues.comNotehub.io
Shop
Docs
homechevron_rightExample Appschevron_rightAcceleratorschevron_rightCold Chain Monitor

Cold Chain Monitor

  • Arduino Firmware
  • Environment Variables
  • ESP32
  • GPS/GNSS Tracking
  • JSONata Event Processing
  • Motion Tracking
  • SMS Notifications
  • Soldering Required
  • Templated Notefiles
  • Wi-Fi Triangulation
  • Wiring Required

Cold Chain Monitor

The shelf life of vaccines (and other temperature sensitive medicine), can be prolonged by monitoring temperature and location. It takes a chain of precisely coordinated events in temperature-controlled environments to store, manage and transport these life-saving products. This is called a cold chain.

Cold Chain Graphic

Using a Notecard, ESP32 and LM75A sensor, an alert condition can be sensed (e.g. the temperature exceeds a predefined threshold). This device will send a Twilio SMS alert providing the exact location of the cold chain asset, so it can be rescued before it is ruined.

The starting point for all medicines is, "Controlled Room Temperature (CRT)"

U.S. Pharmacopeia (USP) USP <659> "Packaging and Storage Requirements"

Controlled room temperature: The temperature maintained thermostatically that encompasses at the usual and customary working environment of 20°-25° (68°-77° F). Excursions between 15° and 30° (59° and 86° F) that are experienced in pharmacies, hospitals, and warehouses, and during shipping are allowed. Provided the mean kinetic temperature does not exceed 25°, transient spikes up to 40° are permitted as long as they do not exceed 24h. Spikes above 40° may be permitted only if the manufacturer so instructs.

NOTE: By default, our device will monitor for CRT, but those thresholds can be dynamically modified using cloud-based environment variables.

Prerequisites

  • USB type A-to-micro USB cable
  • 2000 mAh Li-Ion battery with JST cable
  • Notecarrier-B
  • Molex Antenna 213353 (included with Notecarrier-B purchase)
  • LTE Cat-1 Notecard (North America, EMEA)
  • Adafruit Huzzah32 - ESP32 Feather Board (loose headers)
  • HiLetgo 2pcs LM75 LM75A Temperature Sensor Module
  • Molex Antenna 209142
  • Qwiic Cable Breakout
  • [OPTIONAL] Cirocomm 5cm Ceramic Active GPS Antenna 32db (High Gain)
  • [OPTIONAL] ESP-Prog

Software

  • Visual Studio Code
  • PlatformIO

Notehub Setup

Sign up for a free account on notehub.io and create a new project.

Twilio Route

When an alert condition is detected a Note is immediately sent to Notehub. In order for you to be informed this event occurred, you must configure a Twilio route.

Follow the Twilio SMS Guide on https://blues.dev to learn the steps required to link your Twilio account to Notehub.

Once you are familiar with the Twilio route, create a new route and set the following fields to forward alert information from the vaccine temperature monitoring solution to your SMS capable endpoint.

Configuration

FieldValue
AccountSIDcopy from Twilio's "Account Info" panel
AuthTokencopy from Twilio's "Account Info" panel
From Numbercopy from Twilio's "Account Info" panel
To Numberyour SMS capable phone number
Message[.msg]
Rate limitLimited Request Rate
Requests per second1
Timeout(s)15

Don't Forget: Check the box for "Enable automatic reroute on failure."

Data

FieldValue
Transform DataJSONata Expression

Then enter the following JSONata expression in the box:

{
    "msg":$exists(body.alert)
        ? "THERMAL ALARM: " & ((body.temp*9/5)+32) & "F%0A%0A" & best_location_type & " location:%0Ahttps://maps.google.com/maps?q=" & best_lat & "," & best_lon
        : $exists(body.low_batt)
        ? "Warning: Low battery (" & $formatNumber(body.voltage, "#0.00") & "V).%0A%0APlease charge device."
        : $doNotRoute()
}

Hardware Setup

  1. Prepare an enclosure for the device. A two-part, open-source enclosure design is provided at the following links:

    • Thingiverse: Mount
    • Thingiverse: Travel Case
  2. Prepare the Notecarrier-B by removing the header pins. If you are unfamiliar with this procedure, check out this excellent video from Adafruit .

  3. Solder the Qwiic breakout cable to the LM75A as shown in the table below:

    LM75AQwiic Cable
    VCCRED
    GNDBLACK
    SDABLUE
    SCLYELLOW
  4. Wire the ESP32, LM75A and Notecarrier-B in the following arrangement:

    |   LM75A   |
                             |           |
                             | V G S S   |
                             | C N D C O |
                             |_C_D_A_L_S_|
    __________________,        | | | | |        ,__________________
          ESP32       |        | | | | |        |   NOTECARRIER-B
                      |        | | | | |        |
                      |        | | | | '--------|AUX1
                      |        | | | |          |
                      |        '-^-^-^----------|<VIO
                      |          | | |          |
                  VBAT|----------^-^-^----------|VBAT
                      |          | | |          |
                   GND|----------'-^-^----------|GND
                      |            | |          |
                   SDA|------------'-^----------|SDA
                      |              |          |
                   SCL|--------------'----------|SCL
                      |                         |
                    EN|-------------------------|ATTN
                      |                         |

    NOTE: "'" indicates a connection and "^" indicates a bypass.

    NOTE: You may wish to implement the circuit on a breadboard, to ensure correctness, before soldering.

  5. Plug the Qwiic connector into the Notecarrier-B to make the connections described above (leaving only the connection from OS to AUX1 remaining).

  6. Mount the Notecard into the M.2 (key E) connector on the Notecarrier-B.

  7. Connect the antennas to the Notecard as shown in the table below:

    Notecard U.FLAntenna
    MAINMolex Antenna 213353 (middle)
    DIVMolex Antenna 209142
    GPSMolex Antenna 213353 (end)
  8. Plug the LiPo battery's JST cable into the Notecarrier-B port labeled LIPO.

Notecard Firmware Setup

The Notecard should use firmware version 4.4.1 or higher. The simplest way to update firmware is to do an over-the-air (OTA) update.

Host Firmware Setup

  1. Open Visual Studio Code.

  2. Click the PlatformIO icon on the left hand side and open this project's firmware/arduino folder with Quick Access > PIO Home > Open > Open Project.

  3. Open the file src/main.cpp.

  4. Uncomment the following line:

    #define PRODUCT_UID "com.your-company:your-product-name"
  5. Replace com.your-company:your-product-name with your ProductUID generated during Notehub Setup.

  6. Click the PlatformIO icon on the left hand side again and click "Build" under Project Tasks > featheresp32 > General.

    You should see "SUCCESS" in the terminal output pane. The firmware image is now ready to be flashed to the host.

  7. Click "Upload" under Project Tasks > featheresp32 > General.

    You should see "SUCCESS" in the terminal output pane.

Environment Variables

  • alarm_temperature - The temperature at which the alarm should trigger.
  • alarm_hysteresis - The temperature at which the alarm should reset.
  • sample_interval_s - The temperature and battery sampling interval in seconds.

NOTE: If you modify any environment variables, you must wait until the next synchronization event (max wait: inbound frequency) for the changes to propagate to the host.

NOTE: A table describing the "inbound frequency" can be found in the temperature sampling section below.

Operation

At this point, the host firmware should be running and you should start to see events show up on Notehub under your project's "Events" view.

The primary Notefile associated with the application is status.qo.

Normal Operation

Temperature Sampling

By default, the host will sample time stamped temperature data from the LM75A to status.qo every 30 minutes. You can change this interval by setting the environment variable sample_interval_s. Regardless of the sampling interval, the host will publish the collected data to Notehub based on the amount of charge remaining on the Li-Ion battery (depicted in table below).

Charge LevelOutbound Freq (min)Inbound Freq (min)
ON POWER55
HIGH60120
NORMAL120240
LOW240480
DEAD00

NOTE: Reducing sample_interval_s will cause the application to sample the temperature and battery condition more frequently and will shorten the expected battery life of the device.

Normal data:

{
    "temp":18.5,
    "voltage":3.5898438
}

NOTE: Temperature is rendered in Celsius.

Location Sampling

The device is configured to use motion based GPS tracking. As long as motion has been detected, the device will report its location once every 15 minutes. Regardless of whether or not the device moves, it will also report a heartbeat location every 12 hours.

Alarm Conditions

Thermal Event

By default, the firmware will IMMEDIATELY send an alarm if the temperature exceeds alarm_temperature. An alarm condition will cause the LM75A will trip the OS pin, which alerts the Notecard and causes it to wake the host from sleep.

Temperature alert data:

{
    "alert":true,
    "temp":30.5,
    "voltage":3.5898438
}

The alert field is added to the JSON object, when the temperature has exceeded the alarm_temperature environment variable value. When the alert key is received by Notehub, then an SMS message containing the temperature data and GPS coordinates of the device is forwared to Twilio. There a text message is generated and sent to the phone number specified in the alarm_sms_number environment variable.

Thermal Event Operation

During a thermal event, time is of the essense and the mode of operation changes accordingly. Instead of sampling every 30 minutes, the temperature and location will be sampled every every 3 minutes. While in this mode, the device will force a GPS fix or timeout after 95 seconds.

Low Battery

The battery voltage is sampled each time the device wakes. During the configuration step of the firmware, the Notecard is provided the battery chemistry of the device. This allows the Notecard to be aware of voltages in relation to overall charge. When the battery is sampled using the card.voltage API, it will return charge of the battery as mode. When "mode":"low" is encountered, then the low_batt key is added to the JSON object.

Battery alert data:

{
    "low_batt":true,
    "temp":30.5,
    "voltage":3.5898438
}

When the low_batt key is received by Notehub, then an SMS message containing the voltage is forwared to Twilio. Again, a text message is generated and sent to the phone number specified in the alarm_sms_number environment variable.

NOTE: The low battery alert IS NOT considered to be a high-priority alert and will be sent at the regular syncing interval.

Related Topics

  • Wikipedia: Cold Chain
  • Intelsius: What is Cold Chain
  • GMP Compliance: Regulatory Definitions
  • NPR: What Is A Cold Chain? And Why Do So Many Vaccines Need It?
  • Hackster.io: EpiCAT

On This Page

  • Cold Chain Monitor
    • Prerequisites
      • Software
    • Notehub Setup
      • Twilio Route
    • Hardware Setup
    • Notecard Firmware Setup
    • Host Firmware Setup
    • Environment Variables
    • Operation
      • Normal Operation
      • Alarm Conditions
    • Related Topics

Resources

  • GitHub
  • Request More Info
© 2025 Blues Inc.
© 2025 Blues Inc.
TermsPrivacy
Notecard Disconnected
Having trouble connecting?

Try changing your USB cable as some cables do not support transferring data. If that does not solve your problem, contact us at support@blues.com and we will get you set up with another tool to communicate with the Notecard.

Advanced Usage

The help command gives more info.

Connect a Notecard
Use USB to connect and start issuing requests from the browser.
Try Notecard Simulator
Experiment with Notecard's latest firmware on a Simulator assigned to your free Notehub account.

Don't have an account? Sign up