MySQL for the Internet of Things

(Steven Felgate) #1
Chapter 4 ■ Data transformation

filter. That is, the filters are inside an enclosure that houses the pump, and thus the filters clean the water
prior to it flowing into the pump well. Further, there is no sensor designed to measure the flow rate of a filter
in the enclosure. How would you make the observation that the filters need cleaning?
If you have owned and maintained a garden pond using a filter system like this, you would know that there
is a causal effect you can observe to determine whether the filters need cleaning. More specifically, as the filters
become full of debris, the water in the pump well lowers (lower flow, less water in the reservoir). Thus, you could
determine that when the water level in the pump well is reduced to a certain level, the filters need cleaning.
However, this observation is not ideal because it is also possible for the water level in the pump well
to become low if there is a leak in the pond or if there is significant evaporation. Thus, we must add these
events to the list of possible things we can learn from the observation. In this case, we have one primary and
two secondary things we can learn from the observation of water level in the pump well.


KNOW YOUr DOMaIN


this brings up a very good point. if you were asked to make an iot solution for a garden pond but did
not know or have any experience with the subject matter, you may not be able to understand how to
observe the state of the filters. thus, it is important to know or study the domain within which you are
working so that you can explore alternative methods of making observations.

■Tip You should consider alternative methods of making an observation including observing the causal


events rather than the actual or physical phenomena.


How Often Do You Need to Record the Observation?


You should also consider the frequency you want to record the observations, that is, how many times you
want to record the values from the sensor. Some sensors may have a timer circuit or a minimal threshold
for when a measurement can be taken. Simple sensors such as switches can be instantaneous, whereas
sensors such as gas, water salinity, or oxygenation may have a significant threshold, reducing the number of
observations you can make in a given time frame.
It is also possible that the frequency of the observation may have little or no bearing on the knowledge
you expect to gain. For example, if we want to measure temperature in a building or room, can we learn
anything if the temperature values were recorded once every three seconds? How about twice a minute?
What about once an hour or once every six hours?
The answer depends on what we want to learn. Yes, we’re back to that again. More specifically, do we
want to be able to track when the temperature changes down to a specific minute, hour, or time of day?
Moreover, do we want to perform any analysis on the rate of change?
For example, if we are measuring temperature in a building or room that does not have a controlled
climate (for example, a barn or covered bridge), are we interested to see how the temperature changes over
time? If we are, how accurate do we want the data to be? That is, do we want to be able to detect how quickly
the temperature changes? If we do, storing measurements taken more frequently may permit more accurate
detection of these changes as well as more accurate rates of change. On the other hand, if we just want to be
able to determine average temperatures at different periods during the day (for example, morning, noon,
night), measurements taken every few hours may be sufficient.
Thus, we must consider what we want to observe as well as whether changes over time are beneficial.
That is, measurements taken using short intervals can detect changes and trends more accurately than
measurements taken at larger intervals. Indeed, it is possible if the interval is large enough that a fluctuation
in the measurement would be missed.

Free download pdf