How can I detect changes in angle measurement given the x, y, and z from an accelerometer?

2 vues (au cours des 30 derniers jours)
DChoe
DChoe le 20 Avr 2017
Commenté : James Tursa le 24 Avr 2017
When I receive the csv file from a recording of an accelerometer, I don't know how to find the time periods when the accelerometer is not moving. For example, if the accelerometer is not moving initially and then moves to another position and returns to being static. I only want the data when the accelerometer is not moving, and I want the time period and the accompanying data for that time period. Is there a way to do this?
NOTE: the data from the accelerometer is never perfectly constant when static.
  3 commentaires
DChoe
DChoe le 24 Avr 2017
I have elapsed time, an x, y, and z. For the movement I'm looking at currently. The accelerometer is mounted on the end of a goniometer and then the goniometer arm is moved from one position to another. So almost like the accelerometer is on the end of an arm on a clock.
James Tursa
James Tursa le 24 Avr 2017
So this is translation and rotation on a plane horizontal surface? And you simply want to know when the motion of the arm has stopped?

Connectez-vous pour commenter.

Réponses (1)

Star Strider
Star Strider le 20 Avr 2017
I would first do a Fourier transform of your accelerometer signal with the fft (link) function to determine what the signal spectrum and noise spectrum are. Then design an appropriate filter (probably a bandpass filter if you also want to eliminate the constant z-axis gravity signal) using the designfilt function or other design procedures, such as the prototype included here.
The time vector will remain the same after your signal is filtered.
A prototype bandpass filter design using the individual function calls:
Fs = 250; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Wp = [60 120]/Fn; % Passband Frequencies (Normalized)
Ws = [59 121]/Fn; % Stopband Frequencies (Normalized)
Rp = 10; % Passband Ripple (dB)
Rs = 50; % Stopband Ripple (dB)
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % Filter Order
[c,b,a] = cheby2(n,Rs,Ws); % Filter Design
[sosbp,gbp] = zp2sos(c,b,a); % Convert To Second-Order-Section For Stability
figure(1)
freqz(sosbp, 2^16, Fs) % Bode Plot Of Filter
% set(subplot(2,1,1), 'XLim',[0 250]) % ‘Zoom’ X-Axis To See Passband
% set(subplot(2,1,2), 'XLim',[0 250]) % ‘Zoom’ X-Axis To See Passband
Make the appropriate changes in the sampling frequency and passband and stopband frequencies to filter your signal. Experiment to get the result you want.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by