Skip to content

opensource code for the MyPart air sensor and testing chamber

Notifications You must be signed in to change notification settings

ssterman/airsensor

Repository files navigation

MyPart Air Particle Sensor

Automated Testing Code

This is all the code you need to run automated tests for the MyPart Air Particle Sensor, along with the Dylos DC1100 Pro air sensor and the MetOne HHPC 6 air sensor, as described in the Instructable here. For more detail on setting up the chamber or code, see the instructable.

There are two main sets of files: sketches and libraries for Arduino, and python scripts for coordinating the tests and talking to each sensor.

Python Scripts

hhpc_serial_com.py

dylos_serial_com.py

These two files offer interfaces into the Dylos and MetOne air sensors. Using serial, they implement basic commands for retrieving data from both, recording data in csvs, and for initiating sampling for the MetOne. The MetOne has a multitude of possible commands; we have implemented only those necessary for automated testing, however the rest can be added by inspecting the data sheet and following the function pattern established in the code.

These files can be used outside of the automated testing flow if you just want a programmatic way to talk to the MetOne or Dylos sensors over serial.

crc_algorithms.py

This is a part of pycrc, used in hhpc_serial_com.py to create the crc necessary for communication with the MetOne. It is unchanged from the original, and included here for convenience.

arduino_serial_com.py

This file manages communication between the python scripts and the test chamber arduinos. It writes a set of command characters to a serial connection, which a matching Arduino file will listen for. It also listens to the same serial channel for data coming back from sensors over Arduino serial channels, and records data to csvs. Note that any change in the serial communication either of commands or data requires an equivalent change in talk_to_arduino_via_serial.ino, the paired Arduino file.

raw_analog_saleae.py

This file is an optional addition to allow the collection of raw data from a Saleae logic analyzer. It samples from the Saleae, and records raw data in the original format and in matlab files. Note that this function will only work if you also have the Saleae Logic program open and running on your machine.

testing_chamber.py

This file defines a set of testing chamber specific functions, such as turning on and off fans, or beginning sampling for multiple sensors at once.

sensor_reads.py

This is the main automation file. To run an automated test, run this file. Overall behavior and synchronization is handled here, as is the location for saved data. Configuration variables are included at the top.

Arduino Sketches and Libraries

Custom Libraries

HDC1080_sensor_H

This library defines a simple Arduino wrapper for the Texas Instruments HDC1080 humidity sensor. This sensor is used both in the automated testing chamber, and in the MyPart sensor.

TCA6507_driver

This library defines a simple Arduino wrapper for the Texas Instruments TCA6507 LED driver. This driver is used in the MyPart sensor.

Custom Sketches

mypart_gzll_host.ino

This file listens for data returned from the gzll client running on each MyPart sensor. When it receives data, it passes them on via serial so the python testing scripts can pick them up and record them. This file should be run on an RFduino.

LED_lib_test.ino

A simple file demonstrating the use of the LED driver.

talk_to_arduino_via_serial.ino

This file pairs with the arduino_serial_com.py script. It listens for the set of command characters defined in the python script, and sends the appropriate commands on to the test chamber hardware. Some commands also return data over serial to the python script to be recorded. Note that any change in the serial communication either of commands or data requires an equivalent change in arduino_serial_com.py.

About

opensource code for the MyPart air sensor and testing chamber

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages