Skip to content

bu-vip/photons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

photons

This system collects data from the Photon matrix. It can take data from any number of sensors specified. The current setup turns on each LED in succession and captures sensor reading from all sensors simultaneously. Sensor data is then written to a file on your local computer.

Requirements:

  • Bash shell (for Windows, you need to install Cygwin)
  • Python 3.5.2 or higher
  • Particle CLI

Architecture:

The system contains a local computer and an array of photons boards. Each photon board is flashed with a driver and sends data to the local computer using a usb serial connection. The photons listen for certain events using the Particle Cloud to execute commands such as "turn on LED" and "run trial". Using Bash scripts, the local publishes commands and then uses a Bash script and then a python parser to parse the sensor readings.

First Time Use:

  1. Make sure the bash files are executable:
cd /path/to/photons/
chmod +x src/main/bash/*.sh
  1. Flash all the photons: Open src/main/config/active_photons.txt and make sure the file contains the names of photons you are using
cd /path/to/photons/
python src/main/python/initialize.py

Usage:

To initialize the sensor:

cd /path/to/photons/
./src/main/bash/publish_order_numbers.sh

To run a trial:

  1. Make sure the usb serial port is open, the sensors are initialized, and run the log sensors script:
cd path/to/photons
./src/main/bash/log_sensors.sh

This command will generate 9 raw data files named ACM#.txt corresponding to each serial port connection. These files contain the outputs of each serial port and are necessary for parsing.

NOTE: these file gets written over each time the log_sensor.sh is called, so make sure to copy these files over if they contain good data that has not been parsed yet.

  1. Send the run_trial event to the photons over the cloud:
particle publish all_photons run_trial
  1. Once the trial has completed, stop the log sensors script (Ctrl-C) and run the parser:
cd path/to/photons
python src/main/python/parse_data.py

This command will generate a formatted data file named timestamp_output.txt. A raw data file named data.txt is also generated, but is used only for debugging purposes.

NOTE: these file gets written over each time the parser is called, so be sure to copy this file over if it contains good data.

To run 4 trials in succession:

Follow the same format as above, but replace the "run_trial" event in instruction #2 for "run_4":

particle publish all_photons run_4

To re-flash the photons:

cd /path/to/photons/
python src/main/python/initialize.py

To get testbed dimensions:

cd /path/to/photons/
g++ -std=c++14 src/main/config/testbed_dimensions.cpp -o testbed_dimensions && ./testbed_dimensions

This command will generate a standard output detailing the testbed dimensions

NOTE: these dimensions need to be modified in the c++ program to match the testbed you have set up. This includes the object location.

About

data collection using Particle Photon boards

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published