Sensors

21 Posts

Choosing Moving Average, First-Order Low-Pass, and Median Filtering

4 minute

When sensor data jitters, the first reaction is often: add a filter.

But filtering is not one button. Moving average, first-order low-pass, and median filtering can all make data look more stable, but they handle different problems and introduce different delays.

A useful first model is:

Random small jitter: moving average is common
Smooth tracking: first-order low-pass is common
Isolated spikes: median filtering is common

This is not a complete DSP taxonomy, but it is enough for many IoT sensor designs.

Read More

Sampling Rate, Filtering, and Response Time Tradeoffs

5 minute

Sensor designs often discuss sampling rate, filter window, response time, and power as separate parameters.

In a real device, they are tied together.

If sampling is too slow, the event has already happened before the system sees it. If filtering is too heavy, the system sees the event but reacts late. If sampling is too fast, power, bandwidth, noise, and processing cost increase. Battery devices that sleep between samples make this even more visible.

Read More

Why IMU Attitude Fusion Often Starts With a Complementary Filter

5 minute

IMU attitude estimation is often summarized as: fuse the accelerometer and gyroscope.

That is true, but too vague. The real problem is: the gyroscope is fast but drifts, the accelerometer gives a long-term gravity reference but is polluted by motion, and the magnetometer can correct heading but is easily polluted by local magnetic fields.

Attitude fusion is not simple averaging. It decides which sensor to trust at which time scale and under which conditions.

Read More

Why Sensor Data Needs Filtering

4 minute

Many devices do collect data. The problem is that raw data is often not ready to become a device decision.

Temperature readings drift slowly. Scales jump by a few grams. Water leak probes may toggle because of droplets or contamination. Current sensing picks up switching noise. Ultrasonic ranging occasionally returns a strange distance. If the firmware compares every raw sample directly against a threshold, the device will false-trigger, miss events, or bounce between states.

Read More

Why Sensor Thresholds Need More Than One If Statement

4 minute

Many sensor features eventually become a condition:

if (value > threshold) {
    alarm = true;
}

This looks reasonable, but real devices usually need more.

Sensor values jitter. Environments drift. Samples hit spikes. User actions may stay near the boundary. With only one threshold, the device can bounce between triggered and not triggered.

A better model is:

raw value
-> filtered value
-> threshold check
-> hysteresis, debounce, confirmation
-> state machine
-> product action

The threshold is only one part of state detection.

Read More

IoT Sensors Are Not Measuring What You Think They Measure

4 minute

IoT devices are often described as “detecting people”, “measuring distance”, “checking air quality”, “measuring body fat”, or “detecting leaks”. That language is fine at the product level, but it can be misleading when you design, install, or debug a device.

Most sensors do not measure those business concepts directly.

They first measure lower-level physical changes: acoustic flight time, electromagnetic echoes, infrared heat changes, light intensity, resistance, pressure, magnetic field, strain, or body impedance. Distance, presence, air quality, body fat percentage, and leak alarms are interpretations built on top of conversion, compensation, thresholds, calibration, and algorithms.

Read More

Why a Body Fat Scale Estimates Fat Instead of Measuring Fat Directly

5 minute

A home body fat scale can show weight, body fat percentage, muscle mass, water, bone mass, basal metabolism, and visceral fat level within seconds.

That can make it feel as if the scale truly measured your body fat.

It did not. The weight comes from a load cell. The body-composition numbers usually come from BIA, bioelectrical impedance analysis.

The first model is: a body fat scale measures body impedance along an electrical path, then combines it with weight, height, age, sex, and population models to estimate body water, fat-free mass, and body fat percentage.

Read More

Is a Tilt Sensor Always an Accelerometer Plus a Gyroscope?

6 minute

Tilt sensors, accelerometers, gyroscopes, IMUs, and attitude sensors are often mixed together as if they all measure “angle”.

That is too rough.

Many tilt sensors are based on accelerometers, but a tilt sensor does not necessarily contain a gyroscope. A 6-axis IMU usually means a three-axis accelerometer plus a three-axis gyroscope. That is not the same thing as every tilt sensor.

The first model is: in static or low-dynamic scenes, tilt can be calculated from the gravity vector projected onto the sensor axes. In dynamic scenes, linear acceleration and vibration pollute the accelerometer, so gyroscopes, filtering, and fusion become necessary.

Read More

Why a Lux Reading Is Not the Same as Human Brightness Perception

4 minute

Light sensors feel intuitive: bright environment, high reading; dark environment, low reading. They are used in smart lights, screen auto-brightness, e-paper devices, plant lighting, and outdoor devices.

But 500 lux does not mean every application is equally bright. It may not match human comfort, camera exposure, or plant photosynthesis.

The first model is: a light sensor measures optical response at its own position and angle. A lux output is illuminance weighted by human photopic vision, not universal light-energy truth.

Read More

Why a Magnetometer Can Point North but Often Gets It Wrong

5 minute

Phones, drones, robots, and handheld devices often contain an electronic compass. It looks as if the device knows where north is.

A magnetometer is not a tiny device that directly knows direction.

It measures the magnetic field vector in the sensor coordinate system. North, heading, and compass direction are computed later.

The first model is: a magnetometer measures local magnetic field. An electronic compass extracts the geomagnetic component, combines it with attitude and calibration, and interprets it as horizontal heading.

Read More