uThing::MNL¶
Description¶
uThing::MNL™ is an easy-to-use USB multi-sensor dongle which integrates a motion (PIR) sensor, a luminosity sensor, and a MEMS microphone used to measure ambient-noise (SPL) .
The aggregated output data generated from these 3 sensors can be used to detect presence of people or track the activity levels on an indoor space for example.
The uThing::MNL™ comes with two different lenses so the detection angle and range can be optimized for different applications by changing the lens.
The integrated STM32L412 MCU (ARM Cortex®-M4 with DSP instructions) captures raw data from the different sensors and apply various algorithms and signal processing (DSP) to convert the raw data into meaningful values. These values are then output on a configured interval over a simple Virtual Comm Port (VCP) on the USB connector in various formats (JSON, CSV or human-readable) for ease of integration.
Output data points:
- Ambient light (illuminance) - last measurement
- Ambient light (illuminance) - average
- Motion (PIR) - # of detections during the last sampling period
- Motion (PIR) - # of detections during the last hour
- Ambient noise (SPL) - RMS over 125ms window
- Ambient noise (SPL) - peak (maximum)
- Ambient noise (SPL) - base (minimum)
Block diagram¶
The figure below shows a block diagram of the board:
An LDO regulator is used to convert the USB 5V voltage into 3.3V, used to power the MCU and the sensors.
Detail of the main components and exposed pads:
A blue LED blinks when the processed data is sent to the host.
MEMS microphone and SPL
The MEMS microphone is used to measure the ambient noise and the MCU uses digital signal processing to calculate the SPL (Sound Pressure Level), which is a logarithmic measure of the pressure level of a sound. By no means the microphone is used to sample intelligible voice or audio data, the only sound information transmitted to the USB host are the SPL levels over a 125ms time window, as in a Sound Level Meter (decibel-meter).
Check this section for more details about the hardware.
Output formats¶
As in all the uThing™ devices. The board outputs all the processed sensor data in JSON format by default. JSON allows a seamless integration with a multitude of back-end and front-end applications.
During an initial evaluation, a more "human-friendly" format can be easily configured (which includes the output units for an initial understanding of the generated data).
For applications where a simple mean for data-logging is needed, the board can be configured to output the data in CSV format (comma separated values).
Here it's an example of the three output formats:
{"noise":{"rms":33.5,"peak":33.5,"base":30.4},"pir":{"detections":0,"detPerHour":6},"light":{"last":58.13,"average":51.67}}
#Columns: [noise_rms], [noise_peak], [noise_base], [pir_detections], [pir_lastHourD], [light_last], [light_average]
38.9, 42.4, 38.5, 1, 11, 60.96, 58.47
Noise: [rms: 33.0 dB, Peak: 36.6 dB, Base: 31.7 dB], PIR: [detections 0, detections/hour 8], Light: [Last 60.05, Average 56.06]
Check this section for details about sensor outputs and data formats.
Configuration¶
The device supports two ways of configuration:
- Interactive: with a terminal connected to the VCP, simple one-character commands change the behavior of the device (changing output format, reporting frequency, etc.)
- JSON objects: to keep consistency with the JSON output formats, JSON objects can be sent to the device to query and modify the configuration (turn-on/off leds, calibrate temperature offset, etc.)
For a detailed description of the configuration options check this section
Compatibility¶
The device can be used with any USB capable host (laptop, embedded PCs, gateways, Android devices, etc.).
The firmware running in the STM32L412 MCU integrates a standard USB-CDC (Communication Device Class).
USB-CDC (VCP)
The CDC is a USB generic composite class that can include more than one interface such as a custom control interface, data interface, audio, or mass storage related interfaces.
In particular, this application uses the CDC-ACM (Abstract Control Mode) to emulate a serial port. This implementation is also known as USB VCP (Virtual Communications Port).
The USB VCP interface is supported “out-of-the-box” in Linux, MacOS, Windows and Android systems without the need of any extra driver installation since this driver comes integrated by default in those operating systems.