Sensor device (1) with a
microcontroller unit (20) and a sensor (7) including a
transducer (2;60), which is coupleable to a device (19) and generates a
signal (sX(t)) indicative of a
physical quantity, and a
processing circuit (3) including: a conversion stage (16) which generates samples (X[n]) of the
physical quantity; a data generation stage (12,40,42,44) which generates data vectors (DV[k]) as a function of the samples (X[n]), each
data vector (DV[k]) being formed by programmable quantity values; and a decision stage (12,46). The
microcontroller unit (20) programs the decision stage (12,46) so that it classifies the data vectors (DV[k]) by executing a
decision tree having a structure and thresholds. In a configuration mode, the
microcontroller unit (20) programs the data generation stage (12,40,42,44); in a calibration mode, the microcontroller unit (20) acquires a corresponding set of data vectors (DV[k]), determines, for each programmable quantity, a corresponding range of admissible values and programs the thresholds as a function of the ranges of admissible values; in a detection mode, the decision stage (12,46) classifies the data vectors (DV[k]), by executing the
decision tree on the basis of the programmed thresholds.