7 Choosing the Right Sensor
7.2 Field Conditions Drive Selection
Inspect Figure 7.1 to replace a product-photo decision with the actual deployment boundary and its field constraints.
Read Figure 7.1 from WET / SALINE ZONE, which creates the corrosion exposure requirement, to the battery service route, which sets maintainability and power constraints. The 80 m cable / radio path turns range and gateway margin into evidence rather than a datasheet-only claim.
The installation photograph ties those abstract constraints to the hardware at root depth: the probe body, tines, sealed cable gland, and burial-rated cable are all visible, so environmental fit can be reviewed against the real mounting boundary.
The mathematical gist. The chapter’s CR2477 exercise uses 0.070 mAh/day, or 2.92 µA, and a 1,000 mAh cell, giving 14,286 days before other losses. A catalog-typical 1% yearly self-discharge adds 1.14 µA. The total becomes 4.06 µA, so the same division gives 10,267 days, or 28.1 years. That result is arithmetic, not a promise: shelf aging and the microcontroller make the real life shorter.
Start with Selection Criteria Matrix: A structured comparison table evaluating sensor candidates across multiple dimensions (accuracy, cost, power, interface, range, availability) simultaneously, enabling systematic trade-off analysis. Then Total Cost of Ownership (TCO): Complete cost over the deployment lifetime: purchase price + installation + calibration + replacement frequency; a $5 sensor requiring monthly calibration often costs more over 5 years than a $50 factory-calibrated alternative. Next Environmental Rating (IP Code): Ingress Protection rating defining dust and water resistance; IP67 (dust-tight, 1 m immersion) is the minimum for outdoor IoT; IP69K is needed for high-pressure washdown environments. After that Mean Time Between Failures (MTBF): Average time a sensor operates before failing; critical for infrastructure deployments where sensor replacement requires maintenance visits; choose MTBF appropriate for the maintenance interval. Continue by Form Factor and Integration: Physical size, mounting method (board-mount, panel-mount, pipe-thread), and connector type; a technically superior sensor that cannot be mechanically integrated is not a viable choice regardless of its specifications. Continue by Long-Term Availability / Lifecycle: Manufacturer’s guarantee of continued production; sensors in products with 10-year lifespans must remain available as spare parts for that duration; check lifecycle notices before designing a long-production-run product. Continue by Regulatory Compliance: Certifications required for the target market: CE (Europe), FCC (USA), RoHS (hazardous materials), ATEX/IECEx (explosive atmospheres), FDA (medical); non-compliant sensors block product certification. Finally Calibration Burden and Interval: The reference equipment, labour, downtime, and recalibration frequency needed to keep a sensor within its required tolerance over the deployment life; include this burden in total cost and lifetime error, not only the purchase price.
Learning Objectives
After completing this chapter, you will be able to:
- Apply a systematic three-step process for sensor selection
- Evaluate selection criteria to narrow down candidate sensors
- Prioritize tradeoffs across cost, accuracy, power, and complexity dimensions
- Justify purchasing decisions using weighted scoring matrices
- Account for calibration burden and recalibration interval when comparing lifetime fit and total cost
Picking a sensor can feel overwhelming with so many options available. This guide gives you a simple step-by-step process: first decide what you need to measure, then how accurate it needs to be, then what your budget and power constraints are. It is like shopping for shoes — once you know your size, activity, and budget, the thousands of options quickly narrow down to just a handful of good choices.
7.3 Prerequisites
- Sensor Specifications: Understanding key specs
- Common IoT Sensors: Available options
7.4 Introduction
With thousands of sensor models available, choosing the right one for a specific IoT project can feel overwhelming. A temperature sensor alone might have dozens of viable candidates across different technologies, price points, and form factors. Without a structured approach, teams often default to familiar sensors or the first result from an online search — only to discover months later that the sensor fails in deployment due to power, accuracy, environmental, or cost constraints they never evaluated.
This chapter presents a repeatable three-step methodology for sensor selection: define requirements, create a shortlist with a scored comparison matrix, and verify against datasheets. You will work through a complete outdoor deployment example, use interactive tools to explore how weighting priorities changes the “best” sensor, and study how Google’s Nest team navigated the transition from prototype sensor to production sensor at scale.
7.5 Stepwise Sensor Selection
Sensor selection is a structured engineering process, not guesswork. The following three steps transform vague project needs into a defensible sensor choice backed by data.
7.5.1 Step 1: Define Requirements
Before looking at sensors, answer these questions:
| Question | Your Answer | Impact on Selection |
|---|---|---|
| What physical quantity? | (temp, pressure, motion…) | Determines sensor category |
| Required accuracy? | (+/-X units) | Filters cheap vs expensive options |
| Required range? | (min to max value) | Must cover all expected conditions |
| Response time needed? | (ms, seconds, minutes) | Fast control vs slow logging |
| Power budget? | (mA, battery life) | Active vs passive, duty cycling |
| Interface preference? | (analog, I2C, SPI, UART) | Hardware/software compatibility |
| Environmental conditions? | (temp, humidity, vibration) | IP rating, industrial-grade |
| Budget per unit? | ($) | Narrows options significantly |
7.5.2 Step 2: Create a Shortlist
Based on requirements, identify 3-5 candidate sensors:
Example: Temperature Sensor Selection
| Requirement | DHT11 | DHT22 | DS18B20 | BME280 | SHT31 |
|---|---|---|---|---|---|
| Accuracy +/-0.5C | No (+/-2C) | Yes | Yes (-10 to +85C range) | Marginal (+/-1C) | Yes (+/-0.3C) |
| Range -20 to 60C | Yes | Yes | Yes | Yes | Yes |
| Humidity reading | Yes | Yes | No | Yes | Yes |
| I2C interface | No | No | No (1-Wire) | Yes | Yes |
| Power <1mA | Yes | Yes | Yes | Yes | Yes |
| Cost <$10 | Yes ($2) | Yes ($5) | Yes ($3) | Yes ($8) | No ($15) |
| PASS | No | Yes | Partial | Yes | No |
Result: DHT22 or BME280 meet requirements. Choose BME280 if pressure is useful, DHT22 if simpler is better.
7.5.3 Step 3: Verify with Datasheets
For each shortlisted sensor:
Start by download official datasheet. Then verify specs match your requirements. Next check interface details (voltage, pull-ups, timing). After that review application notes. Finally check library availability.
7.6 Sensor Selection Decision Tree
Figure 7.2 summarizes the three-step process as a visual flowchart. Start at the top with “What do you need to measure?” and follow the branches through accuracy, power, interface, and environment constraints to reach a recommended sensor.
Sensor selection decision tree from measurement type to recommended sensor
7.7 Quick Sensor Selector by Application
| Application | Primary Sensor | Alternative | Key Spec |
|---|---|---|---|
| Smart thermostat | DHT22 | BME280 | +/-0.5C accuracy |
| Weather station | BME280 | SHT31 + BMP280 | Pressure for altitude |
| Motion lighting | PIR HC-SR501 | Radar RCWL-0516 | 7m range |
| Parking detection | HC-SR04 (2-400cm) | VL53L0X (up to 200cm) | Ultrasonic or ToF ranging |
| Step counting | ADXL345 | MPU6050 | 3-axis, selectable up to +/-16g |
| Smoke detection | MQ-2 | MQ-135 | Gas sensitivity |
| Water leak | Conductivity probe | Float switch | Digital output |
| Door/window | Reed switch | Hall sensor | Magnet detection |
7.8 Outdoor Temp Choice
Requirements:
- Measure temperature -20C to +50C
- Accuracy +/-0.5C
- Battery-powered (2 years target)
- Read every 5 minutes
- Outdoor enclosure (IP65)
- Budget: $10 per sensor
Analysis:
| Criterion | DS18B20 | DHT22 | BME280 | Decision |
|---|---|---|---|---|
| Range | -55 to +125C | -40 to +80C | -40 to +85C | All pass |
| Accuracy | +/-0.5C (-10 to +85C; +/-2C outside) | +/-0.5C | +/-1C | DS18B20, DHT22 |
| Current (active) | 1mA | 1.5mA | 0.3mA | BME280 best |
| Current (sleep) | 1uA | 50uA (high for multi-year battery) | 0.1uA | DS18B20, BME280 |
| Interface | 1-Wire | Digital | I2C | All OK |
| Waterproof option | Yes (probe) | No | No | DS18B20 |
| Cost | $3 | $5 | $8 | All within budget |
Battery Life Calculation (DS18B20 sensor only):
- 288 readings/day x 0.75s x 1mA = 0.06mAh active
- 23.94 hours x 0.001mA = 0.024mAh sleep
- Total sensor consumption: 0.084mAh/day
- 2000mAh battery: 23,800 days (65 years theoretical, sensor only)
Note: This calculation covers only the sensor’s power draw. In practice, the microcontroller (ESP32, ATmega328P, etc.) dominates total power consumption. For example, an ESP32 in deep sleep draws approximately 10-150uA depending on configuration (RTC peripherals enabled, ULP coprocessor, etc.), adding 0.24-3.6mAh/day. Always calculate system-level power, not just sensor power, when estimating battery life.
Selection: DS18B20 - Best for outdoor due to waterproof probe option, excellent power efficiency, and meets accuracy requirement.
7.8.1 Interactive Battery Life Calculator
Use this calculator to estimate sensor battery life for your own projects. Adjust the parameters to match your sensor’s datasheet values and your sampling requirements.
7.9 Automated Sensor Comparison
The key idea is weighted scoring: a sensor earns points for the requirements it satisfies, and high-priority requirements count more. Use the interactive weight explorer below first; the Python pattern is optional implementation detail.
Start by Assign a weight to each requirement. Then List which requirements each sensor satisfies. Next Score each sensor as earned weight divided by total possible weight. Finally Rank sensors by score.
weights = {
"accuracy": 9,
"waterproof": 10,
"sleep": 7,
"cost": 5,
"humidity": 3,
}
candidates = {
"DS18B20": ["accuracy", "waterproof", "sleep", "cost"],
"DHT22": ["accuracy", "cost", "humidity"],
"BME280": ["sleep", "cost", "humidity"],
}
def score(passed):
earned = sum(weights[item] for item in passed)
possible = sum(weights.values())
return round(100 * earned / possible)
for sensor, passed in candidates.items():
missing = set(weights) - set(passed)
print(sensor, score(passed), "missing:", sorted(missing))
Weighted scoring quantifies trade-offs. For DS18B20, the project weights are accuracy 9, waterproofing 10, sleep current 7, cost 5, and humidity 3.
Start by DS18B20 passes accuracy, waterproofing, sleep current, and cost: 9 + 10 + 7 + 5 = 31. Then Total possible weight is 9 + 10 + 7 + 5 + 3 = 34. Next Score: 31 / 34 x 100 = 91%. After that DHT22 passes accuracy, cost, and humidity: 17 / 34 x 100 = 50%. Finally The 41-point gap reflects two high-priority misses: waterproofing and low sleep current.
Weights encode your priorities, so changing a weight changes the ranking.
7.9.1 Interactive Weight Explorer
Adjust the requirement weights below to see how they change the sensor ranking. This demonstrates how your priorities directly determine the “best” sensor — there is no objectively best sensor, only the best sensor for your requirements.
<iot-embed src=”../foundations/audit-sensor-types-selection-guide.html” title=“How the Weights Decide the “Best” Sensor” prompt=“Ada re-derives this chapter’s own numbers step by step — full working shown, rounding only at the end” kicker=“Calculation audit”>
7.10 Budget Optimization Strategies
Start with Buy in bulk - 10+ units often 30-50% cheaper. Then Use modules - Breakout boards include passives, save soldering. Next Skip unnecessary features - DHT11 vs DHT22 if +/-2C is acceptable. After that Check Chinese sources - AliExpress sensors 3-5x cheaper (longer shipping). Finally Open-source designs - Community-validated circuits save development time.
The cheapest sensor on a BOM is rarely the cheapest in total cost of ownership. Factor in development time (library maturity, community support, documentation quality), reliability costs (warranty returns, field failures), and power infrastructure (battery size, solar panel). A sensor that costs $3 more per unit but saves 20 hours of debugging across a project is the better investment.
the microcontroller needed to pick a temperature sensor for a garden weather station. But there were SO many choices! How do you pick?
“Step one: Write down what you NEED,” Max said. He made a list:
- Measure -20 to +50 degrees (gardens get cold in winter!)
- Accurate to +/- 0.5 degrees
- Waterproof (it rains!)
- Run on batteries for at least a year
- Cost less than $10
Temperature Terry (DS18B20) raised his hand: “I am waterproof, I cost $3, I have +/-0.5 degree accuracy, and I sleep at only 1 microamp!”
Dee the DHT22 tried too: “I also have +/-0.5 degree accuracy AND I measure humidity! But… I am not waterproof.”
The BME280 jumped in: “I measure temperature, humidity, AND pressure! But my temperature accuracy is only +/-1 degree.”
Max made a comparison chart and checked off each requirement. “DS18B20 wins for this project because it is waterproof, accurate enough, cheap, and super low-power. For an indoor project, I might choose differently!”
the battery approved: “With DS18B20’s tiny sleep current, I can last for YEARS! Always check the power consumption before choosing!”
the LED added: “And ALWAYS test the sensor in real conditions before you build 100 of them. What works on your desk might not work in a rainy garden!”
7.11 Nest Protect Sensor Selection
Sensor selection decisions that work at prototype scale can fail catastrophically at production volumes. The Nest Protect smoke and CO detector illustrates how production constraints reshape sensor choices.
Prototype phase (2012): Nest engineers initially prototyped with an MQ-2 gas sensor (the same $2 sensor common in hobbyist projects) alongside an optical smoke chamber. The MQ-2 performed well in lab tests — detecting smoke, CO, and natural gas.
Why MQ-2 failed at production scale:
| Factor | MQ-2 (Prototype) | Production Requirement | Gap |
|---|---|---|---|
| Power consumption | ~800 mW continuous (heater element, 5V x 160mA) | <5 mW average (6-year battery life) | ~160x over budget |
| Warm-up time | 24-48 hours for stable readings | Instant-on for safety device | Unacceptable for battery-powered device |
| Cross-sensitivity | Responds to cooking vapors, hair spray, steam | Must distinguish real threats from nuisance alarms | False alarm rate too high |
| Calibration drift | Significant drift after 6 months | UL 2034 requires accuracy over 7-year lifespan | Would fail regulatory testing |
| Unit cost at volume | $2 (single unit) | $0.50 target at 1M units | Sensor itself was cheap; the power budget was not |
Production solution: Nest selected a Figaro TGS5141 electrochemical CO sensor ($4.50 at volume) paired with a split-spectrum optical smoke chamber. The electrochemical sensor draws 0 mA at idle (no heater), responds within approximately 60 seconds (T90), maintains calibration for 10+ years, and distinguishes CO from other gases with near-zero cross-sensitivity.
The counterintuitive lesson: The production sensor cost 2x more per unit than the prototype sensor, but saved an estimated $12 per unit in battery costs (no heater = smaller battery), $8 per unit in warranty claims (fewer false alarms = fewer returns), and enabled the 6-year battery life that became a key selling point. Total cost of ownership was 40% lower despite higher sensor unit cost.
Checklist for prototype-to-production sensor transitions:
- Calculate power budget over full product lifetime, not just active measurement
- Verify sensor accuracy spec at end-of-life, not just new-from-factory
- Test cross-sensitivity with realistic household interferents (cooking, cleaning products, humidity)
- Confirm regulatory certification path (UL, CE, FCC) for the specific sensor model
- Get volume pricing quotes — some sensors have steep quantity discounts, others do not
- Evaluate supply chain risk — single-source sensors create production bottlenecks; consider dual-sourcing critical sensors or securing supplier agreements and safety stock to mitigate shortages
- Request reliability data (MTTF) for the specific operating conditions of your product, not just the generic datasheet value
7.12 Concept Relationships
| Concept | Related To | Connection Type |
|---|---|---|
| Accuracy Requirement | Application Constraints | HVAC needs ±1°C; medical needs ±0.1°C |
| Power Budget | Battery Capacity | Sleep current determines multi-year battery life |
| Interface Type | GPIO Availability | I2C shares 2 pins; analog needs 1 pin per sensor |
| Waterproof Rating | Deployment Environment | Outdoor sensors need IP65+ protection |
| Maximum Spec | Production Variation | Design for worst-case, not typical performance |
7.13 Sensor Fit Matrix Tradeoffs
The guide above shows the step-by-step selection workflow, scoring tools, and production checks. Continue to Sensor Selection Fit Matrices and Trade-Off Boundaries when you need the deeper L2 material: four-axis fit gates, auditable shortlist evidence, range-resolution trade-offs, response-time/noise trade-offs, and system-level error, power, timing, and maintenance budgets.
7.14 Summary
Key sensor selection takeaways:
Start with Define requirements first - Then find sensors, not the other way around. Then Create a shortlist - Compare 3-5 candidates systematically. Next Verify with datasheets - Don’t trust marketing specs alone. After that Consider total cost - Includes development time, libraries, support. Finally Prototype before production - Test in real conditions.
7.15 Try It Yourself
Scenario: Design a battery-powered weather station for a remote hiking trail. Requirements:
- Measure temperature (-20°C to +50°C, ±0.5°C accuracy)
- Measure humidity (0-100% RH, ±3% accuracy)
- Battery life: minimum 1 year (CR2477 coin cell, 1000mAh)
- Read sensors every 10 minutes
- Budget: $15 or less per sensor
Your task: Create a comparison matrix and select the best sensor.
Solution template:
| Sensor | Temp Accuracy | Humidity | Power (active/sleep) | Cost | Waterproof | Score |
|---|---|---|---|---|---|---|
| DHT22 | ±0.5°C yes | ±2% yes | 1.5mA / 50µA | $5 yes | No | 4/5 |
| BME280 | ±1°C no | ±3% yes | 0.3mA / 0.1µA | $8 yes | No | 3/5 |
| SHT31 | ±0.2°C yes | ±2% yes | 1.5mA / 0.4µA | $15 yes | PTFE filter option | 5/5 |
Best choice: SHT31 - Best accuracy and humidity performance with excellent sleep current. The SHT31-DIS-F variant includes a PTFE membrane filter for splash protection, though a proper IP65 enclosure is still needed for outdoor deployment. At exactly $15 it meets the budget ceiling. If cost pressure increases, the DHT22 at $5 is a strong alternative that passes all requirements except waterproofing.
Battery life check (SHT31, sensor only):
- Active energy per cycle:
1.5mA x 1s = 0.417µAh. - Sleep energy per cycle:
0.4µA x 599s = 0.067µAh. - Total per cycle:
0.484µAh. - Per day:
144 cycles x 0.484µAh = 69.7µAh = 0.070mAh. - Sensor-only battery life:
1000mAh / 0.070mAh per day = about 14,300 days.
Note: Microcontroller sleep current will dominate real-world battery life.
7.16 See Also
Start with Sensor Specifications - How to interpret accuracy, range, and power specs. Then Reading Datasheets - Extract requirements from sensor datasheets. Next Common IoT Sensors - Comparison of DHT22, DS18B20, BME280 options. Finally Common Mistakes - Avoid voltage mismatch and interface errors.
Common Pitfalls
Choosing the most accurate, cheapest, or lowest-power sensor without considering other requirements leads to designs that fail in practice. A sensor can be the most accurate in its class but impractical if it needs weekly calibration, has a 20-week lead time, or uses an incompatible protocol. Always use a multi-criteria weighted matrix.
The sensor available for prototyping may have 20-week lead times for production quantities. Verify production supply chain availability before finalizing the BOM. Component shortages can delay product launches by months.
A sensor that performs well in the lab may fail in the field due to vibration, condensation, EMI from motors, or temperature cycling. Always conduct a deployment trial in the actual operating environment for 2-4 weeks before finalizing sensor selection.
The sensor may be rated IP67, but if the cable entry connector is only IP54, the assembly is IP54. Ingress protection is only as good as the weakest seal. Specify connectors and cable glands with IP ratings equal to or exceeding the sensor’s rating.
7.17 What’s Next
Now that you can select sensors using a structured methodology, explore these related topics:
