AI / ML Onboarding


Role Purpose

The AI/ML role focuses on transforming raw biomedical sensor data (from Arduino Nano 33 BLE Sense) into meaningful predictions, bridging data science and embedded systems. With this role, you will assist in enabling our projects to do things like detect heart rate, classify breathing patterns, or recognize voice commands. Through this onboarding and our projects you’ll learn how to:

  • Collect and clean biosignal data.
  • Extract features that highlight patterns in physiological signals.
  • Train machine learning models (locally or with Edge Impulse).
  • Deploy models efficiently onto microcontrollers for real-time inference.

Why This Role Matters

  • Raw data is meaningless until processed. AI/ML turns numbers into useful biomedical insights.
  • Real-time embedded ML unlocks portable medical tools (e.g., low-power sleep apnea detectors, stethoscopes, arrhythmia detection).
  • Your work ensures EMBS projects are smart, innovative, and impactful.

Onboarding Process

  1. Learn → Complete tutorials/resources.
  2. Learning Check → Google form submission.
  3. Demo → Successfully deploy and demonstrate EMG model.
  4. Review → Officer approves learning check submission, demo, and demo file submission.
  5. Role Assignment → Discord role updated to AI/ML
  6. Integration → Begin contributing ML models to real club projects.

Skills to Learn

Data Pipelines

  • How to collect sensor data from Arduino BLE Sense.
  • Cleaning noisy signals (filtering, normalization).
  • Labeling datasets for supervised ML tasks.

Feature Extraction

  • Time-domain: mean, variance, zero-crossings.
  • Frequency-domain: Fourier Transform (FFT), spectrograms.

ML Frameworks

  • Edge Impulse: beginner-friendly platform for embedded ML.
  • TensorFlow Lite Micro: running models directly on MCUs.
  • scikit-learn: simple Python models for rapid testing.

Embedded Deployment

  • Quantization: shrinking models for MCU use.
  • Model conversion: preparing .tflite files.
  • Loading models: deploying to Arduino BLE Sense.

Learning Tools

Data Pipelines (collect, clean, label sensor data)

Feature Extraction (turning raw data into inputs for ML)

ML Frameworks (training + testing models)

Embedded Deployment (making ML models run on tiny devices)


Learning Check

Complete this knowledge check using the materials above.


Demo

This part of the guide walks you through installing TensorFlow Lite Micro on Arduino, reading EMG data from a uMyo BLE sensor, training a simple ML model in Python, and running that model back on the Arduino.

Create Your Working Folder

  • Download and extract the master embs_ml_training folder and extract to location of your choosing
    • You’ll store all related files here: Arduino sketches, Python scripts, and EMG data.

Install TensorFlow Lite for Arduino

Open your terminal (or Git Bash) and run:
  • cd ~/Documents/Arduino/libraries or whatever path to your arduino libraries
  • git clone https://github.com/tensorflow/tflite-micro-arduino-examples.git
Check or Create the Version Header:
  • Go to the folder: Documents/Arduino/libraries/Arduino_TensorFlowLite/src/tensorflow/lite/
  • If you don’t see version.h, create it by copying and pasting the version.h file or by copying one of the other .h files and renaming it to version.h. Within this file, paste:
    
            #ifndef TENSORFLOW_LITE_VERSION_H_
            #define TENSORFLOW_LITE_VERSION_H_
            #define TFLITE_SCHEMA_VERSION (3)
            #endif  // TENSORFLOW_LITE_VERSION_H_
          
Verify Installation:
  • Open Arduino IDE → File → Examples → Arduino_TensorFlowLite
  • Try uploading an example (like hello_world).
  • If it compiles and uploads successfully, TensorFlow Lite is installed!
Note: This section helps you install the embedded ML framework that allows microcontrollers to run neural networks offline.In EMBS, this is crucial for real-time analysis of biosignals like EMG or ECG directly on the device without needing a laptop — improving portability and patient accessibility.

Set Up Mircophone Sensor Sensor

  • Wire the microphone to the arduino
  • Plug arduino and microphone into breadboard
  • Wire the 3.3V pin on the arduino to the red breadboard railing
  • Wire the ground pin on the arduino to the blue breadboard railing
  • Wire the A0 pin on the arduino to the OUT pin on the microphone (MAX4466)
  • Wire the VCC pin on the microphone to the red breadboard railing
  • Wire the GND pin on the microphone to the blue breadboard railing
  • Here is a completed wiring of the devices: Serial Monitor
  • Upload save the mic input folder to your computer
  • Open the mic_input.ino file
  • Plug in the USB cord from your computer to the arduino if you havent already
  • Upload the code to the arduino
  • Open Serial Monitor
  • Speak and hold the same volume into the microphone
    • You should see numbers changing. Serial Monitor
  • Switch to Serial Plotter to visualize it.
    • Values rise when you speak and fall when silent.
    • If no change, ensure your device is paired and connected via BLE. Serial Plotter
Note:This step introduces biosignal acquisition — how medical devices collect data from sensors. You learn how to interface sensors (like EMG or heart rate monitors) with microcontrollers, a key part of signal preprocessing and device calibration in biomedical systems.

Collect Microphone Data

  • Paste the code from the embs_data_collection.ino file in the embs_ml_training folder into the sketch and upload.
  • Download CoolTerm (free serial monitor): CoolTerm
  • Close Arduino’s Serial Monitor (only one app can use the port).
  • Open CoolTerm → Options → Serial Port → choose the same COM port you have been using Serial Port
  • Set the file capture to these settings File Capture
  • Click Connect, you should see live readings. Connect
  • Press Ctrl + R to start recording data and Press Ctrl + R again to stop recording
  • Flex and rest separately for 15–30 seconds each:
  • Turn off uMyo in between recordings to save battery.
Save 2 files in your embs_ml_training folder:
  • emg_rest.txt
  • emg_flex.txt
  • Open the text files and delete outliers from the start and end of your recordings
Note: This teaches data collection and labeling, fundamental for any ML-based medical device. You’re building a dataset, the same process used to train algorithms for diagnosing muscle disorders, hand tremors, or neural responses.

Train the Machine Learning Model

In terminal (inside your embs_ml_training folder), run:
  • pip install tensorflow pandas scikit-learn numpy matplotlib
  • pip install seaborn jupyter
  • Open train_emg_model.py (from the provided files or repo). Train EMG
Run this file in the terminal with:
  • python train_emg_model.py
The script will:
  • Read your data files.
  • Train a basic neural network.
  • Generate a model.h file for Arduino.
  • Create scalar_constants.txt with normalization values.
Note This teaches you model training and feature normalization, skills used in AI-driven biomedical devices (e.g., detecting arrhythmia or muscle fatigue). By training your own model, you understand how signal features (mean, RMS) translate into predictive patterns that help diagnose conditions or detect movement.

Deploy Model to Arduino

  • Copy model.h → into your Arduino sketch folder.
  • Open a new sketch and paste the code from emg_training.ino in the embs_ml_training folder given to you
Copy the scalar constants from scalar_constants.txt into your Arduino sketch:
  • float mean_mean = FILL HERE;
  • float std_mean = FILL HERE;
  • float mean_rms = FILL HERE;
  • float std_rms = FILL HERE;
  • Upload to Arduino.
Note:This step teaches embedded inference deployment — how trained AI models are run locally on devices like wearables. This is vital for real-time, low-power medical systems, such as prosthetic muscle control or heart rhythm monitoring.

Test the Model

  • Open Serial Monitor and flex or rest.
  • The output should indicate which state (rest, pinch, flex) is being recognized. Test Model
  • Demonstrate your working model to the club chair.
  • Submit all files used here.
Note: This stage demonstrates real-time device feedback, showing how sensors and ML models can work together.It’s the same process used in smart prosthetics, rehabilitation aids, and portable diagnostics, where user actions or biological changes trigger intelligent response