Close

Tracking Reagents and Getting Notifications

A project log for Reagent Tracker

Track reagent usage and get timely notifications to re-order.

stephen-harrisonStephen Harrison 06/12/2017 at 02:240 Comments

This is the last piece of the puzzle to get our Reagent Tracker to a useful position.

I've used Tinamous.com as the IoT backend for this project for a few reasons, but mainly (as you can probably guess from my profile name) because I'm the founder of the site!

You can easily create your own Tinamous.com account (yes, it's free) and then invite other members of your organization to join it (for example purchasing).

For my own use case (tracking the Form 1+ resin usage in my local hacker space) Tinamous has all the functionality I need, however for a wider audience a dedicated application with predictive analytics, reports and less generic fields would be more useful.

Tinamous integrates easily with the Particle Cloud via a Particle Bot, Tinamous connects to the API stream and processes the messages received in real-time. Messages published from the Photon with a "status" key will appear on the status timeline and those published with "senml" are taken as measurements. We publish the measured bottle weight as a field measurement where the field name is the NFC tag Id so it will be unique, although initially a little unfriendly!

Add Particle Bot:

To get started we need to add a Particle Bot to our Tinamous account, this is as easy as selecting the Add -> Add ParticleBot option from the Bots page and following the instructions:

Once connected the Particle Bot will import your Particle Photons, Electrons etc. into your Tinamous account. If you already have a Particle Bot up and running then adding a new Reagent Tracker Photon will cause it to be automatically added to your Tinamous account.

Reagent Tracker Setup:

We don't need to set-up the fields within Tinamous, once the bottle tag is seen and published, Tinamous automatically adds it as a field to the device and tracks the values, however to receive notifications and make tracking a little more human friendly there are a few steps we need to take.

I changed the tags for the reagent tracker devices to a single "ReagentTracker" tag, this allows us to automatically include additional trackers into the notification group or dashboard charts.

I also changed the measurement fields that represent bottles (the field name is our tag id) to be tagged "Bottle", again this allows us to create a notification that will automatically include new bottles and help charting.

I've changed the labels to be more appropriate to the bottle (some of these are just test tags so aren't actually reagent bottles).

Tinamous allows us to assign working and acceptable ranges for each field, when a measurement is received that is out of one of these ranges we can trigger a notification, so for our bottles we can set-up the ranges to be the appropriate weights for empty resin bottles.

For example, below I've set up "Bottle1" to have a working range of 20-200g and an acceptable range of 10-200g. We don't really care about the upper range, but the lower range allows us to trigger notifications when it's time to order new reagent.

Notification Setup:

The following screen shots walk us through the notification set-up.

From the Notifications page, click Add Notification:

Select the "A Device posts an out of range measurement" notification type, this is triggered by the working and acceptable ranges we set-up earlier. Each bottle can have it's own unique range based on the type of bottle (glass, plastic, small, large etc.), so we are not constrained to a specific value.

We are really only interested in the fields that represent a bottle, whilst we could also put ranges on for temperature, humidity, etc. for reagent storage, this notification needs to be triggered only for bottles. Previously we tagged our Bottle identity fields with "Bottle" so we want the notification only to trigger by fields tagged "Bottle" and we are only interested in "Below Working Range" notifications (i.e. in our Bottle1 example when the bottle weight drops below 20g).

We also want to limit this to our Reagent Tracker devices, whilst it may be unlikely to have other fields tagged "Bottle" this allows us to prevent possibly confusing notifications from other sources so we filter based on the device tag of "ReagentTracker". By using the tag rather than specifying devices this will allow new trackers to be added without needing to change notifications.

Tinamous allows you to define how the notification gets re-triggered, if were were tracking temperature it might publish a lot of measurements that were below the working range, this would result in lots of notifications, so we can add some filtering. However in this case we want a notification every time to ensure we don't accidentally miss one or forget.

Next we get to select how we are notified. I've selected to receive an email, other forms of notification can be used as desired.

The final step is to give the notification a sensible name and create it.

Next time the bottle is placed on the scale and is under weight an email will be sent to myself.

Monitoring Reagents:

In addition to notifications I can also navigate to the device page and view the chart of all the bottles that are used on that device.

Discussions