DesignSpark Electrical Logolinkedin
Menu Search
Ask a Question

7 Mar 2019, 16:18

Wearable fall detector

Hello,

Here is my 3D printed fall detector wearable, created as an entry for the Wearable Technology Design Challenge here on Designspark. 

This project consist of multiple hardware components, software and 3D printed parts. 

This project consist of two parts: the Wearable and the Base station. Each has its own components and will be explained below: 

On the Wearable:
- Arduino
- Power input from the LiPo battery
- LiPo charging circuit
- Sensor
- Alarm button
- LED 
- Wireless transmitter

On the Base Station:
- Arduino
- Wireless receiver
- Neopixel LEDs 
- Cancel button
- Power input from usb power supply

Use Cases 

- Detect fall detection
The wearable will automatically send an alarm to the base station when the wearer falls. It will calculate that no false motions causes an alarm. 

- Fire/heating detection
The wearable will automatically send an alarm when the surrounding temperature increases.

- Send alarms 
The user can press the alarm button to generate an alarm that is send to the base station. 

- Cancel the alarms
All the alarms can be cancelled on the Base Station. 

Hardware

Arduino board

The Piksey Pico from BitsNBlobs Electronics is a small Arduino compatible development board. It is a small board that is only 20.3 mm x 20.3 mm which makes it ideal for this wearable project. The Piksey Pico board is a result of a successfully funded Kickstarter campaign, links of the campaign are linked below. I backed this project with two Pico boards and will use them in this project. The company will have a second Kickstarter campaign in the beginning of 2019 with additional boards. Their new campaign will be focused to deliver kits for people who want to learn coding and to work with electronics. This board is used in both the base station and wearable.

Sensor

The MPU6050 is a combined accelerometer, gyroscope and temperature sensor that is connected by I2C to the Arduino board. To detect a fall, the accelerometer and gyroscope are used. The temperature sensor will be used to send heat/fire alarms to the base station if there is a high variation in temperature. This sensor is programmed to use I2C address 0x68.

Battery + charging circuit

The wearable is powered by a 3.7V / 350mAh LiPo battery. To recharge and connect the battery to the TP4056 LiPo module to charge the battery. I shows the charging status on the onboard LEDs, warns the user if the battery is charged. It also has overcharge protection and a stable current and voltage during charging. The battery can now be charged by a micro-usb cable.

Alarm Button

On the wearable is an Alarm Button to let the user/wearer send an alarm to the base station. The Alarm LED will confirm that an Alarm is created locally on the wearable. This button is used to interrupt the fall-detection algorithm and directly send an alarm to the base station.

Wireless communication

I have experience with Bluetooth and Wifi in my Arduino boards, but for this project I will use something new; I have a FS1000A 433MHz transmitter and receiver here that I haven't used before. For personal learning skills I use this in this project. Bluetooth would be a good alternative, but the Bluetooth module I have is quite big by size. The 433MHz transmitter is only 20mmx20mm, which is an ideal size for the wearable. The downside of the 433MHz is that it require a 170mm antenna.

Base station

The basestation is used to receive the alarms from the wearable device. It uses the same Arduino board. It has the Receiver of the 433MHz connection connected and Neopixel LEDs to show the error and warning alerts. 

Cancel button

For both the base station and wearable a button is used to generate or cancel an alert. This is a normal press button, which is grounded and connected to a digital input on the Pico board. 

On the wearable is an Alarm Button to let the user/wearer send an alarm to the base station. The onboard LED will confirm that an Alarm is created. This button is used to interrupt the fall-detection algorithm and directly send an alarm to the base station.

On the base station the button is used to cancel the active alarms. This cancel button is used to interrupt the receiver to directly cancel the active call. 

3D printing

Now let's build the wearable! To create a device, I've drawn the all the parts, printed them and put them together. It is built so it's a modular system. If you want to add a module with a screen or an additional sensor it's just possible to add an extra module and place them between each part. In the video below you can see a time laps of drawing the parts in Fusion360.

The modular parts (without the connection printed connection pins):

I printed connection pins, in the shape of a pill to connect each part. It fits perfect :) 

Side with the velcro tape connection. The soft side is on the inside, it wears surprisingly comfortable! 

Software

All the software is programmed in the Arduino IDE. Below is the code in pieces shown for each function. 

Fall detection (on the wearable)

To detect if the user has fallen, an algorithm is used that combines the data from both the accelerometer and the gyroscope. Combining both sensors improves the sensibility to avoid false-positives and false-negatives. 

In the link below you can find the tutorial where this is explained. 

Temperature warning (on the wearable)

The temperature sensor data value needs to be converted and calibrated by the following:
tempC = Tmp/340.00+36.53;

Then in the loop() function, every measurement the temperature is read, and if it is above a hardcoded value, the alarm goes off. 
if(tempC >= 35)
{
int count = 0;
for (int i = 0; i<10; i++)
{
digitalWrite(AlarmLEDpin, HIGH);
delay(200);
digitalWrite(AlarmLEDpin, LOW);
delay(200);
}
}

Send manual alarm

The user has an option to send a manual alarm when he/she presses the alarm button on the wearable. The wearable is continuously scanning the sensor, to interfere this, the manual alarm will be based as an interrupt. The Arduino board has two interrupt pins (D2 and D3), which can be activated by a LOW, (HIGH), CHANGE, FALLING or RISING signal on this interrupt input. 

// declare the pins and state
const byte AlarmLEDpin = 16;
int AlarmButtonPin = 2;
volatile int buttonState = 0;

// in the setup(), configure the pins as input and output. 

// initialize the Alarm LED pin as an output:
pinMode(AlarmLEDpin, OUTPUT);
// initialize the alarm button pin as an input:
pinMode(AlarmButtonPin, INPUT);
// Attach an interrupt to the ISR vector
attachInterrupt(1, pin_ISR, RISING);

// this is the interrupt function, where the LED will toggle by each interrupt. 
void pin_ISR()
{
buttonState = !buttonState;
digitalWrite(AlarmLEDpin, buttonState);
Serial.println("-------- INTERRUPT");

// now send alarm message to base station
}

None of the interrupt code is written in the main loop() function. That function will just run until the interrupt is activated.

This interrupt functionality is used on both the Wearable and the Basestation. On the wearable the interrupt comes from the Alarm Button that generates an Alarm and sends the data.

On the Basestation the interrupt is used to cancel the call by the button, while in the loop the station waits for incoming messages. This system does not handle alarms asynchronous, so when a user cancels the call, another incoming call will be blocked for a few milliseconds since the receiving data is interrupted to cancel the call. 

Send data (from the wearable)

#include <VirtualWire.h>
char *text;
void setup()
{
pinMode(13,OUTPUT);
vw_set_ptt_inverted(true); 
vw_set_tx_pin(12);
vw_setup(4000);
}

void loop()
{
controller="Hello World";
vw_send((uint8_t *)text, strlen(text));
vw_wait_tx(); 
digitalWrite(13,1);
delay(2000);
}

Receive data (on the base station)

#include <VirtualWire.h>
void setup()
{
vw_set_ptt_inverted(true);
vw_set_rx_pin(12);
vw_setup(4000); 
pinMode(13, OUTPUT);
vw_rx_start(); 
}

void loop()
{
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;

if (vw_get_message(buf, &buflen)) 
{
if(buf[0]=='H'){
digitalWrite(13,1);

}
}

Show Alarm alerts on the LEDs (base station)

Below a code example for addressing Neopixels in an Arduino project. 

// include the Neopixel library
#include <Adafruit_NeoPixel.h>
// pin where the Neopixels are connected to
#define PIN 6
// Number of connected neopixels. 
#define NUMPIXELS 16
// create the strip
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

// in the Setup() function initializes the NeoPixel library by the .begin() command
pixels.begin(); 

// in the Loop() function, set a color for each led. Each led is addressed in a for loop. 
for(int i=0;i<NUMPIXELS;i++) {
// set for the LED 'i' the color to a RGB value from 0 - 255 for Red, Green and Blue color.pixels.setPixelColor(i, pixels.Color(0,150,0)); 
// show the updated pixel color to the hardware
pixels.show(); 
// Optionally set a delay (in ms) between each led within the for loop. 
delay(delayval); 

This code is used to turn the LEDs to RED when an Alarm message is received, and turned off when the cancel button is pressed. 

 

Demo

Video of the build process: 

Temperature warning: (gif)

 

(Links below opens the video from my Google Photos Drive, the links say 'download now, but it will open the video in the browser in this or a new tab) 

Temperature warning video: 

Fall detection video: 

 

Attachments

- 3D printing file
This file contains all the parts of the wearable. 

You can follow this project live,and download the current version (v9) here: 

https://a360.co/2TmJNIY 

Links:

Pico kickstarter campaign:
www.kickstarter.com/projects/1644070715/pico-the-worlds-smallest-arduino-328pb-core
Pico store
www.bitsnblobs.com/shop
Instructables - Fall Detector page
https://www.instructables.com/id/Emergency-Fall-Notifier-Cum-Panic-Button/


Kind regards,

Marcel Kruse
(marc3l)

ps, you can follow me on Twitter @marcelkruse

Test Engineer. Love to play with embedded hardware and software.

7 Mar 2019, 16:18

Comments

March 20, 2019 16:42

This is such a great idea!

0 Votes

March 19, 2019 07:28

I like the idea. This function is built into our Kenwood two-way radios. The interesting part is, the fall detector is larger than the two-way radio with the functions built in.
I still like the idea. See if you can shrink it to 15 mm diameter.

Leon

0 Votes

March 11, 2019 19:42

Congrats Marcel and well done on another brilliant idea.

0 Votes

March 11, 2019 19:42

Nice work. Where did you hide the antenna in the end? I was wondering whether you could get away with a 1/8λ dipole (total length 1/4λ) running along the side of the wristband. Other options are loads/coils but they often mean more bulk.

0 Votes