Planning a Logging System
The questions to answer first: what to measure, how fast, how accurately, for how long, and what happens when data is lost.
Start with the question
A logging system built without a question collects either too little (the one signal you needed was not recorded) or too much (a terabyte nobody can use). Write the question in one sentence, then work backwards: “Does the cold room stay below 5 °C, and how long was it above during the power cut?” needs temperature at the product, a time stamp you can trust, a record long enough to cover the event, and an alarm. It does not need vibration at 10 kHz.
| Question | Why it matters |
|---|---|
| What decision will the data support? | Defines the signals, the accuracy and the report. “Log everything” produces data that nobody can use |
| What is the quantity, in which units, and over what range? | Sets the sensor and the converter (see Sensors, Signal Conditioning and ADCs) |
| How fast does it change? | Sets the sampling rate (see Sampling, Aliasing and Filtering) |
| How accurate must it be? | Sets the sensor class, the calibration and the uncertainty budget |
| How long will it run, and unattended? | Sets storage, power and the reliability engineering |
| What happens if data is lost or wrong? | Decides buffering, redundancy and alarms for the logger itself |
| Who uses it, and in what tool? | Decides the format, the units, the metadata and whether a dashboard is needed |
Choosing the channels
- Measure what you need to decide, plus what explains it. A temperature excursion in the cold room is explained by the door switch, the compressor current and the outside temperature, so log those too.
- Measure close to the thing that matters: product temperature, not air temperature; the motor winding, not the case.
- Include context channels: status, set-points, mode, door, operator, batch number: the “why” that the sensor alone cannot give.
- Count the cost of a channel: a sensor, a wire, an input, storage forever. More channels also mean more things to calibrate and to go wrong.
- Redundancy where it matters: two independent probes for a critical measurement catch a failed sensor, which a single one cannot.
- Name every channel unambiguously now (
coldroom1_air_c,coldroom1_product_c): renaming later breaks every report.
How fast, and for how long
The sample interval should be short compared with how fast the quantity changes. For a process with a time constant τ (the time to cover 63 % of a step change), sampling every τ ÷ 5 or faster captures its shape; slower than τ misses events. Faster than needed only costs storage (see Storage, Formats and Data Rates), but remember that fast noise must be filtered or it folds into the data (see Sampling, Aliasing and Filtering).
| Quantity | Time constant (typical) | Sample interval of τ ÷ 5 |
|---|---|---|
| Room air temperature | 600 s | about every 120 s |
| Water in a 200 L tank | 1 800 s | about every 360 s |
| A thermocouple in a furnace | 5 s | about every 1 s |
| Motor winding temperature | 120 s | about every 24 s |
| Motor current ripple (a 1 kHz drive) | 0.5 ms | about every 0.10 ms |
Worked example: the cold room
- The product probe has a time constant of about 300 s in the product, so τ ÷ 5 = 60 s; a round 60 s interval is chosen.
- Volume. 6 temperature channels as 4-byte floats plus an 8-byte time stamp, once a minute: (6 × 4 + 8) × 1 440 = 46 kB a day, 16.8 MB a year: trivial. Even as text (about 60 bytes a row) it is only about 31.5 MB a year.
- For how long? A food-safety record may have to be kept for years; a trial for days. Decide the retention now (raw data, summaries) so that storage and backups are sized for it.
- Compare: one vibration channel at 10 kHz and 16 bits is 1.73 GB a day: a different design problem (see Logging Strategies: Triggers, Deadbands and Aggregation).
- Sample more often around events: a start-up, a fault or a defrost cycle changes faster than steady operation; use triggers or a faster burst (see Logging Strategies: Triggers, Deadbands and Aggregation).
- Average inside the interval: read the sensor many times quickly and store the mean (and the min and max), so that noise falls and spikes are kept.
- Record length is a requirement, not an accident: a battery logger that fills in a week is useless for a month-long study.
How accurate: the 4:1 rule
A common rule is that the measuring system should be about four times more accurate than the tolerance you want to check, so that its error does not use up the margin. To verify a cold room to ±0.5 °C you want a combined measurement uncertainty of about ±0.13 °C, which is a calibrated probe and a good converter, not a bargain sensor (see Sensors, Signal Conditioning and ADCs for the budget). Resolution is not accuracy: a logger that displays two decimals of a ±1 °C sensor is precise but not accurate.
- Decide what “correct” means (absolute accuracy against a standard, or only repeatability and trend), because it changes the cost greatly.
- Plan calibration: an initial calibration against a traceable reference, a schedule (yearly is common) and a record of each result.
- Use a stability check: a second, independent sensor, or a reference point (an ice bath at 0 °C) tested from time to time.
What if data is lost?
Worked example: a completeness target
Suppose the record must be at least 99.5 % complete over each day. That allows (1 − 1.00) × 86 400 = 432 s of missing data a day. If the logger restarts 12 times a day for 20 s (a flaky power connection or a watchdog reset), it loses 240 s: within the allowance. State the target in numbers so that a failure is a measurable fact, not an argument.
| Risk | Defense |
|---|---|
| Power loss | A battery or capacitor so the logger can finish writing; a supervisor chip; a restart that resumes cleanly |
| Storage full or damaged | Capacity for the full period plus margin; a monitor for free space; write in short files; flush regularly (see Storage, Formats and Data Rates) |
| Network down | Store locally and forward when the link returns (see Telemetry, Databases and Dashboards) |
| Sensor failure | Range and stuck-value checks; a second sensor; an alarm |
| The logger stops silently | A heartbeat: an external check that raises an alarm if no data arrives for a set time |
| Wrong time | Time synchronization and a record of the last sync (see Time Stamps and Clocks) |
Metadata: the data about the data
A number is meaningless without its context. Record, with the data, everything someone needs to use it in ten years:
{
"logger_id": "CR-LOG-03", "firmware": "1.4.2", "site": "Cold room 1",
"started_utc": "2026-10-31T08:00:00Z", "sample_interval_s": 60, "clock_source": "NTP (pool.ntp.org)",
"channels": [
{"name": "air_c", "sensor": "PT1000 class A", "serial": "A1234", "location": "door side, 1.8 m",
"unit": "degC", "range": [-40, 60], "calibrated": "2026-09-12", "cal_offset": -0.12, "uncertainty": 0.30},
{"name": "product_c", "sensor": "PT1000 class A", "serial": "A1235", "location": "centre of pallet 3",
"unit": "degC", "range": [-40, 60], "calibrated": "2026-09-12", "cal_offset": 0.05, "uncertainty": 0.30}
]
}
- Units, ranges and scaling (counts to units), so that the raw values can be recomputed if a calibration changes.
- Sensor identity, location and calibration (date, offset, who and with what reference).
- Logger identity, firmware version and settings (sample interval, filtering, trigger levels).
- Events and changes: a sensor replaced, a set-point changed, the logger moved. Keep a log beside the data.
- Where the metadata lives: in the file header, in a sidecar file with the same name, or in a database table: never only in someone’s head.
Cost, effort and a pilot
Worked example: a five-year cost
A logger ($450), 6 probes at $35, installation and commissioning ($120) and a cloud service at $6 a month for 5 years cost $450 + $210 + $120 + $360 = $1 140, before calibration, batteries and your time. The recurring costs (calibration, licenses, connectivity, replacement sensors) often exceed the purchase price: price the whole life.
- Run a pilot with one or two channels for a week before the full installation: it shows noise, gaps, clock drift, sensor placement problems and the real data volume.
- Look at the pilot data with the question in mind: can you answer it? If not, change the plan, not just the code.
- Write a one-page specification (channels, rates, accuracy, duration, retention, alarms, who) and have the user agree it.
Four typical systems
| System | Typical channels and rate | Key design issues |
|---|---|---|
| Building and HVAC monitoring | Temperature, humidity, CO2, power; 1 per minute | Many cheap sensors, wireless or Modbus, long retention, dashboards and alarms |
| Machine condition monitoring | Vibration at kilohertz, motor current, temperature; bursts and trends | Aliasing, event capture, edge processing, big data volumes (see Logging Strategies: Triggers, Deadbands and Aggregation) |
| Laboratory or prototype test | Voltages, loads, temperatures at 10 to 1 000 Hz for hours | Accuracy and synchronization, calibration, a clean record for the report |
| Remote environmental station | Weather, soil, water; every few minutes for months | Battery and solar power, cellular data cost, local buffering, weather-proof enclosure (see Logger Hardware: Dedicated, Embedded and Industrial) |
Commissioning and acceptance
| Check | How |
|---|---|
| Each channel reads correctly | Compare with a reference at two or more points (an ice bath, a calibrator, a known load) |
| Sample rate and timing | Count the samples over an hour; check the time stamps against a trusted clock |
| Resolution and noise | Record a steady signal for ten minutes: the spread is the noise floor |
| Loss and recovery | Cut the power and the network on purpose: does the logger resume, and is the data intact? |
| Alarms | Force a limit crossing and confirm that the right person is told |
| Storage and retention | Check free space against the plan; test a restore from backup |
| Documentation | Wiring, metadata, calibration certificates, contacts: filed with the system |
Related
- Data Logging: the overview of this guide.
- Sampling, Aliasing and Filtering and Storage, Formats and Data Rates: the two numbers that follow from the plan.
- Data Quality, Analysis and Reporting: checking that the plan worked.
- Sensors and Field Devices: choosing and wiring the sensor.
- Data, Files and Parsing: file formats and time stamps in code.
FAQ
How many channels should I log?
Enough to answer the question and explain it, and no more: each channel costs a sensor, wiring, calibration and storage. Add context channels (status, set-points) that explain the data rather than just more measurements.
What is the right sampling rate?
About one fifth of the signal’s time constant or faster, with an anti-alias filter, and faster still around events. See Sampling, Aliasing and Filtering.
Do I need to calibrate a logger?
If the accuracy matters, yes: an initial calibration against a traceable reference and periodic checks, recorded with the data. For trends only, repeatability may be enough.
How long should I keep the raw data?
As long as it might be needed: the legal or contract requirement, or the time to find a problem. A common pattern is raw for weeks, one-minute summaries for months, hourly for years.
References
- JCGM 100:2008, Guide to the expression of uncertainty in measurement (the 4:1 and uncertainty ideas).
- ISO 9001 and ISO/IEC 17025 (calibration and records); sector rules such as HACCP and 21 CFR Part 11 for regulated records.
- Logger and sensor manufacturers’ application notes (HOBO, Campbell Scientific, National Instruments, Omega).
Last reviewed: October 2026. Prices and rates are illustrative: replace them with your own.
