fft
This section refers to the following sample application:
04-fft
Connecting the Boards
This application involves a mote interacting with an LIS331 Triple Axis Accelerometer over SPI.
You can purchase a breakout board for this accelerometer from Sparkfun (part number SEN-10345).
The following table lists how to connect the pins of this breakout board to the DC9003 mote.
SEN-10345 PIN | DC9003 PIN |
---|---|
GND | GND |
INT2 | DP1 |
INT1 | DP0 |
SDA | M_MOSI |
SCL | M_SCK |
SA0 | M_MISO |
CS | M_SS1n |
VCC | VSUPPLY |
Note: the code uses M_SS1n on header P2 to illustrate that multiple slaves can be hooked up using different slave selects.
Running the Application
The application adds two CLI commands. Each has no arguments.
sample
- this command triggers a 1024-point 16-bit acceleration sample to be taken at 1 kHz sample rate and prints the raw samples.fft
- this command computes a 1024-point Fast Fourier Transform (FFT) of the sample data, and then prints how long the FFT took, and the resulting real and imaginary vectors.
Details about the Application
The application shows that the mote can be used for vibration monitoring or other signal processing tasks at low power. While not shown in the example, the mote could easily be triggered based on an acceleration event and send the FFT data to an application. The program was written for a low memory footprint, not necessarily real-time performance (e.g. floating point operations are avoided where possible, single axis measurement), but at the current sample size and rate, realtime performance is possible. The figure below shows the on-chip computed results for a 440 Hz tuning fork applied to the z-axis of the accelerometer.