plot( freq_z, acc_z, label = 'z', linewidth = 0.5)Īs expected, peak accelerations on all three axis are observed at 90 Hz:ĭue to limitations of I2C bus, it is impossible to achieve high sampling rates using I2C interface. plot( freq_y, acc_y, label = 'y', linewidth = 0.5) plot( freq_x, acc_x, label = 'x', linewidth = 0.5) specgram( acc_data, Fs = sample_rate_Hz, NFFT = sample_rate_Hz * length_s) specgram( acc_data, Fs = sample_rate_Hz, NFFT = sample_rate_Hz * length_s)Īcc_z, freq_z, _ = mlab. specgram( acc_data, Fs = sample_rate_Hz, NFFT = sample_rate_Hz * length_s)Īcc_y, freq_y, _ = mlab. genfromtxt( 'out.csv', delimiter = ',', names = True)Īcc_x, freq_x, _ = mlab. system( f'sudo adxl345spi -t -s out.csv')Īcc_data = np. pyplot as plt sample_rate_Hz = 3200 length_s = 2 os. Import os import numpy as np from matplotlib import mlab import matplotlib. Peak acceleration is expected to be measured at 90 Hz: Accelerometer is wired according to a wiring diagram. Care must be taken to prevent shorting or contacting exposed components on the accelerometer board or the hard drive. ADX元45 accelerometer board is mounted to the body of the hard drive using a C-clamp. ![]() "SATA to USB adapter") is used to power the hard drive from a USB port of Raspberry Pi. This simple setup demonstrates how to use ADX元45 accelerometer in order to measure vibration spectrums.Ģ.5" 5400 RPM laptop hard drive is used as source of vibrations. Rotate the accelerometer around its x, y and z axis and observe acceleration values change accordingly from approximately -1.0 to +1.0. Values of x, y and z acceleration should appear to be non-zero. TestingĪccelerometer can be tested by running adxl345spi without arguments and verifying its output. Some ADX元45 breadboards have VCC pin marked as 3V3.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |