LogoLogo
HomeDocsAPI & SDKsProjectsForumStudio
  • Welcome
    • Featured Machine Learning Projects
      • Getting Started with the Edge Impulse Nvidia TAO Pipeline - Renesas EK-RA8D1
      • Smart City Traffic Analysis - NVIDIA TAO + Jetson Orin Nano
      • ROS 2 Pick and Place System - Arduino Braccio++ Robotic Arm and Luxonis OAK-D
      • Optimize a cloud-based Visual Anomaly Detection Model for Edge Deployments
      • Rooftop Ice Detection with Things Network Visualization - Nvidia Omniverse Replicator
      • Surgery Inventory Object Detection - Synthetic Data - Nvidia Omniverse Replicator
      • NVIDIA Omniverse - Synthetic Data Generation For Edge Impulse Projects
      • Community Guide – Using Edge Impulse with Nvidia DeepStream
      • Computer Vision Object Counting - Avnet RZBoard V2L
      • Gesture Appliances Control with Pose Detection - BrainChip AKD1000
      • Counting for Inspection and Quality Control - Nvidia Jetson Nano (TensorRT)
      • High-resolution, High-speed Object Counting - Nvidia Jetson Nano (TensorRT)
    • Prototype and Concept Projects
      • Renesas CK-RA6M5 Cloud Kit - Getting Started with Machine Learning
      • TI CC1352P Launchpad - Getting Started with Machine Learning
      • OpenMV Cam RT1062 - Getting Started with Machine Learning
      • Getting Started with Edge Impulse Experiments
  • Computer Vision Projects
    • Workplace Organizer - Nvidia Jetson Nano
    • Recyclable Materials Sorter - Nvidia Jetson Nano
    • Analog Meter Reading - Arduino Nicla Vision
    • Creating Synthetic Data with Nvidia Omniverse Replicator
    • SonicSight AR - Sound Classification with Feedback on an Augmented Reality Display
    • Traffic Monitoring - Brainchip Akida
    • Multi-camera Video Stream Inference - Brainchip Akida
    • Industrial Inspection Line - Brainchip Akida
    • X-Ray Classification and Analysis - Brainchip Akida
    • Inventory Stock Tracker - FOMO - BrainChip Akida
    • Container Counting - Arduino Nicla Vision
    • Smart Smoke Alarm - Arduino Nano 33
    • Shield Bot Autonomous Security Robot
    • Cyclist Blind Spot Detection - Himax WE-I Plus
    • IV Drip Fluid-Level Monitoring - Arduino Portenta H7
    • Worker PPE Safety Monitoring - Nvidia Jetson Nano
    • Delivered Package Detection - ESP-EYE
    • Bean Leaf Disease Classification - Sony Spresense
    • Oil Tank Measurement Using Computer Vision - Sony Spresense
    • Object Counting for Smart Industries - Raspberry Pi
    • Smart Cashier with FOMO - Raspberry Pi
    • PCB Defect Detection with Computer Vision - Raspberry Pi
    • Bicycle Counting - Sony Spresense
    • Counting Eggs with Computer Vision - OpenMV Cam H7
    • Elevator Passenger Counting - Arduino Nicla Vision
    • ESD Protection using Computer Vision - Seeed ReComputer
    • Solar Panel Defect Detection - Arduino Portenta H7
    • Label Defect Detection - Raspberry Pi
    • Dials and Knob Monitoring with Computer Vision - Raspberry Pi
    • Digital Character Recognition on Electric Meter System - OpenMV Cam H7
    • Corrosion Detection with Computer Vision - Seeed reTerminal
    • Inventory Management with Computer Vision - Raspberry Pi
    • Monitoring Retail Checkout Lines with Computer Vision - Renesas RZ/V2L
    • Counting Retail Inventory with Computer Vision - Renesas RZ/V2L
    • Pose Detection - Renesas RZ/V2L
    • Product Quality Inspection - Renesas RZ/V2L
    • Smart Grocery Cart Using Computer Vision - OpenMV Cam H7
    • Driver Drowsiness Detection With FOMO - Arduino Nicla Vision
    • Gastroscopic Image Processing - OpenMV Cam H7
    • Pharmaceutical Pill Quality Control and Defect Detection
    • Deter Shoplifting with Computer Vision - Texas Instruments TDA4VM
    • Smart Factory Prototype - Texas Instruments TDA4VM
    • Correct Posture Detection and Enforcement - Texas Instruments TDA4VM
    • Visual Anomaly Detection with FOMO-AD - Texas Instruments TDA4VM
    • Surface Crack Detection and Localization - Texas Instruments TDA4VM
    • Surface Crack Detection - Seeed reTerminal
    • Retail Image Classification - Nvidia Jetson Nano
    • SiLabs xG24 Plus Arducam - Sorting Objects with Computer Vision and Robotics - Part 1
    • SiLabs xG24 Plus Arducam - Sorting Objects with Computer Vision and Robotics - Part 2
    • Object Detection and Visualization - Seeed Grove Vision AI Module
    • Bike Rearview Radar - Raspberry Pi
    • Build a Self-Driving RC Vehicle - Arduino Portenta H7 and Computer Vision
    • "Bring Your Own Model" Image Classifier for Wound Identification
    • Acute Lymphoblastic Leukemia Classifier - Nvidia Jetson Nano
    • Hardhat Detection in Industrial Settings - Alif Ensemble E7
    • Motorcycle Helmet Identification and Traffic Light Control - Texas Instruments AM62A
    • Import a Pretrained Model with "Bring Your Own Model" - Texas Instruments AM62A
    • Product Inspection with Visual Anomaly Detection - FOMO-AD - Sony Spresense
    • Visual Anomaly Detection in Fabric using FOMO-AD - Raspberry Pi 5
    • Car Detection and Tracking System for Toll Plazas - Raspberry Pi AI Kit
    • Visual Anomaly Detection - Seeed Grove Vision AI Module V2
    • Object Counting with FOMO - OpenMV Cam RT1062
    • Visitor Heatmap with FOMO Object Detection - Jetson Orin Nano
    • Vehicle Security Camera - Arduino Portenta H7
  • Audio Projects
    • Occupancy Sensing - SiLabs xG24
    • Smart Appliance Control Using Voice Commands - Nordic Thingy:53
    • Glass Window Break Detection - Nordic Thingy:53
    • Illegal Logging Detection - Nordic Thingy:53
    • Illegal Logging Detection - Syntiant TinyML
    • Wearable Cough Sensor and Monitoring - Arduino Nano 33 BLE Sense
    • Collect Data for Keyword Spotting - Raspberry Pi Pico
    • Voice-Activated LED Strip - Raspberry Pi Pico
    • Snoring Detection on a Smart Phone
    • Gunshot Audio Classification - Arduino Nano 33 + Portenta H7
    • AI-Powered Patient Assistance - Arduino Nano 33 BLE Sense
    • Acoustic Pipe Leakage Detection - Arduino Portenta H7
    • Location Identification using Sound - Syntiant TinyML
    • Environmental Noise Classification - Nordic Thingy:53
    • Running Faucet Detection - Seeed XIAO Sense + Blues Cellular
    • Vandalism Detection via Audio Classification - Arduino Nano 33 BLE Sense
    • Predictive Maintenance Using Audio Classification - Arduino Nano 33 BLE Sense
    • Porting an Audio Project from the SiLabs Thunderboard Sense 2 to xG24
    • Environmental Audio Monitoring Wearable - Syntiant TinyML - Part 1
    • Environmental Audio Monitoring Wearable - Syntiant TinyML - Part 2
    • Keyword Spotting - Nordic Thingy:53
    • Detecting Worker Accidents with Audio Classification - Syntiant TinyML
    • Snoring Detection with Syntiant NDP120 Neural Decision Processor - Arduino Nicla Voice
    • Recognize Voice Commands with the Particle Photon 2
    • Voice Controlled Power Plug with Syntiant NDP120 (Nicla Voice)
    • Determining Compressor State with Audio Classification - Avnet RaSynBoard
    • Developing a Voice-Activated Product with Edge Impulse's Synthetic Data Pipeline
    • Enhancing Worker Safety using Synthetic Audio to Create a Dog Bark Classifier
  • Predictive Maintenance and Defect Detection Projects
    • Predictive Maintenance - Nordic Thingy:91
    • Brushless DC Motor Anomaly Detection
    • Industrial Compressor Predictive Maintenance - Nordic Thingy:53
    • Anticipate Power Outages with Machine Learning - Arduino Nano 33 BLE Sense
    • Faulty Lithium-Ion Cell Identification in Battery Packs - Seeed Wio Terminal
    • Weight Scale Predictive Maintenance - Arduino Nano 33 BLE Sense
    • Fluid Leak Detection With a Flowmeter and AI - Seeed Wio Terminal
    • Pipeline Clog Detection with a Flowmeter and AI - Seeed Wio Terminal
    • Refrigerator Predictive Maintenance - Arduino Nano 33 BLE Sense
    • Motor Pump Predictive Maintenance - Infineon PSoC 6 WiFi-BT Pioneer Kit + CN0549
    • BrickML Demo Project - 3D Printer Anomaly Detection
    • Condition Monitoring - Syntiant TinyML Board
    • Predictive Maintenance - Commercial Printer - Sony Spresense + CommonSense
    • Vibration Classification with BrainChip's Akida
    • AI-driven Audio and Thermal HVAC Monitoring - SeeedStudio XIAO ESP32
  • Accelerometer and Activity Projects
    • Arduino x K-Way - Outdoor Activity Tracker
    • Arduino x K-Way - Gesture Recognition for Hiking
    • Arduino x K-Way - TinyML Fall Detection
    • Posture Detection for Worker Safety - SiLabs Thunderboard Sense 2
    • Hand Gesture Recognition - OpenMV Cam H7
    • Arduin-Row, a TinyML Rowing Machine Coach - Arduino Nicla Sense ME
    • Fall Detection using a Transformer Model – Arduino Giga R1 WiFi
    • Bluetooth Fall Detection - Arduino Nano 33 BLE Sense
    • Monitor Packages During Transit with AI - Arduino Nano 33 BLE Sense
    • Smart Baby Swing - Arduino Portenta H7
    • Warehouse Shipment Monitoring - SiLabs Thunderboard Sense 2
    • Gesture Recognition - Bangle.js Smartwatch
    • Gesture Recognition for Patient Communication - SiLabs Thunderboard Sense 2
    • Hospital Bed Occupancy Detection - Arduino Nano 33 BLE Sense
    • Porting a Posture Detection Project from the SiLabs Thunderboard Sense 2 to xG24
    • Porting a Gesture Recognition Project from the SiLabs Thunderboard Sense 2 to xG24
    • Continuous Gait Monitor (Anomaly Detection) - Nordic Thingy:53
    • Classifying Exercise Activities on a BangleJS Smartwatch
  • Air Quality and Environmental Projects
    • Arduino x K-Way - Environmental Asthma Risk Assessment
    • Gas Detection in the Oil and Gas Industry - Nordic Thingy:91
    • Smart HVAC System with a Sony Spresense
    • Smart HVAC System with an Arduino Nicla Vision
    • Indoor CO2 Level Estimation - Arduino Portenta H7
    • Harmful Gases Detection - Arduino Nano 33 BLE Sense
    • Fire Detection Using Sensor Fusion and TinyML - Arduino Nano 33 BLE Sense
    • AI-Assisted Monitoring of Dairy Manufacturing Conditions - Seeed XIAO ESP32C3
    • AI-Assisted Air Quality Monitoring - DFRobot Firebeetle ESP32
    • Air Quality Monitoring with Sipeed Longan Nano - RISC-V Gigadevice
    • Methane Monitoring in Mines - Silabs xG24 Dev Kit
    • Smart Building Ventilation with Environmental Sensor Fusion
    • Sensor Data Fusion with Spresense and CommonSense
    • Water Pollution Detection - Arduino Nano ESP32 + Ultrasonic Scan
    • Fire Detection Using Sensor Fusion - Arduino Nano 33 BLE Sense
  • Novel Sensor Projects
    • 8x8 ToF Gesture Classification - Arduino RP2040 Connect
    • Food Irradiation Dose Detection - DFRobot Beetle ESP32C3
    • Applying EEG Data to Machine Learning, Part 1
    • Applying EEG Data to Machine Learning, Part 2
    • Applying EEG Data to Machine Learning, Part 3
    • Liquid Classification with TinyML - Seeed Wio Terminal + TDS Sensor
    • AI-Assisted Pipeline Diagnostics and Inspection with mmWave Radar
    • Soil Quality Detection Using AI and LoRaWAN - Seeed Sensecap A1101
    • Smart Diaper Prototype - Arduino Nicla Sense ME
    • DIY Smart Glove with Flex Sensors
    • EdgeML Energy Monitoring - Particle Photon 2
    • Wearable for Monitoring Worker Stress using HR/HRV DSP Block - Arduino Portenta
  • Software Integration Demos
    • Azure Machine Learning with Kubernetes Compute and Edge Impulse
    • ROS2 + Edge Impulse, Part 1: Pub/Sub Node in Python
    • ROS2 + Edge Impulse, Part 2: MicroROS
    • Using Hugging Face Datasets in Edge Impulse
    • Using Hugging Face Image Classification Datasets with Edge Impulse
    • Edge Impulse API Usage Sample Application - Jetson Nano Trainer
    • MLOps with Edge Impulse and Azure IoT Edge
    • A Federated Approach to Train and Deploy Machine Learning Models
    • DIY Model Weight Update for Continuous AI Deployments
    • Automate the CI/CD Pipeline of your Models with Edge Impulse and GitHub Actions
    • Deploying Edge Impulse Models on ZEDEDA Cloud Devices
Powered by GitBook
On this page
  • Introduction
  • DIY Flex Sensor
  • Velostat
  • Feature Construction
  • How long should N be?
  • Data Collection
  • Impulse Design
  • Deployment
  • Conclusion

Was this helpful?

Edit on GitHub
Export as PDF
  1. Novel Sensor Projects

DIY Smart Glove with Flex Sensors

Prototyping a smart glove for gesture recognition, using Velostat to make DIY flex sensors for HCI.

PreviousSmart Diaper Prototype - Arduino Nicla Sense MENextEdgeML Energy Monitoring - Particle Photon 2

Last updated 4 months ago

Was this helpful?

Created By: Simone Salerno

Demo Video:

Introduction

HCI (Human Computer Interaction) is an evolving topic these days that is finding its way into the life of many people, with a large application potential in the consumer, health, and assistive technology industries.

Free-form interfaces (for example, voice and gestures) have become ubiquitous and the cost of inclusion is getting lower and lower. One type of interface that may come handy in the bleeding-edge field of AR/VR, or in the health industry for low-mobility people, is one that uses finger and hand movement to interact with a device. Essentially: a smart glove.

A smart glove is one that is able to react to the movements of the fingers, by recognizing either their fixed position or moving patterns. In this project I'm going to build a flex smart glove - one that uses flex sensors on the fingers and an Edge Impulse TinyML model - with a BOM (Bill of Materials) that is less than $5 USD (excluding the microcontroller).

DIY Flex Sensor

change their resistance based on the amount of "bend" they're subjected to. Commercial flex sensors for the Arduino and embedded ecosystem exist, but they cost about $15 USD each. To cover all the fingers of a single hand it would thus cost 5 x 15, so approximately $75 USD. It may not be a prohibitive cost, but doing it yourself will cut this value down to just about one dollar USD.

Moreover, you can build flex sensors of the size you wish to use in other settings too (you could attach them to your arms or legs, for example).

Let's see how to build one!

Velostat

There are few materials that can be used to build a flex sensor by yourself. In this project, I selected because it is widely available and pretty cheap. An . It is a pressure-sensitive material that can react well to bending too.

Follow this YouTube video for a step by step tutorial:

You will then sew the bends to the glove to keep them in place.

Feature Construction

Since each finger has its own flex sensor, we'll be dealing with 5 axis of data. Considering that the user can perform both still positions and moving gestures, we need to collect data over time. If we collect N timesteps, our feature vector will be of size 5 x N.

Our DIY flex sensors, though, are not very precise. Relying on their absolute values alone could lead to bad results because they can vary based on the stretch force applied at rest state (e.g., how we wear the glove). This is why we are augmenting the input features by adding the cross-difference among each pair of fingers. The rationale behind this is to capture the relative position/movement of one finger from the others.

So, calling F1...F5 each finger's reading, a single row in the feature vector will be made of:

{F1, F2, F3, F4, F5, F1 - F2, F1 - F3, F1 - F4, F1 - F5, F2 - F3, F2 - F4, F2 - F5, F3 - F4, F3 - F5, F4 - F5}

(size 15)

The definitive input vector will be a matrix of 15 x N.

How long should N be?

The value of N depends on 2 factors:

  1. Gestures duration: how long (in seconds) is the longest gesture?

  2. Sampling frequency: how fast are you reading the flex sensors?

The faster you sample, the more granularity your data will have, but the larger the input vector (and the Edge Impulse model) will be! A good starting point is taking 100 samples/second. You can increase this value later if the model is not performing well.

How long should the longest gesture be? I recommend to start with short gestures of ~1 second. Once you have good results, you can try to increase the gesture complexity and duration. Also, start with repeating patterns (a.k.a. continuous motion), not "one-shot" gestures (they're harder to recognize).

Data Collection

To handle the sensor readings, we're going to create a Hand class: this will encapsulate the actual reading and cross-difference calculations. We're also adding exponential smoothing to eliminate high frequency fluctuations.

Create a file, I've called it hand.h, with the following:

#pragma once
#define NUM_VALUES (4 + 3 + 2 + 1)
#define SMOOTH 0.8f


class Hand {
  public:
    int16_t values[NUM_VALUES];

    /**
     * 
     */
    void begin() {
      pinMode(A0, INPUT);
      pinMode(A1, INPUT);
      pinMode(A2, INPUT);
      pinMode(A3, INPUT);

      for (int i = 0; i < NUM_VALUES; i++)
        values[0] = 0;
    }

    /**
     * 
     */
    void read() {
      // read
      float a = analogRead(A0);
      float b = analogRead(A1);
      float c = analogRead(A2);
      float d = analogRead(A3);

      // smooth
      a = a * SMOOTH + (1 - SMOOTH) * values[0];
      b = b * SMOOTH + (1 - SMOOTH) * values[1];
      c = c * SMOOTH + (1 - SMOOTH) * values[2];
      d = d * SMOOTH + (1 - SMOOTH) * values[3];

      // assign
      values[0] = a;
      values[1] = b;
      values[2] = c;
      values[3] = d;
      values[4] = a - b;
      values[5] = a - c;
      values[6] = a - d;
      values[7] = b - c;
      values[8] = b - d;
      values[9] = c - d;
    }

    /**
     * 
     */
    void print() {
      Serial.print(values[0]);

      for (int i = 1; i < NUM_VALUES; i++) {
        Serial.print(',');
        Serial.print(values[i]);
      }

      Serial.println();
    }
};

The collection sketch is very simple: we only capture data and print it to the Serial Monitor of the Arduino IDE in CSV format. This allows use of the edge-impulse-data-forwarder command line tool to import the data into Edge Impulse platform.

Here is the Sketch I've created:

#include "Hand.h"


Hand hand;


/**
 * 
 */
void setup() {
  delay(3000);
  Serial.begin(115200);
  
  hand.begin();
}


/**
 * 
 */
void loop() {
  hand.read();
  hand.print();  
  delay(10);
}

Upload the Sketch, start the tool and start performing each of the positions/gestures you want to recognize.

Impulse Design

Our data is a multi-axis time series. This usually means the processing block will be made of Spectral Features (FFT frequencies and their power spectrum).

For the Classifier, I opted for a fully connected network with 2 layers. As you can see from the confusion matrix, you can expect to achieve a very high score on all the gestures.

Deployment

After you have imported the downloaded zip as a library in the Arduino IDE, compile and upload the following Sketch:

#include <smart_glove_inferencing.h>

#include <eloquent.h>
#include <eloquent/tinyml/edgeimpulse.h>
#include <eloquent/tinyml/voting/quorum.h>
#include "Hand.h"

// Impulse actually runs EI model
Eloquent::TinyML::EdgeImpulse::Impulse impulse;
// ImpulseBuffer is a circular buffer to store
// the input values
Eloquent::TinyML::EdgeImpulse::ImpulseBuffer buffer;
// Quorum is a voting scheme that buffers multiple
// class labels and detects if the value is stable
// or is just a temporary mis-prediction
Eloquent::TinyML::Voting::Quorum<5> voting;
// Hand handles the sensor reading
Hand hand;


/**
 * 
 */
void setup() {
  delay(3000);
  Serial.begin(115200);
  Serial.println("init");
  
  hand.begin();
  // don't run the EI model at every new reading
  // but after a batch of 10
  buffer.batch(NUM_VALUES * 10);
  // in a votation of N, a label is
  // considered "stable" if at least N/2 + 1
  // labels are the same
  voting.atLeastMajority();
}


/**
 * 
 */
void loop() {
  hand.read();

  // when the batch is full, run prediction
  if (buffer.push(hand.values, NUM_VALUES)) {
    uint8_t classIdx = impulse.predict(buffer.values);
    int8_t stableClassIdx = voting.vote(classIdx);
    
    //Serial.print("(unstable) Predicted class: ");
    //Serial.println(impulse.getLabel());

    if (voting.isStable()) {
      Serial.print("(stable) Predicted class: ");
      Serial.println(impulse.getLabelOf(stableClassIdx));
      buffer.clear();
    }
  }
  else {
    // 100 Hz sampling frequency
    delay(10);
  }
}

The Sketch leverages a couple of helper classes from the EloquentArduino library:

  • ImpulseBuffer allows you to push values to a circular queue that will discard older values when new ones arrive

  • Quorum allows you to batch the latest N predictions and check that at least N/2 + 1 of them agree on the same label. This helps smooth out prediction noise.

Open the Serial Monitor and start moving your hand replicating the gestures you recorded.

Conclusion

Using this method, we successfully built a hand gesture recognition machine learning model out of Velostat pressure-sensitive conductive sheets. Dedicated and use-specific flex sensors do exist, but they are more costly. The flex sensor is able to identify and predict finger position relative to the other fingers, and classify accordingly. This creates the opportunity to recognize gestures and use them as an interface to devices.

Now move to the Deployment tab and download the project as an Arduino library. To run the model on our board, we're going to leverage the , which makes this a breeze.

View on GitHub
Flex sensors
Velostat
11"x11" sheet costs $5 USD on Adafruit
https://www.youtube.com/watch?v=FEPgLbPv6NM
EloquentArduino library