Hi,
For a school project, we are using a MPU-6050 accelerometer which is placed under a headband (on the users forehead), and a vibrating source (on the back of the head) which is held tightly conjoined with the same headband that the accelerometer is underneath. The vibrating source is secured so it doesn't move during testing.
Basically, we know that the vibrating source produces a sine wave. Right now, I am using a 3rd-Party app named PuTTY, which basically allows me to save data directly as a txt. file from the Arduino. The system on the back of the head vibrates at 60Hz. Research shows that sampling rate should be about 4ish times higher than real frequency vibration, so I am sampling at 4ms. We are doing this in the time domain.
This is my code `#include <Wire.h>
#define MPU_ADDR 0x68 // MPU-6050 I2C address
int16_t ax, ay, az;
void setup() {
Serial.begin(2000000);
Wire.begin();
Wire.beginTransmission(MPU_ADDR);
Wire.write(0x6B); // PWR_MGMT_1 register
Wire.write(0); // set to zero (wakes up the MPU-6050)
Wire.endTransmission(true);
// Configure accelerometer range to ±4g
Wire.beginTransmission(MPU_ADDR);
Wire.write(0x1C); // ACCEL_CONFIG register
Wire.write(0x08); // Set to 0x08 for ±4g range
Wire.endTransmission(true);
}
void loop() {
Wire.beginTransmission(MPU_ADDR);
Wire.write(0x3B); // starting with register 0x3B (ACCEL_XOUT_H)
Wire.endTransmission(false);
Wire.requestFrom(MPU_ADDR, 6, true); // request 6 bytes (3 axis acceleration data)
// Read the acceleration data from the sensor
ax = Wire.read() << 8 | Wire.read();
ay = Wire.read() << 8 | Wire.read();
az = Wire.read() << 8 | Wire.read();
// Amplify the acceleration values in the x and y directions
float amplified_ax = (ax / 16384.0) * 100;
float amplified_ay = (ay / 16384.0) * 100;
float amplified_az = (az / 16384.0) * 100;
// Output the amplified acceleration values in a single line separated by commas
Serial.print(amplified_ax, 4);
Serial.print(",");
Serial.print(amplified_ay, 4);
Serial.print(",");
Serial.println(amplified_az, 4);
delay(4);
}
`
There are a few issues we are encountering
- We run 1min tests, hoping for 15000 samples (4ms sampling rate) within this time. We never seem to return the 15000 samples. It's often more around a 7-8ms sampling rate.
- As I said earlier, the device has an expected sine wave output. I don't believe the reading across the head is effecting this. There is an artificial mastoid system here: [Artificial Mastoid | Type 4930 | Brüel & Kjær] which is used in the calibration of hearing aids. We use this system, we get a sine wave output from it.
This is the desired output.
This is what we're getting.
- I am using an MPU60-50 accelerometer, which should be good enough to detect this vibration. I am using it also with an Arduino uno. I am using these cables as a connection. https://www.amazon.com/gp/product/B07GD2RP9C/ref=ppx_yo_dt_b_asin_title_o08_s00?ie=UTF8&psc=1
Noted, I am also only using the VCC,GND SCL, SDA pins of the accelerometer. There are XDA,XCL,ADC,INT pins being unused currently.
Any response is truly appreciated