Resumen: Household appliances, climate control machines, vehicles, elevators, cash counting machines, etc., are complex machines with key contributions to the smart city. Those devices have limited memory and processing power, but they are not just actuators; they embed tens of sensors and actuators managed by several microcontrollers and microprocessors communicated by control buses. On the other hand, predictive maintenance and the capability of identifying failures to avoid greater damage of machines is becoming a topic of great relevance in Industry 4.0, and the large amount of data to be processed is a concern. This article proposes a layered methodology to enable complex machines with automatic fault detection or predictive maintenance. It presents a layered structure to perform the collection, filtering and extraction of indicators, along with their processing. The aim is to reduce the amount of data to work with, and to optimize them by generating indicators that concentrate the information provided by data. To test its applicability, a prototype of a cash counting machine has been used. With this prototype, different failure cases have been simulated by introducing defective elements. After the extraction of the indicators, using the Kullback–Liebler divergence, it has been possible to visualize the differences between the data associated with normal and failure operation. Subsequently, using a neural network, good results have been obtained, being able to correctly classify the failure in 90% of the cases. The result of this application demonstrates the proper functioning of the proposed approach in complex machines. Idioma: Inglés DOI: 10.3390/s22020586 Año: 2022 Publicado en: Sensors 22, 2 (2022), 586 [23 pp.] ISSN: 1424-8220 Factor impacto JCR: 3.9 (2022) Categ. JCR: CHEMISTRY, ANALYTICAL rank: 26 / 86 = 0.302 (2022) - Q2 - T1 Categ. JCR: INSTRUMENTS & INSTRUMENTATION rank: 19 / 63 = 0.302 (2022) - Q2 - T1 Categ. JCR: ENGINEERING, ELECTRICAL & ELECTRONIC rank: 100 / 274 = 0.365 (2022) - Q2 - T2 Factor impacto CITESCORE: 6.8 - Engineering (Q1) - Chemistry (Q1) - Biochemistry, Genetics and Molecular Biology (Q2) - Physics and Astronomy (Q1)