Best sensor for falling alert



  • My dad is having health issues and frequently falls. A number of times this has occurred without anyone's knowledge. I am going to build a sensor box to clip on his belt that will alert my mom by sms . It will send an email to the sms address of her phone, using their home wifi. I am considering the KY-020 TILT SWITCH but I am concerned about false alarms and wonder if it wouldn't be better to use an ultrasonic sensor that could be triggered by how fast the distance to a fixed object changes?? Ideas?



  • You need this type of sensor: https://en.wikipedia.org/wiki/Accelerometer

    MPU-6050 3 Axis Accelerometer + 3 Axis Gyro
    https://www.mysensors.org/store/motion



  • @bjacobse That seems to be the ticket! I will update the project as I learn more and develop a prototype.



  • To prevent false alarms is quite difficult,

    1. as you might think a high acceleration (during falling) and then no movement after he have fallen and lies on the floor.
    2. but false alarm could be he just sad down very quickly in the sofa and then relaxes
      how to distinguish between scenario 1 and 2 ?!?

    Maybe you also need to check his pulse?

    I don't have a google box, but can that be set to listen always, and if a sound similar to his fall are recorded then you shall be alerted?



  • At this point, nothing he does is quick, outside of falling. That should help reduce the possibility of false/positives. He also cannot lay flat on his back, so it may be as simple as finding that reading and creating a trigger. Thank you for your find. I am sure I can get that to work.



  • @bjacobse In the case of a google box, you would need something throughout the house, as well as in the garage and shop. A unit strapped to his belt that can reach wifi should work well. He does not leave the house without my mom, so she would be aware of his state while they are away from the house.


  • Admin

    many retirement homes here in Denmark, has special pressure sensitive floors, which can notify the staff if one of the elders have fallen. But that is probably a bit over the top, to put those into your parents house 🙂



  • @bjacobse I have done a little bit of work with the MPU-6050 IMU sensor (made a servo based 3 axis camera gimbal and a free-fall sensor for deploying a recovery parachute for my drone). I would think that with the MPU-6050 you should be able to distinguish between the two scenarios you mentioned. I can't say for sure, but if you looked at the data from the sensor in the two different scenarios I would think that you would be able to find some discernible difference and be able to code for that type of scenario. I think it would be worth doing some tests to see. The sensors are cheap.


  • Hardware Contributor

    There are accelerometers with built-in free fall detection, you should use one of those.



  • @nca78 said in Best sensor for falling alert:

    There are accelerometers with built-in free fall detection, you should use one of those.

    The MPU-6050 has built in free fall detection using an interrupt.


  • Hardware Contributor

    @dbemowsk said in Best sensor for falling alert:

    @nca78 said in Best sensor for falling alert:

    There are accelerometers with built-in free fall detection, you should use one of those.

    The MPU-6050 has built in free fall detection using an interrupt.

    I didn't know that, I'm not familiar with it.
    But except if there's an interest in using the gyroscope, IMHO it's a bit of an overkill, while a LIS3DH will use 50-100 times less current for free fall detection (between 6 and 11µA), ADXL345 over 10 times less (40µA)

    @mrhutchinsonmn you might be interested in this paper, which discusses a method to detect free fall with ADXL345. There are some interesting aspects including checking the orientation of sensor from static acceleration after a possible fall. I guess that's what you wanted to do initially with the tilt switch, but it's possible to get it from an accelerometer too and combine both free fall and orientation detection in one sensor.
    https://www.analog.com/en/analog-dialogue/articles/detecting-falls-3-axis-digital-accelerometer.html



  • @nca78 said in Best sensor for falling alert:

    a LIS3DH will use 50-100 times less current for free fall detection (between 6 and 11µA), ADXL345 over 10 times less (40µA)

    That is an excellent point. If using it for personal monitoring, quiescent current draw would definitely be a factor. The longer you can have the device last on a battery charge the better.

    I had just used the MPU-6050 for building a recovery parachute system for my drone in which I needed free fall detection, and it worked well which is why I commented on that one.



  • @nca78 said in Best sensor for falling alert:

    But except if there's an interest in using the gyroscope, IMHO it's a bit of an overkill, while a LIS3DH will use 50-100 times less current for free fall detection (between 6 and 11µA), ADXL345 over 10 times less (40µA)

    I agree with this also especially due to the low current consumption. I would not go as far as dismissing something as overkill when considering the intended usage though.

    I don't have experience with free fall detection systems but somehow it sounds more suitable for detecting a direct gravitational falling and not a person falling which likely involves legs slowing down and the fall starting from the person already standing on the ground. But I am definitely interested in hearing how this works out as this is one of those rare projects that isn't just a "nice to have". Great idea!



  • My sensors arrived in the mail the other day. For simplicity, I will be using the following devices:
    ESP8266 microcontroller NodeMCU Lua V3 WiFi with CH340G
    Wit-fancy Arduino GY-521 MPU-6050 Module 3 Axis analog gyro sensors 3 Axis Accelerometer Module

    Since my dad is not very mobile and will always be with my mom when they leave the house, I have the luxury of using their home wifi to send out alert messages and do not need to be concerned about sending alerts when they are away from the house.

    Hope to get started working through things in the next few days.



  • @mrhutchinsonmn said in Best sensor for falling alert:

    My sensors arrived in the mail the other day. For simplicity, I will be using the following devices:
    ESP8266 microcontroller NodeMCU Lua V3 WiFi with CH340G
    Wit-fancy Arduino GY-521 MPU-6050 Module 3 Axis analog gyro sensors 3 Axis Accelerometer Module
    ...
    Hope to get started working through things in the next few days.

    Good luck! I hope I won't sound pessimistic but I would suggest starting with measuring the power usage of the planned setup and/or testing if you can get it to acceptable level taking into account the battery you're planning to use. This way you'll be able to dismiss a particular sensor module (or the devboard) early on and not waste time figuring out how to get the fall detection code working with the setup.

    I've found power consumption to be one of the most difficult part when considering battery powered devices.



  • I am starting to ding around with my project, using the following tutorial sketch but getting an error and not finding how to fix it. Is it just a coding error?

    exit status 1
    'D6' was not declared in this scope```

    #include <Wire.h>
    
    // MPU6050 Slave Device Address
    const uint8_t MPU6050SlaveAddress = 0x68;
    
    // Select SDA and SCL pins for I2C communication 
    const uint8_t scl = D6;
    const uint8_t sda = D7;
    
    // sensitivity scale factor respective to full scale setting provided in datasheet 
    const uint16_t AccelScaleFactor = 16384;
    const uint16_t GyroScaleFactor = 131;
    
    // MPU6050 few configuration register addresses
    const uint8_t MPU6050_REGISTER_SMPLRT_DIV   =  0x19;
    const uint8_t MPU6050_REGISTER_USER_CTRL    =  0x6A;
    const uint8_t MPU6050_REGISTER_PWR_MGMT_1   =  0x6B;
    const uint8_t MPU6050_REGISTER_PWR_MGMT_2   =  0x6C;
    const uint8_t MPU6050_REGISTER_CONFIG       =  0x1A;
    const uint8_t MPU6050_REGISTER_GYRO_CONFIG  =  0x1B;
    const uint8_t MPU6050_REGISTER_ACCEL_CONFIG =  0x1C;
    const uint8_t MPU6050_REGISTER_FIFO_EN      =  0x23;
    const uint8_t MPU6050_REGISTER_INT_ENABLE   =  0x38;
    const uint8_t MPU6050_REGISTER_ACCEL_XOUT_H =  0x3B;
    const uint8_t MPU6050_REGISTER_SIGNAL_PATH_RESET  = 0x68;
    
    int16_t AccelX, AccelY, AccelZ, Temperature, GyroX, GyroY, GyroZ;
    
    void setup() {
      Serial.begin(9600);
      Wire.begin(sda, scl);
      MPU6050_Init();
    }
    
    void loop() {
      double Ax, Ay, Az, T, Gx, Gy, Gz;
      
      Read_RawValue(MPU6050SlaveAddress, MPU6050_REGISTER_ACCEL_XOUT_H);
      
      //divide each with their sensitivity scale factor
      Ax = (double)AccelX/AccelScaleFactor;
      Ay = (double)AccelY/AccelScaleFactor;
      Az = (double)AccelZ/AccelScaleFactor;
      T = (double)Temperature/340+36.53; //temperature formula
      Gx = (double)GyroX/GyroScaleFactor;
      Gy = (double)GyroY/GyroScaleFactor;
      Gz = (double)GyroZ/GyroScaleFactor;
    
      Serial.print("Ax: "); Serial.print(Ax);
      Serial.print(" Ay: "); Serial.print(Ay);
      Serial.print(" Az: "); Serial.print(Az);
      Serial.print(" T: "); Serial.print(T);
      Serial.print(" Gx: "); Serial.print(Gx);
      Serial.print(" Gy: "); Serial.print(Gy);
      Serial.print(" Gz: "); Serial.println(Gz);
    
      delay(100);
    }
    
    void I2C_Write(uint8_t deviceAddress, uint8_t regAddress, uint8_t data){
      Wire.beginTransmission(deviceAddress);
      Wire.write(regAddress);
      Wire.write(data);
      Wire.endTransmission();
    }
    
    // read all 14 register
    void Read_RawValue(uint8_t deviceAddress, uint8_t regAddress){
      Wire.beginTransmission(deviceAddress);
      Wire.write(regAddress);
      Wire.endTransmission();
      Wire.requestFrom(deviceAddress, (uint8_t)14);
      AccelX = (((int16_t)Wire.read()<<8) | Wire.read());
      AccelY = (((int16_t)Wire.read()<<8) | Wire.read());
      AccelZ = (((int16_t)Wire.read()<<8) | Wire.read());
      Temperature = (((int16_t)Wire.read()<<8) | Wire.read());
      GyroX = (((int16_t)Wire.read()<<8) | Wire.read());
      GyroY = (((int16_t)Wire.read()<<8) | Wire.read());
      GyroZ = (((int16_t)Wire.read()<<8) | Wire.read());
    }
    
    //configure MPU6050
    void MPU6050_Init(){
      delay(150);
      I2C_Write(MPU6050SlaveAddress, MPU6050_REGISTER_SMPLRT_DIV, 0x07);
      I2C_Write(MPU6050SlaveAddress, MPU6050_REGISTER_PWR_MGMT_1, 0x01);
      I2C_Write(MPU6050SlaveAddress, MPU6050_REGISTER_PWR_MGMT_2, 0x00);
      I2C_Write(MPU6050SlaveAddress, MPU6050_REGISTER_CONFIG, 0x00);
      I2C_Write(MPU6050SlaveAddress, MPU6050_REGISTER_GYRO_CONFIG, 0x00);//set +/-250 degree/second full scale
      I2C_Write(MPU6050SlaveAddress, MPU6050_REGISTER_ACCEL_CONFIG, 0x00);// set +/- 2g full scale
      I2C_Write(MPU6050SlaveAddress, MPU6050_REGISTER_FIFO_EN, 0x00);
      I2C_Write(MPU6050SlaveAddress, MPU6050_REGISTER_INT_ENABLE, 0x01);
      I2C_Write(MPU6050SlaveAddress, MPU6050_REGISTER_SIGNAL_PATH_RESET, 0x00);
      I2C_Write(MPU6050SlaveAddress, MPU6050_REGISTER_USER_CTRL, 0x00);
    }
    
    
    

  • Mod

    @mrhutchinsonmn what Arduino are you using?

    The sketch says you need to adjust for the right i2c pins.



  • Are you speaking of a comment made on the tutorial? I don't see that instruction in the sketch. I did try to change to numerical values for D1 & D2 but the error followed.


  • Mod

    @mrhutchinsonmn no, in the sketch.

    Select SDA and SCL pins for I2C communication



  • Isn't that what this is for?

    // Select SDA and SCL pins for I2C communication
    const uint8_t scl = D6;
    const uint8_t sda = D7;


  • Mod



  • I'm confused. That is from my sketch. Do I add another reference?


  • Mod

    @mrhutchinsonmn you change D6 and D7 to whatever the corresponding pins are for the Arduino you are using.



  • Those are the ports I am using on my ESP8266 NodeMCU


  • Mod

    @mrhutchinsonmn ok, so you're using an esp8266-based Arduino. ESP8266 does not have hardware i2c. Instead, software i2c is used. Almost any pins on the esp8266 can be used for i2c.

    What board have you selected in the Arudino IDE? If I select "NodeMCU 1.0 (ESP-12E module)", D6 and D7 are defined. If I select "generic esp8266 module", D6 and D7 are not defined since the pin mappings can be different for different boards.



  • Apologies!! I kept getting errors when using that board, so used another. I am on a new worksation and it turns out python was not installed. The error ceased after I installed. The sketch works fine now.



  • Not sure if it helps. I find this drop/tilt/vibration sensor https://bit.ly/2kZrZnV. And my personal advice is that you buy your dad a emergency watch with built-in heart rate detector. It would help a lot i think


  • Banned

    This post is deleted!

  • Banned

    This post is deleted!

Log in to reply
 

Suggested Topics

18
Online

11.4k
Users

11.1k
Topics

112.7k
Posts