lab 6
Dependencies: ADXL362 mbed MPL3115A2
report.txt
- Committer:
- htdoughe
- Date:
- 2018-03-09
- Revision:
- 33:5df68b9e96de
- Parent:
- 31:c924aad0dc4b
File content as of revision 33:5df68b9e96de:
# Documentation for Vibration Detection Our algorithm is fairly simple right now; it measures knocks by comparing x, y, and z values to an initial baseline set of values. When the program starts, it saves initx, inity, and initz (uint8_t values); these are the initial baseline values for each axis of measurement for the accelerometer. The program then enters a perpetual while loop that measures x, y, and z and compares those new measurements to their respective initial values. If any of these measured values vary from their initial values by more than 2 (in either a positive or negative direction), the LED lights for 2 seconds and measurement pauses. After those 2 seconds, measurement resumes. This algorithm assumes 2 main things about the evironment: that any knock is significant enough to change the measured value from the initial value by at least 3, and that the baseline does not change (that is, that the board's orientation is fixed during program execution). # Documentation on Altimeter Measurement Our altimeter code (measureAlt()) reports the atmospheric pressure in Hecto-Pascals and temperature in Celcius, retrieved from the appropriate registers at a rate of 10Hz. The function saves the first 1000 measurements into an array of doubles (doubles being the returned values of both our pressure and temperature measurements), arranged in order of measurement. (data[0] is the first pressure measurement, data[1] the first temperature measurement, data[2] is the second pressure measurement, and so on.) If the buffer is filled or a keypress is registered from the PC, measureAlt() stops measuring and shows a basic input prompt, "p%". If the interrupt was from a keypress, the key pressed is echoed as well. If the user types 'p' and then 'enter', the measurements taken are printed to the terminal in the following format: %PRESSURE% %TEMPERATURE%\n\r (Example actual output is shown below.) Once the measured values have been printed, the function exits successfully. #A note on our implementation Currently, our code does not include the GPIO pin at the moment because screen breaks when it is added. We are trying to figure out what's wrong, but that is an issue. example output: 986.000000 22.250000 986.000000 22.187500 986.000000 22.187500 986.000000 22.125000 986.000000 22.250000 986.000000 22.250000 987.000000 22.312500 986.000000 22.250000 986.000000 22.250000 986.000000 22.250000 986.000000 22.312500 987.000000 22.375000 986.000000 22.125000 986.000000 22.187500 987.000000 22.375000 986.000000 22.187500 987.000000 22.312500 986.000000 22.312500 987.000000 22.312500 987.000000 22.312500 986.000000 22.187500 986.000000 22.125000 986.000000 22.250000 986.000000 22.187500 987.000000 22.250000 987.000000 22.187500 986.000000 22.187500 986.000000 22.125000 987.000000 22.250000 987.000000 22.312500 986.000000 22.125000 987.000000 22.375000 987.000000 22.312500 986.000000 22.187500 987.000000 22.312500 987.000000 22.375000 987.000000 22.250000 986.000000 22.125000 986.000000 22.187500 987.000000 22.375000 986.000000 22.250000 986.000000 22.187500 986.000000 22.125000 987.000000 22.250000 987.000000 22.312500 987.000000 22.375000 986.000000 22.187500 987.000000 22.437500 987.000000 22.250000 987.000000 22.250000 987.000000 22.250000 986.000000 22.250000 987.000000 22.375000 986.000000 22.250000 987.000000 22.312500 986.000000 22.125000