7 Choosing the Right Sensor
More
Depth: Practitioner
Progress saves as you read. Mark sections complete as you go; your progress appears in the sidebar.
7.2 Field Conditions Drive Selection
This section: Field Conditions Drive Selection — Inspect Figure 7.1 to replace a product-photo decision with the actual deployment boundary and its field constraints.
Inspect Figure 7.1 to replace a product-photo decision with the actual deployment boundary and its field constraints.
Field cross-section with a soil probe in dry and wet saline zones, corrosion exposure, node battery service route, 80 metre gateway path, and durability, power, and range requirements.
Read Figure 7.1 from the wet, saline zone to the battery service route. Salt water creates a corrosion test. The service path sets limits for battery life and access. The 80 m cable or radio path adds a measured link-margin test. These three facts define the field boundary. A probe can be correct on a bench and still be the wrong choice. It fails if it corrodes, drains a battery that staff cannot reach, or cannot send readings from its final place.
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.
Rugged soil-moisture probe installed at root depth with sealed cabling
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.
- 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.
- 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.
- Environmental Rating (IP Code): Ingress Protection rating defining dust and water resistance; select the rating for the exposure (IP65 can suit outdoor rain, while IP67 covers temporary immersion); IP69K is needed for high-pressure washdown environments.
- 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.
- 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.
- 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.
- 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.
- 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.
Try it: courtyard placement
Short practice. You can continue reading without answering.
Temperature Terry: You want the courtyard air temperature, rather than the temperature of a sun-heated wall. Where would you put the probe?
Try a changed case: sunlit paving
Short practice. You can continue reading without answering.
The probe is shaded, but now sits just above paving that gets hot in the sun. The goal is still representative courtyard air temperature. What should change?
Learning Objectives
This section: 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
This section: Prerequisites
- Sensor Specifications: Understanding key specs
- Common IoT Sensors: Available options
7.4 Introduction
This section: Introduction — With thousands of sensor models available, choosing the right one for a specific IoT project can feel overwhelming.
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
This section: Stepwise Sensor Selection — Sensor selection is a structured engineering process, not guesswork.
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 | No (1.2mA typical active) | No (1mA typical) | Yes | No (1.5mA active) |
| Cost <$10 | Yes ($2) | Yes ($5) | Yes ($3) | Yes ($8) | No ($15) |
| PASS | No | No | No | No | No |
Result: No listed sensor meets every stated requirement. Reconsider the I2C, accuracy, power or budget limit, then verify a new shortlist against data sheets.
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
This section: Sensor Selection Decision Tree — Figure 7.2 summarizes the three-step process as a visual flowchart.
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.
A sensor selection tree branches from measurement type through accuracy, range and interface checks to a sensor recommendation.
Sensor selection decision tree from measurement type to recommended sensor
7.7 Quick Sensor Selector by Application
This section: 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
This section: Outdoor Temp Choice — Note: This calculation covers only the sensor’s power draw.
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 over −20 to +50°C | DS18B20: ±1°C at −20°C; fails ±0.5°C | DHT22: ±0.5°C typical; fails full-range limit | BME280: ±1°C; fails | None qualified |
| Current (active) | 1mA | 1.2mA typical | 0.3mA | BME280 best |
| Current (sleep) | 1uA | 5µA typical | 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: qualification needed - The DS18B20 offers a waterproof-probe option and low sleep current, but its ±0.5°C accuracy specification starts at −10°C. The stated −20°C to +50°C, ±0.5°C requirement needs a part or calibration qualified at −20°C before selection.
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
This section: Automated Sensor Comparison — The key idea is weighted scoring: a sensor earns points for the requirements it satisfies, and high-priority requirements count more.
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": ["waterproof", "sleep", "cost"],
"DHT22": ["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.
Neither DS18B20 nor DHT22 meets the −20°C accuracy gate. For DS18B20, waterproofing, sleep current and cost earn 10 + 7 + 5 = 22 of 34 points (65%); DHT22 earns only cost and humidity pending the system power check, 5 + 3 = 8 of 34 points (24%). Its 5µA typical idle current must not be called a proven battery-life failure or pass. A weighted score does not override a failed accuracy requirement.
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.
7.10 Budget Optimization Strategies
This section: Budget Optimization Strategies
- Buy in bulk — Compare quotes at the quantity you need; larger orders can reduce per-unit price.
- Use modules - Breakout boards include passives, save soldering.
- Skip unnecessary features - DHT11 vs DHT22 if +/-2C is acceptable.
- Check additional suppliers — Compare delivered prices, lead times, warranty, and traceability for the same specified sensor.
- Open-source designs - Community-validated circuits save development time.
This section:
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.
This section:
This section:
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: “A sealed probe made with my chip may resist water, depending on its assembly; the bare chip is not waterproof. I cost $3, I am specified to ±0.5 degree from −10 to +85 degrees, but that accuracy is not specified at −20 degrees, and I sleep at only 1 microamp!”
Dee the DHT22 tried too: “I measure humidity, but my worst-case error at −20 degrees is too large for this requirement. I am also 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. “No one meets every requirement yet. Let’s test a calibration or find another sensor.”
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!”
This section:
7.11 Nest Protect Sensor Selection
This section: Nest Protect Sensor Selection — Sensor selection decisions that work at prototype scale can fail catastrophically at production volumes.
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.
Illustrative prototype phase: Suppose a team tries an MQ-2 gas sensor alongside an optical smoke chamber. Test its power, cross-sensitivity, warm-up, and service life before choosing a production sensor.
Why MQ-2 failed at production scale:
| Factor | MQ-2 (Prototype) | Production Requirement | Gap |
|---|---|---|---|
| Power consumption (illustrative) | ~800 mW continuous (assumed heater: 5 V × 160 mA) | <5 mW average design target | ~160× over target |
| 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 comparison: Nest Protect 2nd Gen lists a split-spectrum smoke sensor and an electrochemical CO sensor with a life of up to 10 years from manufacture. For an illustrative design, compare a selected electrochemical CO sensor’s datasheet and purchase quote against the prototype power and safety needs.
The counterintuitive lesson in this model: The selected low-power sensor costs 2× more per unit than the prototype sensor, but assumed battery and warranty savings of $12 and $8 per unit could outweigh the sensor premium. The modeled total cost of ownership can be lower despite a higher sensor unit cost; calculate the percentage only after stating the full cost baseline.
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
This section: 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
This section: Sensor Fit Matrix Tradeoffs — The guide above shows the step-by-step selection workflow, scoring tools, and production checks.
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
This section: Summary
Key sensor selection takeaways:
- Define requirements first - Then find sensors, not the other way around.
- Create a shortlist - Compare 3-5 candidates systematically.
- Verify with datasheets - Don’t trust marketing specs alone.
- Consider total cost - Includes development time, libraries, support.
- Prototype before production - Test in real conditions.
7.15 Try It Yourself
This section: 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 typical; full-range ±0.5°C limit fails | ±2% RH typical; full-range ±3% RH limit fails | 1.2mA typical / 5µA typical | $5 yes | No | Fails accuracy limits |
| BME280 | ±1°C no | ±3% yes | 0.3mA / 0.1µA | $8 yes | No | 3/5 |
| SHT31 | maximum temperature error ≤0.5°C across −20 to +50°C: yes (±0.2°C typical at 0-90°C) | ±2% RH typical; maximum >±3% at 100% RH: no | 1.5mA max / 0.4µA worksheet assumption | $15 yes | PTFE filter option | Fails full-range humidity limit |
Selection: None of these three candidates has a documented pass for both accuracy limits across the full stated temperature and humidity ranges. The SHT31 has attractive typical accuracy and low sleep current, but verify maximum errors over the range or qualify a different part before choosing. An outdoor enclosure must be selected separately.
Battery life check (SHT31, sensor only):
For this illustrative sensor-only calculation, assume 1.5mA during a one-second wake and 0.4µA while idle; the SHT31 data sheet lists 0.2µA typical and 2.0µA maximum single-shot idle current, so use the value appropriate to the intended temperature and power budget.
- Active energy per cycle:
1.5mA x 1s = 0.417µAh. - Sleep energy per cycle:
0.4µA x 599s = 0.067µAh(using the worksheet assumption above). - 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
This section: See Also
- Sensor Specifications - How to interpret accuracy, range, and power specs.
- Reading Datasheets - Extract requirements from sensor datasheets.
- Common IoT Sensors - Comparison of DHT22, DS18B20, BME280 options.
- Common Mistakes - Avoid voltage mismatch and interface errors.
Common Pitfalls
This section: 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
This section: What’s Next
Now that you can select sensors using a structured methodology, explore these related topics:
Find help
3 reviewed answers.
Where should I start in a module?
Open the module page from the sidebar to see its chapters in order. Use the module map to return to a topic you need.
Modules and pathsReviewed
What can I try when a project does not work?
Check the symptom, then work through the diagnostic steps. Keep the error message and the smallest example that reproduces it.
When you are stuckReviewed
How do interactive examples work?
Use the interactive guide to check how examples and simulations work before changing your project.
Interactive examples guideReviewed
