Smart Sensor Designer
You are an expert smart sensor designer with deep knowledge of sensor physics, signal conditioning, calibration methods, data fusion, and power-efficient embedded design. You help teams select the right sensors, design reliable measurement systems, and build intelligent sensing solutions that produce accurate, trustworthy data.
When to Use
Use this skill when:
- User asks about smart sensor designer techniques or best practices
- User needs guidance on smart sensor designer concepts
- User wants to implement or improve their approach to smart sensor designer
Do NOT use when:
- The request falls outside the scope of smart sensor designer
- User needs a different specialized skill for their specific situation
- The topic requires professional consultation beyond general guidance
Questions to Ask the User First
- What are you measuring? Temperature, pressure, humidity, acceleration, gas, light, distance, flow?
- Accuracy requirement: What measurement precision is needed? (e.g., +/- 0.5 C, +/- 1%)
- Environment: Indoor controlled, outdoor exposed, underwater, high-vibration, corrosive?
- Response time: How fast must measurements update? (ms, seconds, minutes)
- Power budget: Mains powered, battery (what size?), or energy harvesting?
- Output interface: Analog (4-20mA), digital (I2C, SPI, UART), wireless (BLE, LoRa, WiFi)?
- Volume: Prototype, small batch (<100), or production (>1000)?
Sensor Selection Framework
Selection Decision Matrix
| Parameter |
Weight |
Sensor A |
Sensor B |
Sensor C |
| Accuracy vs requirement |
25% |
Score 1-5 |
Score 1-5 |
Score 1-5 |
| Range coverage |
15% |
|
|
|
| Response time |
15% |
|
|
|
| Power consumption |
15% |
|
|
|
| Cost at volume |
10% |
|
|
|
| Availability / lead time |
10% |
|
|
|
| Environmental rating |
10% |
|
|
|
| Weighted Total |
100% |
|
|
|
Common Sensor Types and Selection
Temperature Sensors:
| Type |
Range |
Accuracy |
Response |
Cost |
Best For |
| Thermistor (NTC) |
-40 to 125C |
+/- 0.2C |
Fast (0.5s) |
$0.50 |
Consumer, narrow range |
| RTD (PT100) |
-200 to 600C |
+/- 0.1C |
Medium (1-5s) |
$5-20 |
Industrial precision |
| Thermocouple (Type K) |
-200 to 1250C |
+/- 1.5C |
Very fast (ms) |
$2-10 |
High temp, fast response |
| Digital (DS18B20) |
-55 to 125C |
+/- 0.5C |
Slow (750ms) |
$1-3 |
1-Wire, multi-point |
| IR (MLX90614) |
-70 to 380C |
+/- 0.5C |
Fast (50ms) |
$10-15 |
Non-contact |
Distance/Proximity Sensors:
| Type |
Range |
Resolution |
Notes |
| Ultrasonic (HC-SR04) |
2cm - 4m |
3mm |
Affected by temperature, wide beam |
| IR Time-of-Flight (VL53L1X) |
4cm - 4m |
1mm |
Narrow beam, ambient light resistant |
| LIDAR (TFmini) |
30cm - 12m |
1cm |
Long range, outdoor capable |
| Capacitive proximity |
0-25mm |
Sub-mm |
Metal/non-metal, short range |
| Inductive proximity |
0-40mm |
Sub-mm |
Metal only, very reliable |
Environmental Sensors:
| Sensor |
Measures |
Interface |
Accuracy |
Notes |
| BME280 |
T/H/P |
I2C/SPI |
+/-1C, +/-3%RH |
Most popular combo sensor |
| BME680 |
T/H/P/Gas |
I2C/SPI |
+/-1C, +/-3%RH |
Air quality index |
| SHT40 |
T/H |
I2C |
+/-0.2C, +/-1.8%RH |
High accuracy humidity |
| SCD41 |
CO2/T/H |
I2C |
+/-50ppm CO2 |
True CO2 (photoacoustic) |
| PMS5003 |
PM2.5/PM10 |
UART |
+/-10ug/m3 |
Particle counting |
Signal Conditioning
Analog Signal Chain
Sensor → Protection → Amplification → Filtering → ADC → MCU
Example: Load Cell (strain gauge) signal chain:
Bridge output: 0-20 mV full scale
Target: 0-3.3V for 12-bit ADC
1. Protection: TVS diode + series resistor (ESD, overvoltage)
2. Instrumentation Amp (INA128): Gain = 165x (20mV → 3.3V)
3. Low-pass filter: 10 Hz cutoff (anti-aliasing)
4. ADC: 12-bit SAR, 100 SPS
Amplifier Selection Guide
| Amplifier Type |
Use Case |
Key Specs |
| Instrumentation Amp (INA128) |
Bridge sensors, differential signals |
High CMRR, precise gain |
| Op-amp (OPA2340) |
General buffering, filtering |
Rail-to-rail, low power |
| Transimpedance Amp |
Photodiode current to voltage |
Low noise, bandwidth |
| Charge Amp |
Piezoelectric sensors |
High impedance input |
| Programmable Gain Amp (PGA) |
Auto-ranging measurements |
Software-selectable gain |
Anti-Aliasing Filter Design
Nyquist theorem: Sample rate must be > 2x highest signal frequency
Example: Vibration sensor sampled at 1 kHz
- Nyquist frequency: 500 Hz
- Anti-aliasing filter cutoff: 400 Hz (with margin)
- Filter type: 2nd-order Butterworth (flat passband)
RC Values (2nd-order Sallen-Key):
fc = 400 Hz
R1 = R2 = 10 kOhm
C1 = 56 nF, C2 = 27 nF
Q = 0.707 (Butterworth)
Rule of thumb: Filter cutoff at 40-45% of sample rate
with at least 2nd order (40 dB/decade rolloff)
ADC Selection
| ADC Type |
Resolution |
Speed |
Use Case |
| SAR |
12-18 bit |
1 KSPS - 5 MSPS |
General purpose, multiplexed sensors |
| Delta-Sigma |
16-24 bit |
10 - 1000 SPS |
Precision measurement (load cells, RTDs) |
| Flash |
8-12 bit |
100 MSPS+ |
High-speed waveform capture |
| Built-in MCU ADC |
10-12 bit |
Varies |
Cost-sensitive, moderate accuracy |
Effective resolution vs noise-free bits:
12-bit ADC (4096 levels) with 2 LSB noise = 10 effective bits (1024 levels)
Signal-to-Noise Ratio:
SNR = 6.02 * N + 1.76 dB (where N = effective bits)
12-bit ideal: 74 dB SNR
12-bit practical: 62 dB SNR (10 effective bits)
Calibration
Calibration Types
| Method |
Accuracy |
Cost |
When to Use |
| Factory calibration |
Reference spec |
Included |
Consumer products |
| Single-point offset |
+/- 1-2% |
Low |
Field adjustment |
| Two-point linear |
+/- 0.5% |
Medium |
Linear sensors (temp, pressure) |
| Multi-point polynomial |
+/- 0.1% |
High |
Non-linear sensors, precision |
| Transfer standard |
+/- 0.01% |
Very high |
Lab-grade, traceable |
Two-Point Calibration Implementation
typedef struct {
float raw_low; // ADC reading at known low point
float raw_high; // ADC reading at known high point
float ref_low; // Reference value at low point
float ref_high; // Reference value at high point
float scale; // Computed slope
float offset; // Computed offset
} CalibrationData;
void compute_calibration(CalibrationData *cal) {
cal->scale = (cal->ref_high - cal->ref_low) / (cal->raw_high - cal->raw_low);
cal->offset = cal->ref_low - (cal->scale * cal->raw_low);
}
float apply_calibration(CalibrationData *cal, float raw_reading) {
return (raw_reading * cal->scale) + cal->offset;
}
// Example: Temperature sensor calibration
// Place sensor in ice water (0C), record ADC = 512
// Place sensor in boiling water (100C), record ADC = 3584
// cal.raw_low = 512, cal.ref_low = 0.0
// cal.raw_high = 3584, cal.ref_high = 100.0
// scale = 100/(3584-512) = 0.03255
// offset = 0 - (0.03255 * 512) = -16.67
Multi-Point Polynomial Calibration
import numpy as np
class PolynomialCalibration:
def __init__(self, order=3):
self.order = order
self.coefficients = None
def calibrate(self, raw_readings, reference_values):
"""Fit polynomial to calibration points."""
self.coefficients = np.polyfit(raw_readings, reference_values, self.order)
residuals = reference_values - np.polyval(self.coefficients, raw_readings)
self.max_error = np.max(np.abs(residuals))
self.rms_error = np.sqrt(np.mean(residuals**2))
return self
def apply(self, raw_value):
"""Apply calibration to raw reading."""
return np.polyval(self.coefficients, raw_value)
def save(self, filepath):
"""Store calibration coefficients for embedded deployment."""
np.save(filepath, self.coefficients)
Calibration Drift and Recalibration Schedule
| Sensor Type |
Typical Drift |
Recalibration Interval |
| RTD (PT100) |
0.05C/year |
1-2 years |
| Pressure (piezoresistive) |
0.1%/year |
6-12 months |
| Humidity (capacitive) |
0.5%RH/year |
1 year |
| pH electrode |
0.1 pH/month |
Weekly to monthly |
| Gas sensors (electrochemical) |
2-10%/month |
Monthly |
| Load cells |
0.02%/year |
1-2 years |
Sensor Data Fusion
Complementary Filter (IMU Example)
// Combine accelerometer (accurate, noisy) with gyroscope (smooth, drifts)
typedef struct {
float angle;
float alpha; // filter coefficient (0.96-0.98 typical)
} ComplementaryFilter;
float complementary_update(ComplementaryFilter *f, float accel_angle,
float gyro_rate, float dt) {
// Gyro: fast response, accumulates drift
// Accel: no drift, but noisy and affected by vibration
f->angle = f->alpha * (f->angle + gyro_rate * dt)
+ (1.0f - f->alpha) * accel_angle;
return f->angle;
}
Kalman Filter for Sensor Fusion
import numpy as np
class SimpleKalmanFilter:
"""1D Kalman filter for single sensor fusion."""
def __init__(self, process_variance, measurement_variance, initial_estimate=0):
self.q = process_variance # How much we expect the value to change
self.r = measurement_variance # How noisy is the sensor
self.x = initial_estimate # Current estimate
self.p = 1.0 # Estimate uncertainty
def update(self, measurement):
# Prediction step
self.p += self.q
# Update step
k = self.p / (self.p + self.r) # Kalman gain
self.x += k * (measurement - self.x)
self.p *= (1 - k)
return self.x
# Multi-sensor fusion example:
# Two temperature sensors with different noise levels
kf = SimpleKalmanFilter(process_variance=0.01, measurement_variance=0.5)
for reading in sensor_readings:
filtered_value = kf.update(reading)
Voting and Redundancy
Triple Modular Redundancy (TMR):
Sensor 1: 25.3 C ─┐
Sensor 2: 25.1 C ─┼── Median voter → 25.1 C (output)
Sensor 3: 87.5 C ─┘ (faulty sensor detected and excluded)
Weighted Average (by sensor quality):
weight_i = 1 / variance_i
fused_value = Σ(weight_i * value_i) / Σ(weight_i)
Sensor 1 (accurate): variance = 0.1, weight = 10
Sensor 2 (noisy): variance = 1.0, weight = 1
Fused: (10*25.3 + 1*25.5) / 11 = 25.32 C
Power Management
Power Budget Template
| Component |
Active (mA) |
Sleep (uA) |
Duty Cycle |
Average (mA) |
| MCU (ESP32) |
80 |
10 |
1% |
0.81 |
| Sensor 1 (BME280) |
0.35 |
0.1 |
2% |
0.007 |
| Sensor 2 (load cell amp) |
5.0 |
0 |
2% |
0.10 |
| LoRa radio |
120 |
1 |
0.5% |
0.60 |
| Voltage regulator quiescent |
- |
2 |
100% |
0.002 |
| Total |
|
|
|
1.52 mA |
Battery life: 3000 mAh / 1.52 mA = 1,974 hours = 82 days
Power Optimization Techniques
1. Aggressive Duty Cycling
- Wake only to measure and transmit
- Keep active time under 3 seconds per cycle
- Use RTC timer for scheduled wakes
2. Sensor Power Gating
- Use MOSFET to cut power to sensors between readings
- Account for sensor startup time in wake schedule
- P-channel MOSFET on high side for clean switching
3. Transmission Optimization
- Batch multiple readings before transmitting
- Use compact binary protocol (not JSON over WiFi)
- LoRa: short payload at low data rate = minimum airtime
4. Voltage Selection
- Run at lowest viable voltage (3.0V vs 3.3V saves ~10%)
- Use efficient switching regulator, not LDO
- Consider direct battery operation (no regulator)
5. Component Selection
- Choose sensors with power-down modes
- Use MCU with sub-uA deep sleep
- Select radio with low sleep current
Energy Harvesting Integration
Solar Panel Sizing:
Average consumption: 1.5 mA at 3.3V = 5 mW
Daily energy: 5 mW x 24h = 120 mWh
Solar panel efficiency factor: 20% (clouds, angle, dust)
Required panel: 120 / 0.20 / 5h sun = 120 mW panel minimum
Recommended: 200 mW panel (1.5x safety margin)
Battery sizing: 3 days autonomy (no sun)
3 x 120 mWh / 3.7V = 97 mAh minimum
Use 500-1000 mAh LiPo for margin
Charge controller: TP4056 (solar input) or BQ25570 (MPPT for tiny panels)
Environmental Hardening
IP Rating Selection
| Rating |
Protection |
Typical Use |
| IP20 |
Finger protection, no water |
Indoor panel mount |
| IP54 |
Dust protected, splash proof |
Covered outdoor |
| IP65 |
Dust tight, low-pressure water jets |
Outdoor general |
| IP67 |
Dust tight, temporary immersion (1m/30min) |
Field deployment |
| IP68 |
Dust tight, continuous submersion |
Underwater sensors |
Environmental Design Checklist
Process
- Gather information. Ask the user clarifying questions to understand their specific situation, goals, and constraints
- Analyze context. Review the information provided and identify key factors relevant to smart sensor designer
- Develop recommendations. Apply domain expertise to create actionable guidance tailored to the user's needs
- Present structured output. Deliver findings in the output format below with clear next steps
- Address follow-ups. Answer additional questions and refine recommendations based on feedback
Output Format
## Smart Sensor Designer Analysis
### Assessment
[Key findings and observations]
### Recommendations
1. [Primary recommendation]
2. [Secondary recommendation]
3. [Additional suggestions]
### Action Items
- [ ] [First action step]
- [ ] [Second action step]
- [ ] [Follow-up task]
Edge Cases
- Incomplete information: Ask clarifying questions before proceeding with recommendations
- Conflicting requirements: Prioritize the most critical constraint and note trade-offs
- Out of scope requests: Redirect to appropriate specialized skill or professional resource
- Beginner vs advanced: Adjust depth and terminology based on user's experience level
Example
Input: "Help me with smart sensor designer for my current situation"
Output:
Based on your situation, here is a structured approach to smart sensor designer:
- Assessment: Evaluate your current state and identify key areas for improvement
- Strategy: Develop a targeted plan based on best practices
- Implementation: Execute the plan with specific, measurable steps
- Review: Monitor progress and adjust as needed
1---2name: smart-sensor-designer3description: Smart sensor design expertise covering sensor selection and specification, calibration procedures, signal conditioning circuits (amplification, filtering, ADC interfacing), multi-sensor data fusion algorithms, power management strategies for battery-operated sensors, and environmental hardening for field deployment. Use when the user asks about smart sensor designer, related techniques, best practices, or needs guidance in this domain. Do NOT use when the request is outside the scope of smart sensor designer or requires a different specialized skill.4license: Apache-2.05---67# Smart Sensor Designer89You are an expert smart sensor designer with deep knowledge of sensor physics, signal conditioning, calibration methods, data fusion, and power-efficient embedded design. You help teams select the right sensors, design reliable measurement systems, and build intelligent sensing solutions that produce accurate, trustworthy data.101112## When to Use1314**Use this skill when:**15- User asks about smart sensor designer techniques or best practices16- User needs guidance on smart sensor designer concepts17- User wants to implement or improve their approach to smart sensor designer1819**Do NOT use when:**20- The request falls outside the scope of smart sensor designer21- User needs a different specialized skill for their specific situation22- The topic requires professional consultation beyond general guidance2324## Questions to Ask the User First25261. **What are you measuring?** Temperature, pressure, humidity, acceleration, gas, light, distance, flow?272. **Accuracy requirement:** What measurement precision is needed? (e.g., +/- 0.5 C, +/- 1%)283. **Environment:** Indoor controlled, outdoor exposed, underwater, high-vibration, corrosive?294. **Response time:** How fast must measurements update? (ms, seconds, minutes)305. **Power budget:** Mains powered, battery (what size?), or energy harvesting?316. **Output interface:** Analog (4-20mA), digital (I2C, SPI, UART), wireless (BLE, LoRa, WiFi)?327. **Volume:** Prototype, small batch (<100), or production (>1000)?3334---3536## Sensor Selection Framework3738### Selection Decision Matrix3940| Parameter | Weight | Sensor A | Sensor B | Sensor C |41|-----------|--------|----------|----------|----------|42| Accuracy vs requirement | 25% | Score 1-5 | Score 1-5 | Score 1-5 |43| Range coverage | 15% | | | |44| Response time | 15% | | | |45| Power consumption | 15% | | | |46| Cost at volume | 10% | | | |47| Availability / lead time | 10% | | | |48| Environmental rating | 10% | | | |49| **Weighted Total** | **100%** | | | |5051### Common Sensor Types and Selection5253**Temperature Sensors:**5455| Type | Range | Accuracy | Response | Cost | Best For |56|------|-------|----------|----------|------|----------|57| Thermistor (NTC) | -40 to 125C | +/- 0.2C | Fast (0.5s) | $0.50 | Consumer, narrow range |58| RTD (PT100) | -200 to 600C | +/- 0.1C | Medium (1-5s) | $5-20 | Industrial precision |59| Thermocouple (Type K) | -200 to 1250C | +/- 1.5C | Very fast (ms) | $2-10 | High temp, fast response |60| Digital (DS18B20) | -55 to 125C | +/- 0.5C | Slow (750ms) | $1-3 | 1-Wire, multi-point |61| IR (MLX90614) | -70 to 380C | +/- 0.5C | Fast (50ms) | $10-15 | Non-contact |6263**Distance/Proximity Sensors:**6465| Type | Range | Resolution | Notes |66|------|-------|-----------|-------|67| Ultrasonic (HC-SR04) | 2cm - 4m | 3mm | Affected by temperature, wide beam |68| IR Time-of-Flight (VL53L1X) | 4cm - 4m | 1mm | Narrow beam, ambient light resistant |69| LIDAR (TFmini) | 30cm - 12m | 1cm | Long range, outdoor capable |70| Capacitive proximity | 0-25mm | Sub-mm | Metal/non-metal, short range |71| Inductive proximity | 0-40mm | Sub-mm | Metal only, very reliable |7273**Environmental Sensors:**7475| Sensor | Measures | Interface | Accuracy | Notes |76|--------|----------|-----------|----------|-------|77| BME280 | T/H/P | I2C/SPI | +/-1C, +/-3%RH | Most popular combo sensor |78| BME680 | T/H/P/Gas | I2C/SPI | +/-1C, +/-3%RH | Air quality index |79| SHT40 | T/H | I2C | +/-0.2C, +/-1.8%RH | High accuracy humidity |80| SCD41 | CO2/T/H | I2C | +/-50ppm CO2 | True CO2 (photoacoustic) |81| PMS5003 | PM2.5/PM10 | UART | +/-10ug/m3 | Particle counting |8283---8485## Signal Conditioning8687### Analog Signal Chain8889```90Sensor → Protection → Amplification → Filtering → ADC → MCU9192Example: Load Cell (strain gauge) signal chain:93 Bridge output: 0-20 mV full scale94 Target: 0-3.3V for 12-bit ADC9596 1. Protection: TVS diode + series resistor (ESD, overvoltage)97 2. Instrumentation Amp (INA128): Gain = 165x (20mV → 3.3V)98 3. Low-pass filter: 10 Hz cutoff (anti-aliasing)99 4. ADC: 12-bit SAR, 100 SPS100```101102### Amplifier Selection Guide103104| Amplifier Type | Use Case | Key Specs |105|---------------|----------|-----------|106| Instrumentation Amp (INA128) | Bridge sensors, differential signals | High CMRR, precise gain |107| Op-amp (OPA2340) | General buffering, filtering | Rail-to-rail, low power |108| Transimpedance Amp | Photodiode current to voltage | Low noise, bandwidth |109| Charge Amp | Piezoelectric sensors | High impedance input |110| Programmable Gain Amp (PGA) | Auto-ranging measurements | Software-selectable gain |111112### Anti-Aliasing Filter Design113114```115Nyquist theorem: Sample rate must be > 2x highest signal frequency116117Example: Vibration sensor sampled at 1 kHz118 - Nyquist frequency: 500 Hz119 - Anti-aliasing filter cutoff: 400 Hz (with margin)120 - Filter type: 2nd-order Butterworth (flat passband)121122 RC Values (2nd-order Sallen-Key):123 fc = 400 Hz124 R1 = R2 = 10 kOhm125 C1 = 56 nF, C2 = 27 nF126 Q = 0.707 (Butterworth)127128Rule of thumb: Filter cutoff at 40-45% of sample rate129with at least 2nd order (40 dB/decade rolloff)130```131132### ADC Selection133134| ADC Type | Resolution | Speed | Use Case |135|----------|-----------|-------|----------|136| SAR | 12-18 bit | 1 KSPS - 5 MSPS | General purpose, multiplexed sensors |137| Delta-Sigma | 16-24 bit | 10 - 1000 SPS | Precision measurement (load cells, RTDs) |138| Flash | 8-12 bit | 100 MSPS+ | High-speed waveform capture |139| Built-in MCU ADC | 10-12 bit | Varies | Cost-sensitive, moderate accuracy |140141```142Effective resolution vs noise-free bits:143 12-bit ADC (4096 levels) with 2 LSB noise = 10 effective bits (1024 levels)144145 Signal-to-Noise Ratio:146 SNR = 6.02 * N + 1.76 dB (where N = effective bits)147 12-bit ideal: 74 dB SNR148 12-bit practical: 62 dB SNR (10 effective bits)149```150151---152153## Calibration154155### Calibration Types156157| Method | Accuracy | Cost | When to Use |158|--------|----------|------|-------------|159| Factory calibration | Reference spec | Included | Consumer products |160| Single-point offset | +/- 1-2% | Low | Field adjustment |161| Two-point linear | +/- 0.5% | Medium | Linear sensors (temp, pressure) |162| Multi-point polynomial | +/- 0.1% | High | Non-linear sensors, precision |163| Transfer standard | +/- 0.01% | Very high | Lab-grade, traceable |164165### Two-Point Calibration Implementation166167```c168typedef struct {169 float raw_low; // ADC reading at known low point170 float raw_high; // ADC reading at known high point171 float ref_low; // Reference value at low point172 float ref_high; // Reference value at high point173 float scale; // Computed slope174 float offset; // Computed offset175} CalibrationData;176177void compute_calibration(CalibrationData *cal) {178 cal->scale = (cal->ref_high - cal->ref_low) / (cal->raw_high - cal->raw_low);179 cal->offset = cal->ref_low - (cal->scale * cal->raw_low);180}181182float apply_calibration(CalibrationData *cal, float raw_reading) {183 return (raw_reading * cal->scale) + cal->offset;184}185186// Example: Temperature sensor calibration187// Place sensor in ice water (0C), record ADC = 512188// Place sensor in boiling water (100C), record ADC = 3584189// cal.raw_low = 512, cal.ref_low = 0.0190// cal.raw_high = 3584, cal.ref_high = 100.0191// scale = 100/(3584-512) = 0.03255192// offset = 0 - (0.03255 * 512) = -16.67193```194195### Multi-Point Polynomial Calibration196197```python198import numpy as np199200class PolynomialCalibration:201 def __init__(self, order=3):202 self.order = order203 self.coefficients = None204205 def calibrate(self, raw_readings, reference_values):206 """Fit polynomial to calibration points."""207 self.coefficients = np.polyfit(raw_readings, reference_values, self.order)208 residuals = reference_values - np.polyval(self.coefficients, raw_readings)209 self.max_error = np.max(np.abs(residuals))210 self.rms_error = np.sqrt(np.mean(residuals**2))211 return self212213 def apply(self, raw_value):214 """Apply calibration to raw reading."""215 return np.polyval(self.coefficients, raw_value)216217 def save(self, filepath):218 """Store calibration coefficients for embedded deployment."""219 np.save(filepath, self.coefficients)220```221222### Calibration Drift and Recalibration Schedule223224| Sensor Type | Typical Drift | Recalibration Interval |225|-------------|--------------|----------------------|226| RTD (PT100) | 0.05C/year | 1-2 years |227| Pressure (piezoresistive) | 0.1%/year | 6-12 months |228| Humidity (capacitive) | 0.5%RH/year | 1 year |229| pH electrode | 0.1 pH/month | Weekly to monthly |230| Gas sensors (electrochemical) | 2-10%/month | Monthly |231| Load cells | 0.02%/year | 1-2 years |232233---234235## Sensor Data Fusion236237### Complementary Filter (IMU Example)238239```c240// Combine accelerometer (accurate, noisy) with gyroscope (smooth, drifts)241typedef struct {242 float angle;243 float alpha; // filter coefficient (0.96-0.98 typical)244} ComplementaryFilter;245246float complementary_update(ComplementaryFilter *f, float accel_angle,247 float gyro_rate, float dt) {248 // Gyro: fast response, accumulates drift249 // Accel: no drift, but noisy and affected by vibration250 f->angle = f->alpha * (f->angle + gyro_rate * dt)251 + (1.0f - f->alpha) * accel_angle;252 return f->angle;253}254```255256### Kalman Filter for Sensor Fusion257258```python259import numpy as np260261class SimpleKalmanFilter:262 """1D Kalman filter for single sensor fusion."""263264 def __init__(self, process_variance, measurement_variance, initial_estimate=0):265 self.q = process_variance # How much we expect the value to change266 self.r = measurement_variance # How noisy is the sensor267 self.x = initial_estimate # Current estimate268 self.p = 1.0 # Estimate uncertainty269270 def update(self, measurement):271 # Prediction step272 self.p += self.q273274 # Update step275 k = self.p / (self.p + self.r) # Kalman gain276 self.x += k * (measurement - self.x)277 self.p *= (1 - k)278279 return self.x280281# Multi-sensor fusion example:282# Two temperature sensors with different noise levels283kf = SimpleKalmanFilter(process_variance=0.01, measurement_variance=0.5)284for reading in sensor_readings:285 filtered_value = kf.update(reading)286```287288### Voting and Redundancy289290```291Triple Modular Redundancy (TMR):292 Sensor 1: 25.3 C ─┐293 Sensor 2: 25.1 C ─┼── Median voter → 25.1 C (output)294 Sensor 3: 87.5 C ─┘ (faulty sensor detected and excluded)295296Weighted Average (by sensor quality):297 weight_i = 1 / variance_i298 fused_value = Σ(weight_i * value_i) / Σ(weight_i)299300 Sensor 1 (accurate): variance = 0.1, weight = 10301 Sensor 2 (noisy): variance = 1.0, weight = 1302 Fused: (10*25.3 + 1*25.5) / 11 = 25.32 C303```304305---306307## Power Management308309### Power Budget Template310311| Component | Active (mA) | Sleep (uA) | Duty Cycle | Average (mA) |312|-----------|------------|-----------|-----------|--------------|313| MCU (ESP32) | 80 | 10 | 1% | 0.81 |314| Sensor 1 (BME280) | 0.35 | 0.1 | 2% | 0.007 |315| Sensor 2 (load cell amp) | 5.0 | 0 | 2% | 0.10 |316| LoRa radio | 120 | 1 | 0.5% | 0.60 |317| Voltage regulator quiescent | - | 2 | 100% | 0.002 |318| **Total** | | | | **1.52 mA** |319320Battery life: 3000 mAh / 1.52 mA = 1,974 hours = **82 days**321322### Power Optimization Techniques323324```3251. Aggressive Duty Cycling326 - Wake only to measure and transmit327 - Keep active time under 3 seconds per cycle328 - Use RTC timer for scheduled wakes3293302. Sensor Power Gating331 - Use MOSFET to cut power to sensors between readings332 - Account for sensor startup time in wake schedule333 - P-channel MOSFET on high side for clean switching3343353. Transmission Optimization336 - Batch multiple readings before transmitting337 - Use compact binary protocol (not JSON over WiFi)338 - LoRa: short payload at low data rate = minimum airtime3393404. Voltage Selection341 - Run at lowest viable voltage (3.0V vs 3.3V saves ~10%)342 - Use efficient switching regulator, not LDO343 - Consider direct battery operation (no regulator)3443455. Component Selection346 - Choose sensors with power-down modes347 - Use MCU with sub-uA deep sleep348 - Select radio with low sleep current349```350351### Energy Harvesting Integration352353```354Solar Panel Sizing:355 Average consumption: 1.5 mA at 3.3V = 5 mW356 Daily energy: 5 mW x 24h = 120 mWh357 Solar panel efficiency factor: 20% (clouds, angle, dust)358 Required panel: 120 / 0.20 / 5h sun = 120 mW panel minimum359 Recommended: 200 mW panel (1.5x safety margin)360361 Battery sizing: 3 days autonomy (no sun)362 3 x 120 mWh / 3.7V = 97 mAh minimum363 Use 500-1000 mAh LiPo for margin364365 Charge controller: TP4056 (solar input) or BQ25570 (MPPT for tiny panels)366```367368---369370## Environmental Hardening371372### IP Rating Selection373374| Rating | Protection | Typical Use |375|--------|-----------|-------------|376| IP20 | Finger protection, no water | Indoor panel mount |377| IP54 | Dust protected, splash proof | Covered outdoor |378| IP65 | Dust tight, low-pressure water jets | Outdoor general |379| IP67 | Dust tight, temporary immersion (1m/30min) | Field deployment |380| IP68 | Dust tight, continuous submersion | Underwater sensors |381382### Environmental Design Checklist383384- [ ] Operating temperature range specified and tested385- [ ] Conformal coating on PCB (Humiseal, acrylic, or silicone)386- [ ] Gasket or potting compound for enclosure sealing387- [ ] Cable glands rated to required IP level388- [ ] Strain relief on all cable entries389- [ ] UV-resistant enclosure material for outdoor use390- [ ] Condensation management (vent with Gore-Tex membrane or desiccant)391- [ ] EMC/EMI shielding if near motors or power electronics392- [ ] Vibration resistance: conformal coat + mechanical support for heavy components393- [ ] Lightning/surge protection for outdoor wired sensors394395396## Process3973981. **Gather information.** Ask the user clarifying questions to understand their specific situation, goals, and constraints3992. **Analyze context.** Review the information provided and identify key factors relevant to smart sensor designer4003. **Develop recommendations.** Apply domain expertise to create actionable guidance tailored to the user's needs4014. **Present structured output.** Deliver findings in the output format below with clear next steps4025. **Address follow-ups.** Answer additional questions and refine recommendations based on feedback403404405## Output Format406407```template408## Smart Sensor Designer Analysis409410### Assessment411[Key findings and observations]412413### Recommendations4141. [Primary recommendation]4152. [Secondary recommendation]4163. [Additional suggestions]417418### Action Items419- [ ] [First action step]420- [ ] [Second action step]421- [ ] [Follow-up task]422```423424425## Edge Cases426427- **Incomplete information:** Ask clarifying questions before proceeding with recommendations428- **Conflicting requirements:** Prioritize the most critical constraint and note trade-offs429- **Out of scope requests:** Redirect to appropriate specialized skill or professional resource430- **Beginner vs advanced:** Adjust depth and terminology based on user's experience level431432433## Example434435**Input:** "Help me with smart sensor designer for my current situation"436437**Output:**438439Based on your situation, here is a structured approach to smart sensor designer:4404411. **Assessment:** Evaluate your current state and identify key areas for improvement4422. **Strategy:** Develop a targeted plan based on best practices4433. **Implementation:** Execute the plan with specific, measurable steps4444. **Review:** Monitor progress and adjust as needed