I cant measure vibration using an adxl345 when i turn on the motor

i want to mesure a motor's vibration
so i put adxl on the top and side of the motor, and turned on the motor and tried to watch serial monitor
but when motor begins to rotate, it stopped to send data.
ho can i fix that?

here's the code what i used

#include <Wire.h> //horizental
#define I2C_Address 0x53
//ADXL345 register address
#define POWER_CTL 0x2D
#define DATA_FORMAT 0x31
#define X_axis 0x32
#define Y_axis 0x34
#define Z_axis 0x36
#define Range_2g 0
#define Range_4g 1
#define Range_8g 2
#define Range_16g 3
void setup() {
 Wire.begin(); // 센서 작동 시작
 Serial.begin(9600); // 통신속도 9600으로 설정
 Init_ADXL345(Range_4g);
 Serial.println("CLEARDATA");
 Serial.println("X,Y,Z");
}
void loop() {
 //3축 출력
 Serial.print("DATA,");
 Serial.print(Read_Axis(X_axis));
 Serial.print(", ");
 Serial.print(Read_Axis(Y_axis));
 Serial.print(", ");
 Serial.print(Read_Axis(Z_axis));
Serial.println();
 delay(20);
}
//I2C인터페이스를 통해 축을 읽음
int Read_Axis(byte a) {
 int data;
 Wire.beginTransmission(I2C_Address);
 Wire.write(a);
 Wire.endTransmission();
 Wire.beginTransmission(I2C_Address);
 Wire.requestFrom(I2C_Address, 2);
 if (Wire.available()) {
 data = (int)Wire.read();
 data = data | (Wire.read() << 8);
 }
 else {
 data = 0;
 }
 Wire.endTransmission();
 return data;
}
//ADXL345 초기화
void Init_ADXL345(byte r) {
 Wire.beginTransmission(I2C_Address);
 //감도설정
 Wire.write(DATA_FORMAT);
 Wire.write(r);
 Wire.endTransmission();
 //측정모드로 전환
 Wire.beginTransmission(I2C_Address);
 Wire.write(POWER_CTL);
 Wire.write(0x08);
 Wire.endTransmission();
}

Welcome to the forum

As your topic does not relate directly to the installation or operation of the IDE it has been moved to the Programming Questions category of the forum

I see no reference to any type of motor in your code. How do you have the motor wired up? Is it something that you control outside of this code?

Your motor is a huge magnetic field generator. As the motor turns the magnetic field also rotates and overwhelms the adxl sensor.

i used 200W 3phase motor. is there other informations u need? i patched 345 like this

ok then wrapping senors by aluminium is gonna be proper solution right?

Only wrap with iron will limit the magnetic field, not eliminate it. Aluminum has no effect, as you learned in school.

At what RPM range are you expecting it to work? The ADXL345 has a limited measurement bandwidth, and probably won't give meaningul results at much over ~1kHz vibration frequency. That would suggest, at best, perhaps 1000 RPM.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.