This project revolves around using the Cypress Analog Coprocessor Pioneer Kit as a sensor hub. Using an Arduino Uno as an I2C-to-UART USB serial bridge, a computer records sensor values taken once every second and saves the useful ones to file for annotation and feature extraction. This annotated data is then given to an off-the-shelf SVM classifier to to train a model that will then be used to to determine if the sensor recordings at a given moment fall are ideal.Setup
- Flash the EnvironmentSensing firmware onto the Cypress Analog Coprocessor Pioneer Kit board using the PSoC Creator software package. (A bunch of thanks to Michiyuki Yoneda over at Cypress for sending that my way!)
- Flash the i2c_to_serial sketch onto an Arduino Uno.
- Connect the Cypress and Arduino boards:
""" Arduino A5 ----> 4.0 Pioneer Arduino A4 ----> 4.1 Pioneer Arduino 5V ----> VIN Pioneer Arduino GND ----> GND Pioneer """
- Connect the computer to the Arduino Uno via USB.
- Start the Python companion script, passing in the port of the Arduino as an input parameter. For Windows machines, this will look something like:
python serial_read.py COM3
- 12/13/16 - Received PSoC Creator project files from Michiyuki @ Cypress, who offered his help in transforming the Cypress Analog Pioneer Kit into a Sensor Hub.
- 12/22/16 - Finally managed to run the Cypress Bridge Control Panel app to read the I2C sensor readings coming off of the Kit board. (More thanks to Michiyuki!)
- 2/4/17 - Was able to pull bytes off of the Pioneer Kit's via I2C onto an Arduino Uno. Unfortunately the data was incomprehensible unicode jibberish.
- 2/13/17 - Recognized a bug in my Arduino code transforming the values into characters instead of floats. Began project documentation and started to write Python data collector.
- 2/15/17 - Started to decipher the data stream from Cypress board. Wrote a Python script to read values.
- 2/20/17 - Fixed issue preventing NodeMCU from supplying adequate power to Cypress board.
- 2/21/17 - Wrote Python Flask web server to serve as collection hub for data.
- 2/26/17 - Updated Arduino program to collect data once per second. Added code to companion Python app to write data to CSV file.
While pin-compatible with an Arduino Uno, my Uno resets itself incessantly when the Pioneer Kit is plugged directly into it. Instead we have to make the connections via jumper cables.
It also appears as though most of the sensor data is relative and not absolute. That means calibration will be necessary to use the sensor data from the thermistor, ambient light sensor, etc. The sensor values also appear to be base 255-encoded, further throwing off attempts at deciphering which belong to which sensor.Results
Unfortunately the sensor data being transmitted via I2C from the Cypress board isn't absolute and is thus ill-suited for our purposes. Every power cycle of the board results in a recalibration of the sensor values, rendering the recording sessions impossible to compare directly. The project continued forward regardless, with the goal of instead incorporating a NodeMCU in order to create a sensor hub that can post environment readings to the internet.
However without absolute certainty that the values are correctly assigned to their respective sensors, utilizing a NodeMCU was never fully investigated. Case in point: two I2C values appeared linked to the ambient light sensor, despite those values not being identical.
It also turns out that the SVM implementation chosen would only be capable of assigning an ideal/not-ideal label to a set of measurements correlating to one point in time, and not capable of identifying multiple measurements over a period of time. That would requite more advanced automatic analytics.
The end result is a system that is capable of recording sensor values, which can then be later analyzed such as in the screenshot taken above.For The Future
I was only able to reasonably discern the values corresponding to three of the five sensors on the Cypress board. Moving forward I would like to include the remaining two in my environment recordings. Additionally I would prefer to not rely upon a computer and instead incorporate a NodeMCU and cloud-based app to manage the data generated.