Project tutorial
Handstand Master

Handstand Master © Apache-2.0

Help to train and improve your handstand!

  • 850 views
  • 0 comments
  • 2 respects

Components and supplies

Apps and online services

About this project

Handstand Master

The project were built with arduino/genuino 101.

This board contains a device, called Intel Curie that contains a processor, bluetooth low energy, accelerometer and gyroscope.

The project was built for hackster.io contest on arduino/genuino 101 for the category healthcare.

It's all started as a way to develop a wearable for parkour capable of track and improve parkour movement.. than it become a wearable for improving handstand.

Handstand for preventive Healthcare

The device has been created to engage people on training every day with handstand!

It is a complicated and intense movement and a good exercise to get fit and be healthy: http://healthyliving.azcentral.com/many-benefits-handstands-health-8911.html

It is another fun way to stay fit.

The simple application I built, can track on each session:

  • number of handstands
  • how long the last handstand was
  • how long was the best handstand
  • how long was the medium of the hanstands
  • handstand total time position
a demo of the device

How does it work?

The application running on the 101, reads the position of the accelerometers and it creates a bluetooth LE device, with a specific characteristic code and type of value notify. The code on the 101 continually checks the accelerometer data: if something is changed between the previous reading and if the algorithm finds a new position: it sends an update through the bluetooth characteristic.

On the computer side, the application, connects to the arduino. Once connected if something is sent from the 101, an event is raised from the bluetooth stack and a callback in javascript called.

The callback reads the new information and with a simple algorithm establishes if the position received rappresent:

  • the start of the handstand: it save the start time of the movement and emits a sound
  • the end of the handstand: it updates the statistics and emits a different sound
  • something to ignore

Thanks to the "notify" configuration, there is no need from the html5 side, continually polls the device in order to receive updates: the bluetooth stacks do everything by themselves!

Build your own

  • Download the last Arduino ide.
  • Open the application , go on board manager and install the support for arduino/genuino 101.
  • Download the arduino code attached to this page and open it with arduino ide: compile and run!

Once deployed on the device...

  • unzip the archive attached
  • open the file main.html on Chrome (drag&drop inside the window the file)
  • in the page click on "connect", it should show a device called "handstan", it is the arduino
  • once connected click start notification
  • rotate the arduino you should see the data on the page updating and the message on the bottom change.

See the following images to understand how the html5 page interact with the device

Future improvements

I'm interested in this kind of tracking device. I do parkour and an help to improve my handstands is interesting.

The code on the arduino side is ok, the problem are in the dimensions of the device and the battery pack.

The device should stay in a strap around the ankle or put inside a pair of shoes, something like these:

The client app right now runs inside the browser of my mac, but with very few effort I can build a native android/ios app with same functionalities and add new functions like:

  • remember you to do handstands
  • challenge other players
  • make results online
  • etc

Other tests

At the beginning, before put all the efforts on the handstands, I was searching a way to track the quality of my parkour's jumps and so I've also created code to read accelerometer data in order to find jumps patterns..

The code is not working right now (maybe next months) but I did some video that sincronize the movement with accelerometer data:

It's interesting!

Code

Code for Genuino 101Arduino
This is the code running on the device.
It must be flashed on the arduino/genuino device
#include <CurieBLE.h>
#include "CurieIMU.h"

int lastOrientation = - 1; // previous orientation (for comparison)

BLEPeripheral blePeripheral;  // BLE Peripheral Device (the board you're programming)
BLEService handstandService("19B10000-E8F2-537E-4F6C-D104768A1214"); // B

// BLE LED Switch Characteristic - custom 128-bit UUID, read and writable by central
BLEIntCharacteristic handstandChar("19B10001-E8F2-537E-4F6C-D104768A1214", BLENotify);


void setup() {
  Serial.begin(9600); // initialize Serial communication
  //while (!Serial);    // wait for the serial port to open

  // initialize device
  Serial.println("Initializing IMU device...");
  CurieIMU.begin();

  blePeripheral.setLocalName("Handstan");
  blePeripheral.setAdvertisedServiceUuid(handstandService.uuid());

  // add service and characteristic:
  blePeripheral.addAttribute(handstandService);
  blePeripheral.addAttribute(handstandChar);

  blePeripheral.begin();

  // Set the accelerometer range to 2G
  CurieIMU.setAccelerometerRange(2);
}

void loop() {
int orientation = -1;   // the board's orientation
  String orientationString; // string for printing description of orientation
  /*
    The orientations of the board:
    0: flat, processor facing up
    1: flat, processor facing down
    2: landscape, analog pins down
    3: landscape, analog pins up
    4: portrait, USB connector up
    5: portrait, USB connector down
  */
  // read accelerometer:
  int x = CurieIMU.readAccelerometer(X_AXIS);
  int y = CurieIMU.readAccelerometer(Y_AXIS);
  int z = CurieIMU.readAccelerometer(Z_AXIS);

  // calculate the absolute values, to determine the largest
  int absX = abs(x);
  int absY = abs(y);
  int absZ = abs(z);

  if ( (absZ > absX) && (absZ > absY)) {
    // base orientation on Z
    if (z > 0) {
      orientationString = "up";
      orientation = 0;  
    } else {
      orientationString = "down";
      orientation = 1;
    }
  } else if ( (absY > absX) && (absY > absZ)) {
    // base orientation on Y
    if (y > 0) {
      orientationString = "digital pins up";
      orientation = 2;
    } else {
      orientationString = "analog pins up";
      orientation = 3;
    }
  } else {
    // base orientation on X
    if (x < 0) {
      orientationString = "connector up";
      orientation = 4;
    } else {
      orientationString = "connector down";
      orientation = 5;
    }
  }

  // if the orientation has changed, print out a description:
  if (orientation != lastOrientation) {
    Serial.println(orientationString);
    lastOrientation = orientation;
    notifyUpdate(lastOrientation);
  }
}

/*updating bluetooth listeners*/
void notifyUpdate(int newOrientation) {
  handstandChar.setValue(newOrientation);
}
Html5 CodeArduino
Unzip the archive and launch the main.html file
No preview (download only).

Comments

Similar projects you might like

Master Clock

Project tutorial by Jed Hodson

  • 8,506 views
  • 4 comments
  • 12 respects

Blink master

Project tutorial by rmbyers

  • 2,191 views
  • 2 comments
  • 8 respects

Master Slave I2C Connection

by PIYUSH_K_SINGH

  • 3,737 views
  • 0 comments
  • 8 respects

Arduino101 / tinyTILE BLE: Match-Making Sunglasses

Project tutorial by Kitty Yeung

  • 11,336 views
  • 2 comments
  • 35 respects

Arduino 101 - Intel Curie Pattern Matching Dress

Project tutorial by Kitty Yeung

  • 9,460 views
  • 17 comments
  • 50 respects
Add projectSign up / Login