Sensors¶
The device integrates three sensors, which combined can be used to monitor presence or activity levels in indoor environments:
- A digital ambient-light sensor
- A pyroelectric motion sensor (PIR)
- An ambient-noise level (SPL) sensor
Ambient Light Sensor¶
The uThing::MNL integrates a LiteOn LTR-303ALS-01, a digital ambient light sensor that converts light intensity into a digital signal.
Location of the ambient light sensor on the uThing::MNL.
How it Works¶
The sensor is designed to mimic the human eye's response to light. It uses two photodiodes, one for visible light and one for infrared, allowing the firmware to compensate for the infrared spectrum and provide a more accurate illuminance value.
It provides a linear response over a wide dynamic range from 0.01 lux to 64,000 lux. The firmware automatically manages the sensor's six gain settings (from 1x to 96x) to ensure a continuous and useful output across this entire range.
Output Data¶
The sensor's output is provided in lux (lx), the standard unit of illuminance. This measures the total luminous flux incident on a surface, per unit area.
On each reporting interval, the device provides two values:
"last": The most recent illuminance measurement."average": An exponential moving average of the illuminance, which provides a smoothed value to reduce the impact of rapid fluctuations.
"light": {
"last": 40.97,
"average": 65.28
}
The following chart shows a capture of the output under normal office light, note that the last value looks more noisy than the average value where the sharp dip represents a shadow from a person moving past the sensor.
As a reference, the table below shows typical illuminance levels for various conditions.
| Illuminance (lux) | Surface Illuminated by |
|---|---|
| 0.0001 | Moonless, overcast night sky (starlight) |
| 0.27 - 1.0 | Full moon on a clear night |
| 50 | Family living room lights |
| 80 | Office building hallway lighting |
| 320 - 500 | Office lighting |
| 1,000 | Overcast day; typical TV studio lighting |
| 10,000 - 25,000 | Full daylight (not direct sun) |
| 32,000 - 100,000 | Direct sunlight |
| Source: Wikipedia |
Motion Sensor¶
Motion is detected using a dual-element pyroelectric infrared (PIR) sensor. This sensor measures changes in the infrared energy in its environment, making it highly effective at detecting the body heat of people and animals.
How it Works¶
The operating principle is based on the Pyroelectric Effect, where certain materials generate a voltage when heated or cooled. The sensor contains two of these pyroelectric elements. In a stable environment, both elements receive the same amount of ambient infrared radiation, and their signals cancel each other out.
When a warm object (like a person) crosses the sensor's field of view, it first warms one element, then the other, creating a changing voltage differential that the device's electronics register as motion.
To make this detection practical, a Fresnel lens is placed over the sensor. This lens collects infrared energy from a wide area and focuses it onto the two sensor elements. It also divides the field of view into multiple detection zones. As an object moves from one zone to another, it creates the distinct thermal variations that the sensor needs to trigger a detection event.
Interchangeable Lenses¶
To provide flexibility for different environments, the uThing::MNL includes two interchangeable Fresnel lenses with different detection patterns.
Model F-001 (Dome)
- Shape: Dome (half-sphere)
- Size: 11.8 x 11.8 x 9.73 mm
- Max Distance: 5 meters (15 feet)
- Viewing Angle: 60°
Model F-002 (Angled)
- Shape: Angled (flat-top)
- Size: 13.6 x 13.6 x 10.0 mm
- Max Distance: 5 meters (15 feet)
- Viewing Angle: 120°
Correct Lens Insertion
For best performance, align the slot on the lens with the corresponding feature on the sensor housing. The lens should be pushed in completely to ensure the correct focal distance.
Which Lens is Better?
The ideal lens depends on your specific application. The detection distance and angle are affected by ambient temperature and even the clothing of the person being detected. We recommend experimenting with both lenses to see which performs best in your environment.
Output Data¶
The PIR sensor's internal electronics process thermal variations and output a digital pulse when motion is detected. This process has a refractory period of about 2 seconds, meaning continuous motion will generate a new detection pulse approximately every 2 seconds.
The uThing::MNL reports two values related to motion:
"detections": The number of motion pulses triggered during the last reporting period."detPerHour": A calculated rate of detections per hour, useful for visualizing overall activity levels.
"pir": {
"detections": 1,
"detPerHour": 59
}
Key Considerations¶
Several factors can affect the performance and detection range of the PIR sensor:
- Ambient Temperature: The sensor works best when there is a significant temperature difference between the ambient environment and the object being detected. Performance may be reduced if the room temperature is close to human body temperature (e.g., 36°C / 97°F).
- Direct Sunlight & Heat Sources: Do not point the sensor directly at windows where it will be exposed to sunlight. The infrared energy from the sun can cause false triggers. Also, avoid placing it near heating vents, radiators, or other sources of rapid temperature change.
Optimal Placement
For best results, place the sensor 3 to 5 meters away from direct sunlight and heat sources. Detection is most effective when a person walks across the sensor's field of view, rather than directly towards or away from it.
Noise Sensor¶
The noise sensor is a Knowles SPH0644LM4H MEMS (Micro-Electro-Mechanical System) microphone. It acts as the transducer for measuring ambient sound levels.
Diagram of a bottom-port MEMS microphone.
How it Works¶
The microphone converts sound waves into a Pulse Density Modulation (PDM) digital signal. This PDM signal is then processed by the uThing::MNL's microcontroller, which uses Digital Signal Processing (DSP) algorithms to calculate the Sound Pressure Level (SPL).
Privacy by Design
The microphone is not used to sample or transmit intelligible voice or audio data. The firmware only processes the sound to calculate SPL values over a 125ms window, similar to a commercial decibel meter. No audio is ever sent to the host.
Understanding the Data¶
Sound Pressure Level (SPL)¶
Sound Pressure Level (SPL) is a logarithmic measure of the effective pressure of a sound relative to a reference value. The standard reference is the threshold of human hearing (0 dBSPL, or 20 micropascals). Because it's a logarithmic scale, a small change in decibels can represent a large change in sound pressure.
The measured SPL depends heavily on the distance from the sound source. According to the inverse-proportional law, the sound pressure from a point source decreases as the distance ® from the source increases.
dBSPL vs. dBA (Frequency Weighting)¶
Human hearing is not equally sensitive to all frequencies. A-weighting is a standard frequency filter that de-emphasizes low and high frequencies to better match the perceived loudness for humans. Measurements using this filter are denoted as dBA.
The uThing::MNL, however, does not apply this filter. It uses Z-weighting (Zero-weighting), which gives equal importance to all frequencies in the audible spectrum (20Hz to 20kHz). This provides an unweighted, physical measurement of the sound pressure, reported in dBSPL.
The table below gives a rough idea of SPL values for common noise sources.
| Decibels (dBSPL) | Source (at typical distance) |
|---|---|
| 0 | Threshold of hearing |
| 20 | Whispering or rustling leaves |
| 40 | Quiet library |
| 60 | Normal conversation |
| 80 | Garbage disposal, city traffic |
| 100 | Motorcycle, chainsaw |
| 120 | Jet engine at 100m, rock concert |
| 140 | Threshold of pain |
| Source: Wikipedia |
Output Data¶
The uThing::MNL reports sound data at every configured interval (1 second by default). The data is processed over a standard 125 ms time window (often called a "fast window" in decibel meters).
The JSON output includes three values:
"rms": The root mean square of the sound pressure level, representing the average level."peak": The maximum SPL measured during the window."base": The minimum SPL (background noise) measured during the window.
"noise": {
"rms": 30.8,
"peak": 33.5,
"base": 29.4
}
The following chart shows a capture of the peak (orange) and rms (blue) values over a 60-second period.