Public Lab Research note

Frozen Riffle?

by cfastie | May 19, 2016 03:53 19 May 03:53 | #13128 | #13128

I put the Riffle in the freezer this morning to see if the temperature sensor on the RTC would notice. The quickly chilling board left a conspicuous cooling curve in the data on the micro SD card. While the Riffle was in the freezer, it started to record data differently. The change was quick and happened 40 seconds after the recorded temperature dropped below freezing (0°C). Instead of recording data every nine seconds, the timestamps incremented every second for six or seven seconds, and then skip ahead about 55 seconds (Table 1).

Coincidentally, the time this shift in data interval happened was exactly 10:00:00 o'clock (Table 1). So another hypothesis is that the sketch started incrementing differently when the time value had six digits for the first time, or for some other Y2K like reason.

Table 1. The data file from this morning (see note) at the point when the data interval changed. The first series of new intervals begins right after the temperature dropped below freezing and when the time became 10:00:00.

I still don't know whether time or temperature was responsible for the change in interval. This morning's logging ended with the interval still weird, so to make sure that the freezing had not broken my Riffle, I logged some more data this evening.

Figure 1. Temperature data logged by the Riffle this evening. The intervals are consistent (about 9 seconds) but the temperature changes no more frequently than about once every minute.

The intervals between data writes are all correct now, so whatever happened in the freezer was not permanent. Although the intervals are behaving, the temperature values are always the same for seven consecutive data writes. So the recorded temperature does not change more often than once per minute regardless of how fast the temperature is rising or falling (Fig. 1).

Figure 2. Battery level (in unknown units) recorded by the Riffle this evening. Unlike the temperature data, battery level does not stay constant for seven consecutive readings.

The data logged for battery level do not exhibit the stepped pattern of the temperature data (Fig. 2). As in this morning's trial, the recorded battery level is erratic when the Riffle is moved. This might be due to the battery connector being jostled. Maybe my battery connector is bad, so it will be good to learn whether others can replicate this pattern. If not, then it might be my particular connector.

Battery level increased as the Riffle cooled down and also increased as the Riffle warmed up (compare Figs. 1 and 2). I have no idea what this means.

My next step is to figure out how to connect an external sensor and write a sketch to log its data. Below are the sensors I have. I included links to more information about each sensor in this thread at the water quality Google Group. This next step looks like it will entail a lot of study.


MCP9808 High Accuracy I2C Temperature Sensor Breakout Board (Adafruit PRODUCT ID: 1782)

Temperature and humidity

Adsong AM2301
Adsong AM2302 similar to this:

Barometric pressure

BOSCH BMP180 I2C Digital Barometric Pressure Sensor Module Barometer Board similar to this:

Light Intensity

BH1750 Digital Light Sensor

Vibration tilt

Tilt Angle Module Vibration Sensor Module for Arduino STM32 AVR


Hi Chris!

This is fantastic research. So many interesting questions coming up already via your testing. Thank you. Riffleman!

These rechargeable lithium batteries might not do so great at low temps. That might be why the measurement interval is skipping around. Hypothesis: when the battery voltage fluctuates too low, the 328p (the brain of the Riffle) might not have sufficient voltage to stay on, even in sleep mode. It powers off; but then when the voltage fluctuates back up, it powers back on. When the temperature is falling, at first the voltage would hover very close to 'good enough' -- so it would be rebooting frequently. At one liminal voltage, it might reboot, make a measurement, and record it to the sd card (which requires a bunch of power), die in the process, and reboot -- that might be the initial 1-second cycling you see. Further drops in temperature drop the voltage down further, so that it can't reboot for longer periods ... I dunno? It'd be cool (sic) to try the same experiment with a different battery chemistry. Don't know if this can explain all the oddness you're seeing, though.

The analog pin will just be 'floating' unless it is connecting to some input voltage -- was just thrown into the code so that if someone hooked up e.g. voltage divider output from a photocell or thermistor, or another voltage source between 0 and 3.3V, they'd have an easy place to begin ... should be commented better though :)

Regarding the RTC temperature 'step' features, it's possible that the step-like behavior is an issue with the library being used, and that we can do much better by just tweaking a line or two of code. Edward Mallon has a great post on his research around the RTC chip (the DS3231). See "Addendum 2014-12-06", here:

There might be some simple code to try in his post.

I'm travelling, but when I get back next week I'll try to dig in.

It'd be particularly neat to try to hook up one of the external widgets you've got that measures temperature, to compare against the RTC ....

Is there some way of using the virbration tilt sensor as part of a rain gauge / flow sensor? Been thinking that could be fun.


Is this a question? Click here to post it to the Questions page.

Reply to this comment...

How did you make the figures you used in this research note? They are really well done.

Is this a question? Click here to post it to the Questions page.

Reply to this comment...

Thanks Patrick,

The table and graphs are screen captures from Excel. The graphing module in Excel is very powerful in part because it has a huge number of data presentation and formatting options. Unfortunately, it can be burdensome to figure out which options provide the type of graph you want. Maybe that's true of any graphing module.


Reply to this comment...

Login to comment.