This shows you the differences between two versions of the page.
|
iothings:laboratoare:2025:lab6 [2025/10/28 19:44] dan.tudose [How it actually runs in practice] |
iothings:laboratoare:2025:lab6 [2025/10/28 19:55] (current) dan.tudose [3. Logging training data] |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ===== What AI/ML + IoT actually is ===== | ===== What AI/ML + IoT actually is ===== | ||
| - | The Internet of Things (IoT) is about connecting physical objects — sensors, machines, vehicles, appliances — so they can collect and share data. AI and Machine Learning (ML) are what make that data useful. Instead of just measuring temperature, vibration, heart rate, traffic, etc., AI/ML can learn patterns from that data and make decisions: predict a failure, detect something abnormal, optimize energy use, or trigger an action automatically. So in short: IoT gives you data from the real world, AI/ML gives that data “brains.” | + | The Internet of Things (IoT) is about connecting physical objects — sensors, machines, vehicles, appliances — so they can collect and share data. AI and Machine Learning (ML) are what make that data useful. |
| + | |||
| + | Instead of just measuring temperature, vibration, heart rate, traffic, etc., AI/ML can learn patterns from that data and make decisions: predict a failure, detect something abnormal, optimize energy use, or trigger an action automatically. | ||
| + | |||
| + | So in short: IoT gives you data from the real world, AI/ML gives that data “brains.” | ||
| ===== Why we bother doing this ===== | ===== Why we bother doing this ===== | ||
| - | Adding AI/ML to IoT turns systems from reactive to proactive. A normal IoT sensor might tell you “motor temperature is high right now.” An ML-powered IoT system can say “this motor will likely overheat in 36 hours, schedule maintenance now.” That means less downtime in factories, smarter energy grids, safer cars, healthier patients, smoother logistics. You also get automation at scale: thousands or millions of devices making local decisions without a human in the loop, which is essential in smart homes, smart cities, agriculture, and industry. | + | Adding AI/ML to IoT turns systems from reactive to proactive. A normal IoT sensor might tell you “motor temperature is high right now.” |
| + | |||
| + | An ML-powered IoT system can say “this motor will likely overheat in 36 hours, schedule maintenance now.” That means less downtime in factories, smarter energy grids, safer cars, healthier patients, smoother logistics. | ||
| + | |||
| + | You also get automation at scale: thousands or millions of devices making local decisions without a human in the loop, which is essential in smart homes, smart cities, agriculture, and industry. | ||
| ===== How it actually runs in practice ===== | ===== How it actually runs in practice ===== | ||
| Line 81: | 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 90: | 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 114: | Line 122: | ||
| Download the main.cpp code from [[iothings:laboratoare:2025_code:lab6_4|here]]. | Download the main.cpp code from [[iothings:laboratoare:2025_code:lab6_4|here]]. | ||
| + | |||
| + | Your final project structure should look like this: | ||
| + | |||
| + | <code> | ||
| + | include/ | ||
| + | |-LSM6DSL.h | ||
| + | |-model.h | ||
| + | src/ | ||
| + | |-LSM6DSL.cpp | ||
| + | |-main.cpp | ||
| + | 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). | ||