Mechatronic Solutions LLC

Home Projects Blog About

 

Developing an IoT Strategy

This blog will take you step-by-step through how to create an IoT technical strategy for your particular application.  

 

Overview

Before you start collecting data, you should have a good understanding of the factors that influence your product or process performance, robustness, and efficiency.   It would be ridiculous to go fishing with every type of bait and lure, fishing in every location, at all times of the day, in all tidal conditions.   Eventually you will catch the target fish, but you will have wasted a lot of time and money.   If you don't know these factors for sure, then conduct a design of experiments to determine what they are.  

Once you know what factors affect your product / product performance, the next step is to determine the order of magnitude of the frequency content of whatever factor you intend to measure with a sensor.   The frequency content of what is being measured will drive the choice of sensor used for measurement, and the sample rate required.   If your sensor's response time is too long relative to the frequency content of what you are measuring, or if the sample rate is too low, then the data collected will be confusing, misleading, and useless.  

The final step is to determine the required structure for the data measured and recorded.   Although the industry norm is to push raw data from the microcontroller to a cloud service, a much more efficient tactic is to first analyze the data locally at the microcontroller, and then transmit the results out to the cloud.   Using the microcontroller as an Edge Device can reduce the IoT device to cloud communications by an order of magnitude or more, and enable low power MCU operation of the IoT device.  

Each of these steps outlined are now presented below in detail.  

 

Product / Process Factors

Before any data collection effort begins, you need to have a good understanding of the factors that influence your product or process performance, robustness, and efficiency.   Typically you can hold a short brainstorming session with your team to determine these factors, but it may require a design of experiments to rank them by the amount of influence they have.  

Each factor that you come up with will be something that needs to be measured, typically by a sensor, with a value that is continuous and numeric.   Associated with that factor is the maximum frequency associated with measuring that factor with a sensor, an appropriately selected sample rate, and a sensor maximum response time.   You should start building a table that lists these as you determine them.  

IoT Factors & Measurement Parameters

Factor

Sensor

Max Frequency
& Sample Period
Min Sensor
Response Time
[s]
Sample Rate
(10x max frequency)
[Hz]
Case Temperature Thermocouple      

 

Measurement Frequency Content

The frequency content of what is being measured will drive the choice of sensor used for measurement, and the sample rate required.   You don't need an exact value, but you should have a rough order of magnitude idea of what the highest frequency is (0.5 Hz, 1 Hz, 10 Hz, etc.).   If you don't get this correct, and you select a sample rate that is too low, you will completely miss measuring minimum and maximum extreme values, compromising all subsequent data analysis.   The sensor response time must also also be checked to insure it is sufficiently shorter than the period for the maximum frequency of the factor being measured.  

The best way to measure the frequency content is to use data acquisition equipment along with a good sensor and measure the factor under a wide scope of conditions while sampling at at least 10 kHz.   Then perform a fast fourier transform (FFT) on the data collected, and then plot the frequency versus peak amplitude results.   The fundamental frequencies should be apparent.  

IoT Factors & Measurement Parameters

Factor

Sensor

Max Frequency
& Sample Period
Min Sensor
Response Time
[s]
Sample Rate
(10x max frequency)
[Hz]
Case Temperature Thermocouple 1.4 Hz | 0.7143 s    

 

Sensor Response Time

The maximum of the frequency content of the factor being measured can be converted to a sample period by taking the inverse of it.   The response time of the sensor must be less than the sample period derived from the frequency content of the factor being measured.   In the table below, the maximum frequency of 1.4 Hz has a sample period of 0.7143 seconds.   The sensor response time of 0.43 seconds is less than the data maximum frequency content sample period of 0.7143 seconds, so the sensor is a good choice for this application.  

IoT Factors & Measurement Parameters

Factor

Sensor

Max Frequency
& Sample Period
Min Sensor
Response Time
[s]
Sample Rate
(10x max frequency)
[Hz]
Case Temperature Thermocouple 1.4 Hz | 0.7143 s 0.43  

 

Sample Rate

The minimum sample rate should be 10 times the maximum of the frequency content for the factor to be measured.   The 10x multiplier addresses anti-aliasing and other issues with digitizing analog data.   In our example 10 * 1.4 = 14.0 Hz.  

IoT Factors & Measurement Parameters

Factor

Sensor

Max Frequency
& Sample Period
Min Sensor
Response Time
[s]
Sample Rate
(10x max frequency)
[Hz]
Case Temperature Thermocouple 1.4 Hz | 0.7143 s 0.43 14.0 Hz

 

Data Structure

At this point you know the sample rate required to capture the highest frequency event your sensor will see, and you know the proper response time required for your sensor.   The next step is to read the sensor with the IoT device and structure the measured value in a way that it can be used to make data driven decisions about your product or process.  

One approach is to measure the raw data at the sample rate, and then push it to the cloud for analysis later.   Although this is the primary option offered by most IoT platforms, it is not the most efficient, it is definitly the most expensive, and it is unlikely to be able to support the needs of all the factors to be measured.   Nearly all mechanical systems have events with a frequency content that is 100 Hz or less (ignoring vibration, and shock/impact), and that 100 Hz frequency requires a 1000 Hz (1 kHz) sample rate.  

No wireless cellular technology can support the transmission of data continuously at a rate of 1000 Hz.   The best you can expect from 4G is 50 Hz, and 250 Hz from 5G, based on the limiting factor of latency.  

The solution to this problem is to use the IoT device as an Edge Device, and perform statistical analysis directly on the data as it is measured, and then transmitting only the results of that analysis to the cloud for storage and visualization.   The advantage of this approach over attempting to stream raw data from the IoT device to the cloud is signficant.   Using the IoT microcontroller as an Edge Device reduces the frequency of data transmission by an order of magnitude or more, and permits the collection of data from a much broader scope of sensors than possible under the raw data transmission method.   The only disadvantage is that you need to configure the IoT device to perform the appropriate statistical analysis indivdually on each factor.   This solution is a disruptive technology to the IoT platform industry.  

Below are some of the statistical calculations the IoT device can perform on the factors as they are measured.   Remember that only the results of these calculations are transmitted from the IoT device to the cloud for storage and visualization.  

  • Level Crossing Event - reporting only when one factor crosses a particular numerical threshold.  
  • Multiple Factor Level Crossing Event - reporting when the values of several factors cross particular thresholds, and the values of a set of factors at the time of than event.  
  • Mean & Standard Deviation - calculating and reporting the mean and standard deviation for the data at particular long duration intervals when the data for the factor is known to be normally distributed.   It is also the best metric to evaluate changes in vibration data measured with an accelerometer.  
  • Stationary Test - calculate the mean, variance, and covariance at regular long intervals and transmit them.   Visualing these values in a x-y scatter plot will make it apparent if the mean and variance are constant, and if the covariance is independent of time.  
  • Trend Analysis decompose the data using a moving / rolling average to identify over time if the trend is an uptrend, downtrend, or stationary.  
  • Regression - track how changes in one factor affect the value of another.   Over time, it can tell you if the relationship between the factors is weak, strong, or varies over time.  
  • Time-At-Level Histogram or single classification - is an ideal structure for data when you want to know how much time a factor spends between a range of values.   The bins or sets of ranges of values can be configured to align with critical levels such as the freezing point of water, or when the factor exceeds a level that is considered outside normal operation.   In general, you are typically only interested in the latest set of compiled values, but in some cases it may be useful to see the changes in the distribution of the data across the bins over time.  
  • Machine Learning (ML) - the raw data measured can be put into a ML model to calculate a single numerical score as the output, and used to detect complex motion, recognize sounds, classify images, or find anomalies in sensor data.  

Performing statistical calculations on all of your factors by using the IoT device as an Edge Device is more efficient, saves considerable money in the transmission and storage of the data, signficantly broadens the scope of data that can be collected and analyzed.   The reduction in frequency of data transmission also reduces power consumption, making it easier to utilize an IoT device for low power operation.  

Do you need help with your project?   Send me an email requesting a free phone / web share consultation.  


Copyright © 2018-2024 Mechatronic Solutions LLC, All Rights Reserved