sonyc-project / sonycAQ

Repository for code related to the AQ sensor addition
Other
2 stars 2 forks source link

Hardware issue resiliency #1

Closed cmydlarz closed 3 years ago

cmydlarz commented 3 years ago

These scripts need to run indefinitely and be robust to issues. A useful feature of the data capture scripts is for them to be resilient to intermittent sensor connectivity issues. What would happen if the sensor lost power briefly or the serial device could not be read?

You can test what happens by unplugging the sensor for a few seconds and see how the scripts handle it. If they stop running, look for ways to check for sensor connectivity on each cycle

JVenditto commented 3 years ago

I've uploaded a new script called AQ_test2.py that takes into account issues with the serial bus. I have run a test with the sensor disconnected from power: the script continued running and collected data again once the power was restored.

JVenditto commented 3 years ago

interruption_test This excerpt from the .csv file shows that no data was recorded while the power was removed, but regular data collection resumed when the power was restored. Additionally, the file still only covers 1 minute, so even with < 60 entries, the program creates a new file when a minute has passed.

JVenditto commented 3 years ago

Updated file AQ_test4.py instead begins new .csv file when sensor is restored, and is more robust.

JVenditto commented 3 years ago

The newest python script includes tests for both bus readability as well as properly-formatted data.