PSoC6 Data Collection to CSV log file

1. Collect dataset using Eclipse ModusToolbox

1.1 Create Project through ModusToolbox

Create application project

1.2 Steps to Configure the Code:

  1. Navigate to the gesture.h File:

    • Locate the gesture.h file within the source folder of the project directory.

  2. Modify the Macro for Data Collection Mode:

    • Open the gesture.h file.

    • Find the line defining GESTURE_DATA_COLLECTION_MODE.

    • Change its value from 0u to 1u.

    • This change enables printing sensor data to the terminal instead of running the inference engine.

  1. Navigate to the Makefile:

    • Locate the Makefile in the root directory of the project.

  2. Update the Shield:

    • Open the Makefile.

    • Look for the shield configuration line:

    • Change this to:

    • This updates the configuration to use the CY_028_SENSE_SHIELD_v2 for gathering IMU data.

1.3 Build and Launch the application

1.4 Let's collect dataset by Eclipse

  • Open modus-shell

  • Navigate to the folder and install the library.

install library: pip install -r requirements.txt
  • To collect data from the sensor, use the command line as below:

ตัวอย่าง:

Press 'c' to start collect data and 's' to stop and exit

2. Convert .txt dataset to .csv dataset

After data collection, the dataset is stored in the Machine_Learning_Gesture_Classification\train\gesture_data\<your gesture name> directory as a .txt file

2.1 Plot graph

  • Using below code for plot the graph for each sensor dataset:

  • Sample Graph Outputs from the Dataset

2.2 Covert to .csv file

Colab: https://colab.research.google.com/drive/1wdsgtEFlWhmXoo3XLQOzVhtO8u_F96Nt?usp=sharing

Open Colab and create your own copy before running the code:

This session in Colab is used to convert a .txt dataset to a .csv dataset.

Last updated

Was this helpful?