Continuous pressure monitoring in search of an event

I created an algorithm in C that monitors the pressure of an environment during a process whose time can vary from 3 to 10 seconds through sampling with a 12 bit ADC with a frequency of 200Hz. To understand the event I have to look for a sudden and repeated variation in the pressure whose waveform is not always the same and sometimes I fail to recognize this anomaly for example in a process whose duration would have been 10 seconds I have to interrupt the process immediately normally it takes me about 1 second to interpret this anomaly so if it starts after the first 5 seconds I stop at the second number 6 of 10.

therefore at my disposal I have an array of variable length (the length is the time that passes 200 readings per second therefore from a minimum of 600 readings to a maximum of 2000) with a value from 0 to 1024 where I have to search in real time for a form of Typical wave lasting approximately 1 second which represents my anomaly. How can I set up the project?

Hello @fabiolikke,

You can bring in Edge Impulse Studio your data samples.
You’ll need to bring them with a fixed frequency but it seems to be the case for your project (200Hz).
Do you have at your disposal some anomaly occurrences?

If so, you can use a classifier learning block. Make sure to label your data with either anomaly and no anomaly.
If you don’t have many anomalies in your dataset, you can use the Anomaly Detections learning block (either using K-Means or GMM) and only train the model with nominal data (move your few anomalies to your testing dataset).

If you know you’re anomaly signature (with the waveform) is about 1 second, make sure to use an appropriate window size to be able to catch that anomaly (1000ms minimum but could be higher).

Finally, when you’ll run your model, select a continuous version if you don’t want to “restart” the data sampling process and have some results flowing in “real-time”.

You can have a look at this tutorial. It uses motion but you could replace it with your pressure sensor: