  In industrial process automation, sensors (pressure, temperature, etc.),
controllers, and actuators (solenoid valves, electro-mechanical relays, circuit
breakers, motors, etc.) make sure that production lines are working under the
pre-defined conditions. When these systems malfunction or sometimes completely
fail, alerts have to be generated in real-time to make sure not only production
quality is not compromised but also safety of humans and equipment is assured.
In this work, we describe the construction of a smart and real-time edge-based
electronic product called PreMa, which is basically a sensor for monitoring the
health of a Solenoid Valve (SV). PreMa is compact, low power, easy to install,
and cost effective. It has data fidelity and measurement accuracy comparable to
signals captured using high end equipment. The smart solenoid sensor runs
TinyML, a compact version of TensorFlow (a.k.a. TFLite) machine learning
framework. While fault detection inferencing is in-situ, model training uses
mobile phones to accomplish the `on-device' training. Our product evaluation
shows that the sensor is able to differentiate between the distinct types of
faults. These faults include: (a) Spool stuck (b) Spring failure and (c) Under
voltage. Furthermore, the product provides maintenance personnel, the remaining
useful life (RUL) of the SV. The RUL provides assistance to decide valve
replacement or otherwise. We perform an extensive evaluation on optimizing
metrics related to performance of the entire system (i.e. embedded platform and
the neural network model). The proposed implementation is such that, given any
electro-mechanical actuator with similar transient response to that of the SV,
the system is capable of condition monitoring, hence presenting a first of its
kind generic infrastructure.
