Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Jiong Shi
Published © MIT

A fall detection system based on Arduino, Windows and Azure

A fall detection system based on Arduino, Windows 10 and Microsoft Azure

AdvancedFull instructions provided2 hours46,692

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
HC-06 Bluetooth Module
×1
Adafruit ADXL345 accelerometer module
×1
Male-male and male-female jumper wires
×1
Mini-breadboard
×1
Lumia 1520 or other Windows Phone 10 compatible device
×1
ORICO Bluetooth module
×1

Software apps and online services

Windows 10 IoT Core
Microsoft Windows 10 IoT Core
Microsoft Azure
Microsoft Azure
Visual Studio 2015
Microsoft Visual Studio 2015
Arduino IDE
Arduino IDE

Story

Read more

Schematics

Complete Schematic

ADXL345 + HC-06

ADXL345

Sketch for ADXL345 Connection

HC-06

Sketch for Bluetooth Module Connection

Code

Arduino Sketch (ADXL345_HC06.ino)

Arduino
ADXL345 Accelrometer + HC-06 Bluetooth Module
#include <Wire.h>  
#include <String.h>  

#define Register_ID 0
#define Register_2D 0x2D
#define Register_X0 0x32
#define Register_X1 0x33
#define Register_Y0 0x34
#define Register_Y1 0x35
#define Register_Z0 0x36
#define Register_Z1 0x37


int ADXAddress = 0xA7 >> 1; 
int reading = 0;
int val = 0;
int X0, X1, X_out;
int Y0, Y1, Y_out;
int Z1, Z0, Z_out;
double Xg, Yg, Zg;

void setup()
{
  Serial.begin(9600);
  Wire.begin(); 
  delay(100);
  Wire.beginTransmission(ADXAddress);
  Wire.write(Register_2D);
  Wire.write(8);
  Wire.endTransmission();
}


void loop() {
  double tempx = 0;
  char strx[5];
  double tempy = 0;
  char stry[5];
  double tempz = 0;
  char strz[5];
  
  String gy;

  Wire.beginTransmission(ADXAddress);
  Wire.write(Register_X0);
  Wire.write(Register_X1);
  Wire.endTransmission();
  Wire.requestFrom(ADXAddress, 2);
  if (Wire.available() <= 2);
  {
    X0 = Wire.read();
    X1 = Wire.read();
    X1 = X1 << 8;
    X_out = X0 + X1;
  }

  Wire.beginTransmission(ADXAddress);
  Wire.write(Register_Y0);
  Wire.write(Register_Y1);
  Wire.endTransmission();
  Wire.requestFrom(ADXAddress, 2);
  if (Wire.available() <= 2);
  {
    Y0 = Wire.read();
    Y1 = Wire.read();
    Y1 = Y1 << 8;
    Y_out = Y0 + Y1;
  }

  Wire.beginTransmission(ADXAddress);
  Wire.write(Register_Z0);
  Wire.write(Register_Z1);
  Wire.endTransmission();
  Wire.requestFrom(ADXAddress, 2);
  if (Wire.available() <= 2);
  {
    Z0 = Wire.read();
    Z1 = Wire.read();
    Z1 = Z1 << 8;
    Z_out = Z0 + Z1;
  }

  Xg = X_out / 256.00; 
  Yg = Y_out / 256.00;
  Zg = Z_out / 256.00;
 
  if(Xg>0)
  {
    gy = String("")+ "x=+"+Xg;
  }
  else
  {
    gy = String("")+ "x="+Xg;
  }
  
  if(Yg>0)
  {
    gy += String("")+ "y=+"+Yg;
  }
  else
  {
    gy += String("")+ "y="+Yg;
  }
  
  if(Zg>0)
  {
    gy += String("")+ "z=+"+Zg+",";
  }
  else
  {
    gy += String("")+ "z="+Zg+",";
  } 
  
  Serial.print(gy);

}

Bluetooth Serial App

Communicates with Arduino via HC-06 bluetooth and sends ADXL345 data to Azure

FallDetectionClient

UWP client app for Fall Detection

Credits

Jiong Shi

Jiong Shi

13 projects • 85 followers
Microsoft Azure MVP

Comments