This shows you the differences between two versions of the page.
|
iothings:laboratoare:2025:lab6 [2025/10/28 19:49] dan.tudose [5. Running the model and detecting shakes] |
iothings:laboratoare:2025:lab6 [2025/10/28 19:55] (current) dan.tudose [3. Logging training data] |
||
|---|---|---|---|
| Line 89: | Line 89: | ||
| Run script that logs with label stationary: | Run script that logs with label stationary: | ||
| - | ''> python collect_data.py -stationary --port /dev/ttyUSB0 --baud 115200'' | + | <code> > python3 collect_data.py -stationary --port /dev/ttyUSB0 --baud 115200 </code> |
| - | Get ~10 seconds of data then hit Ctrl+C. The script will automatically save the collected data into ''raw_data_label_0.csv'' | + | Get ~10 seconds of data then hit Ctrl+C. The script will automatically save the collected data into ''raw_data_label0.csv'' |
| === Run B: "shake" capture (label = 1) === | === Run B: "shake" capture (label = 1) === | ||
| Line 98: | Line 98: | ||
| Run script #2 that logs with label shaking: | Run script #2 that logs with label shaking: | ||
| - | ''> python collect_data.py -shaking --port /dev/ttyUSB0 --baud 115200'' | + | <code> > python3 collect_data.py -shaking --port /dev/ttyUSB0 --baud 115200 </code> |
| - | Get ~10 seconds of data then hit Ctrl+C. The script will automatically save the collected data into ''raw_data_label_1.csv'' | + | Get ~10 seconds of data then hit Ctrl+C. The script will automatically save the collected data into ''raw_data_label1.csv'' |
| - | Then we’ll merge the two CSVs in the next step. | + | Then, we’ll merge the two CSVs in the next step. |
| ==== 4. Training the model ==== | ==== 4. Training the model ==== | ||
| Line 125: | Line 125: | ||
| Your final project structure should look like this: | Your final project structure should look like this: | ||
| + | <code> | ||
| include/ | include/ | ||
| - | |-LSM6DSL.h | + | |-LSM6DSL.h |
| - | |-model.h | + | |-model.h |
| src/ | src/ | ||
| - | |-LSM6DSL.cpp | + | |-LSM6DSL.cpp |
| - | |-main.cpp | + | |-main.cpp |
| platformio.ini | platformio.ini | ||
| + | </code> | ||
| When it’s running: | When it’s running: | ||
| * Keep the board still → LED should be off (prob_shake < 0.5). | * Keep the board still → LED should be off (prob_shake < 0.5). | ||
| * Shake the board → LED should go green (prob_shake > 0.5). | * Shake the board → LED should go green (prob_shake > 0.5). | ||