Measuring Hand Grip Strength with Flex Sensor on a Bluetooth connected mobile app using +1Sheeld+

Overview

Hand grip strength is a method to measure the progression of muscle strength. This project aims to indicate changes in hand strength during rehabilitation processes by measuring the muscle flex of the fingers of the human hand.

This project uses the 1Sheeld+ shield. The 1Sheeld+ is a new easily configured shield for Arduino. It is connected to a mobile app that allows the usage of all of Android smartphones’ capabilities such as LCD Screen, Accelerometer, Magnetometer, GSM, Wi-Fi, GPS, etc. into the Arduino sketch, according to its founders.

Hardware Used

  • Arduino Mega (Robotdyn)

  • 1Sheeld+
  • 
    
  • Flex Sensor
  • 
    
  • Resistors (10kΩ)
  • 
    
  • Dupont Jumper Wires
  • 
    
  • Breadboard
  • 
    
    

    Software Used

    Libraries Used

    • OneSheeld.h

    Application Description

    This project measures the hand grip intensity of the human hand using a flex sensor. The flex sensor is attached on the finger to measure the mobility of the finger. The strength can be measured by how long the grip is maintained.

    The 1Sheeld+ is programmed to show the intensity of the grip through a slider. The slider is found on the mobile application of the 1Sheeld+. It goes up or down, depending on the orientation of the flex sensor.

    Set-up The Hardware

    The image shown above is the schematic diagram for this project. The circuit shows the resistor configuration in series. The voltage across the flex sensor is determined by a voltage-divider connection. The voltage changes since the flex sensor produce a resistance value between 10kΩ and 35kΩ by bending. When the flex sensor is straight, the resistance value is near 10kΩ. Otherwise, when the flex sensor is at its maximum ability to bend, its resistance value is at 35kΩ.

     

    The 1Sheeld+ is an Arduino shield capable of using the sensors found on a mobile phone. These sensors include LCD Screen, Accelerometer, Magnetometer, GSM, Wi-Fi, GPS, etc. Integrating the sensors to the RobotDyn board is achieved using the 1Sheeld+ app and its own library.

    In the 1Sheeld+ board, a switch can be seen. This is the communication and upload switch. When uploading the code to the board, it is imperative that the switch must be favored to the upload part or SW. After uploading, turn the switch to HW, or communication, to allow the shield and the application to receive and transmit data.

    Set-Up the Software

    Sensor Calibration

    Before using the flex sensor to measure the grip strength, it is imperative that the user must calibrate the sensor to ensure accuracy in data acquisition.

    const int flexPin = A0; //pin A0 to read analog input
    
    //Variables:
    int value; //save analog value
    byte calib;
    int straight = 760;
    int bend = 980;
    
    void setup() {
      // put your setup code here, to run once:
    Serial.begin(9600); 
    }
    
    void loop() {
      // put your main code here, to run repeatedly:
    
      value = analogRead(flexPin);         //Read and save analog value from potentiometer
      Serial.println(value);               //Print value
      calib = map(value, straight, bend, 0, 255);//Map value 0-1023 to 0-255 (PWM)
      Serial.println(calib);
    }

    The code snippet shown above is where the sensor calibration occurs. In order to calibrate the sensor, record the analog value when the flex sensor is at a straight angle. Then, record the analog value when the flex sensor is at its maximum ability to bend.

    Once recorded, change the values of the straight and bend variables found in the earlier parts of the code. This is the minimum and maximum value of the analog data.

    After getting the said values, the map() method changes the range from the minimum and maximum values to the 0 to 255 value using accurate ratio and proportion techniques set by the Arduino IDE. The output of the map() function is the data that will appear in the slider located in the mobile app.

    Library Installation

    In this project, the library used is the OneSheeld library. This library can be installed using the library manager of the Arduino IDE.

    The library manager of the Arduino IDE is found on the Sketch tab. When clicked, a drop-down menu appears. Click “Include Libraries” and another drop-down menu appears. Click Manage Libraries to open the library manager.

    The image shown above is the library manager. Use the search bar to find OneSheeld. When the OneSheeld library appears, click the Install button located below the library’s written description. This allows the Arduino IDE to install the said library.

    Code Breakdown

     

    #include <OneSheeld.h>
    
    #define CUSTOM_SETTINGS
    #define INCLUDE_SLIDER_SHIELD
    //Constants:
    const int flexPin = A0; //pin A0 to read analog input
    
    //Variables:
    int value; //save analog value
    byte calib;
    int straight = 760;
    int bend = 980;
    
    void setup() {
    
      Serial.begin(9600);       //Begin serial communication
      OneSheeld.begin();
    
    }
    
    void loop() {
    
      value = analogRead(flexPin);         //Read and save analog value from potentiometer
      Serial.println(value);               //Print value
      calib = map(value, straight, bend, 0, 255);//Map value 0-1023 to 0-255 (PWM)
      Serial.println(calib);               //Print value
      Slider.setValue(calib);
      delay(1000);
    }

    The code used for this project is shown above. This is similar to the calibration code shown earlier. Its main difference is that the OneSheeld library is now initialized and the Slider shield is now included and defined in the code.

    In the setup function, the OneSheeld is turned on by using the OneSheeld.begin() method. This initializes the shield in order to transmit and receive the data to the mobile application.

    In the loop function, the only difference from the code used for sensor calibration is the Slider.setValue(). This method only accepts the data type known as the byte. The mapped analog value is transmitted to the slider using this method.

    1Sheeld+ Mobile Application

    Download the mobile application on Google Play Store.

    The 1Sheeld+ mobile app scans different 1Sheeld+ shields nearby using Bluetooth. Click Scan to find shields and connect.

    After connecting the mobile app and the shield, select the Slider option. Click the shield button located on the top-right portion of the screen, beside the 1Sheeld logo.

    The Slider screen appears. To ensure connectivity between the shield and the mobile app, click the orange button. This allows the user to connect or disconnect the connectivity at any time.

    References

     

     

     

     

     

    The post Measuring Hand Grip Strength with Flex Sensor on a Bluetooth connected mobile app using +1Sheeld+ appeared first on CreateLabz.

    1sheeld+ArduinoBendBleBluetoothFlexFlex sensorHand gripKnowledgebaseMegaOnesheeldRobotdynSlider

    Leave a comment

    All comments are moderated before being published