Help for school project

Hello everyone, like th title says, i need help for a school project.
The project consists on a device you have in your head(via a hat or helmet) that can detect when you stand up from a stitting position.

My teacher suggested me to try the mpu6050 (gyro and accelerometer) to detect the movement of the person standing up, i tryed and it doesn't seem possible, the values i get seem too random. Tell me if im wrong.

Does anyone has any suggestions?

Thank you! :slight_smile:

Post your code, post your results, post your schematic

Start by installing an MP6050 library and looking at the examples that come with it

The code is simple, just to read data from the sensor:

#include <MPU6050_light.h>
#include <Wire.h>

MPU6050 sensorAccGyro(Wire);

void setup() {
  Serial.begin(9600);
  Wire.begin();
  sensorAccGyro.begin();
  sensorAccGyro.calcOffsets(true, true);
}

void loop() {
  sensorAccGyro.update();

  float angleX = sensorAccGyro.getAngleX();
  float angleY = sensorAccGyro.getAngleY();
  float angleZ = sensorAccGyro.getAngleZ();

  Serial.print("X : ");
  Serial.print(angleX);
  Serial.print("\tY : ");
  Serial.print(angleY);
  Serial.print("\tZ : ");
  Serial.println(angleZ);
}

And here's the data via plotter:

Sorry for the spam i can only post one picture per post

Anyway, this sensor doesn't seem like a good solution for my problem. I'm thinking about taking another approach and looking for suggestions that's why I'm posting.

When you said the results were random, I assumed they were, well, completely aleatory, and that you'd done something wrong with your code.
However, you did seem to have correlated results - what were you expecting?

I have not used such a sensor but I am disturbed by the choice of its place - on the head !? Wouldn't it be better on the dupe (or at least close to it) for this purpose? Also, if I understand your program correctly, you only read the angular deviations from the gyroscope. It seems more logical for me to read the accelerations from the accelerometer (for just getting up and sitting).

I see your point, i didn't provide a very clear explanation, sorry about that.

The measurements vary a lot from person to person, and head movements can be detected as "standing up". I don't think the mpu6050's values are reliable to detect when a person stands up.

Maybe if i use it as a pedometer. But I would prefer a more immediate detection.

The place is not up to me, but you have a point, the readings are hard to interpret.

I'll give the accelerometer a try. thank you.

I would try a barometer/altimeter. It might be sensitive enough to detect a sudden change in altitude.

The TDK ICP-10125 is accurate to 0.0001 PSI
The STMicroelectronics LPS25HBTR is accurate to 0.003 PSI.

They are surface-mount device so look for a "breakout board" or "module" to simmplify connections.

Thank you john, I'll look into it :slight_smile:

hello, you can use this mpu6050 sensor with a different angle. horizontally or vertically. you may get the result by the hit and trail method with this sensor. you can refer to our one of the article " Gesture control car". but I am using here ADX accelerometer sensor with the Arduino.

The MPU-6050 fairly reliably does what it is intended to do, which is to report rotation rates and accelerations.

Your problem is the choice of measurement technique, and how to discriminate "standing up" motions from other possible motions. With the MPU-6050, that seems to be a very difficult problem. A different approach might make this much easier.