lab 6
Dependencies: ADXL362 mbed MPL3115A2
report.txt@33:5df68b9e96de, 2018-03-09 (annotated)
- Committer:
- htdoughe
- Date:
- Fri Mar 09 16:25:45 2018 +0000
- Revision:
- 33:5df68b9e96de
- Parent:
- 31:c924aad0dc4b
last tweaks to report
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
htdoughe | 12:c6b056ad171e | 1 | # Documentation for Vibration Detection |
htdoughe | 12:c6b056ad171e | 2 | |
htdoughe | 12:c6b056ad171e | 3 | Our algorithm is fairly simple right now; it measures knocks by comparing x, y, and z |
htdoughe | 12:c6b056ad171e | 4 | values to an initial baseline set of values. When the program starts, it saves |
htdoughe | 12:c6b056ad171e | 5 | initx, inity, and initz (uint8_t values); these are the initial baseline values for |
htdoughe | 12:c6b056ad171e | 6 | each axis of measurement for the accelerometer. The program then enters a |
htdoughe | 12:c6b056ad171e | 7 | perpetual while loop that measures x, y, and z and compares those new measurements |
htdoughe | 12:c6b056ad171e | 8 | to their respective initial values. If any of these measured values vary from their |
htdoughe | 12:c6b056ad171e | 9 | initial values by more than 2 (in either a positive or negative direction), the |
htdoughe | 12:c6b056ad171e | 10 | LED lights for 2 seconds and measurement pauses. After those 2 seconds, measurement |
htdoughe | 12:c6b056ad171e | 11 | resumes. |
htdoughe | 12:c6b056ad171e | 12 | |
htdoughe | 12:c6b056ad171e | 13 | This algorithm assumes 2 main things about the evironment: that any knock is |
htdoughe | 12:c6b056ad171e | 14 | significant enough to change the measured value from the initial value by at least 3, |
htdoughe | 12:c6b056ad171e | 15 | and that the baseline does not change (that is, that the board's orientation is fixed |
htdoughe | 29:f328fa35e8eb | 16 | during program execution). |
htdoughe | 29:f328fa35e8eb | 17 | |
htdoughe | 29:f328fa35e8eb | 18 | # Documentation on Altimeter Measurement |
htdoughe | 29:f328fa35e8eb | 19 | |
htdoughe | 30:9e127911409d | 20 | Our altimeter code (measureAlt()) reports the atmospheric pressure in Hecto-Pascals and |
htdoughe | 29:f328fa35e8eb | 21 | temperature in Celcius, retrieved from the appropriate registers at a rate of 10Hz. |
htdoughe | 29:f328fa35e8eb | 22 | The function saves the first 1000 measurements into an array of doubles (doubles being |
htdoughe | 29:f328fa35e8eb | 23 | the returned values of both our pressure and temperature measurements), arranged in |
htdoughe | 29:f328fa35e8eb | 24 | order of measurement. (data[0] is the first pressure measurement, data[1] the first |
htdoughe | 29:f328fa35e8eb | 25 | temperature measurement, data[2] is the second pressure measurement, and so on.) |
htdoughe | 29:f328fa35e8eb | 26 | |
htdoughe | 29:f328fa35e8eb | 27 | If the buffer is filled or a keypress is registered from the PC, measureAlt() stops |
htdoughe | 29:f328fa35e8eb | 28 | measuring and shows a basic input prompt, "p%". If the interrupt was from a keypress, |
htdoughe | 29:f328fa35e8eb | 29 | the key pressed is echoed as well. If the user types 'p' and then 'enter', the |
htdoughe | 29:f328fa35e8eb | 30 | measurements taken are printed to the terminal in the following format: |
htdoughe | 29:f328fa35e8eb | 31 | |
htdoughe | 29:f328fa35e8eb | 32 | %PRESSURE% %TEMPERATURE%\n\r |
htdoughe | 29:f328fa35e8eb | 33 | |
htdoughe | 29:f328fa35e8eb | 34 | (Example actual output is shown below.) |
htdoughe | 29:f328fa35e8eb | 35 | |
htdoughe | 29:f328fa35e8eb | 36 | Once the measured values have been printed, the function exits successfully. |
htdoughe | 29:f328fa35e8eb | 37 | |
htdoughe | 29:f328fa35e8eb | 38 | #A note on our implementation |
htdoughe | 33:5df68b9e96de | 39 | Currently, our code does not include the GPIO pin at the moment because screen |
htdoughe | 33:5df68b9e96de | 40 | breaks when it is added. We are trying to figure out what's wrong, but that is |
htdoughe | 33:5df68b9e96de | 41 | an issue. |
htdoughe | 31:c924aad0dc4b | 42 | |
htdoughe | 31:c924aad0dc4b | 43 | example output: |
htdoughe | 29:f328fa35e8eb | 44 | |
htdoughe | 31:c924aad0dc4b | 45 | 986.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 46 | 986.000000 22.187500 |
htdoughe | 31:c924aad0dc4b | 47 | 986.000000 22.187500 |
htdoughe | 31:c924aad0dc4b | 48 | 986.000000 22.125000 |
htdoughe | 31:c924aad0dc4b | 49 | 986.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 50 | 986.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 51 | 987.000000 22.312500 |
htdoughe | 31:c924aad0dc4b | 52 | 986.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 53 | 986.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 54 | 986.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 55 | 986.000000 22.312500 |
htdoughe | 31:c924aad0dc4b | 56 | 987.000000 22.375000 |
htdoughe | 31:c924aad0dc4b | 57 | 986.000000 22.125000 |
htdoughe | 31:c924aad0dc4b | 58 | 986.000000 22.187500 |
htdoughe | 31:c924aad0dc4b | 59 | 987.000000 22.375000 |
htdoughe | 31:c924aad0dc4b | 60 | 986.000000 22.187500 |
htdoughe | 31:c924aad0dc4b | 61 | 987.000000 22.312500 |
htdoughe | 31:c924aad0dc4b | 62 | 986.000000 22.312500 |
htdoughe | 31:c924aad0dc4b | 63 | 987.000000 22.312500 |
htdoughe | 31:c924aad0dc4b | 64 | 987.000000 22.312500 |
htdoughe | 31:c924aad0dc4b | 65 | 986.000000 22.187500 |
htdoughe | 31:c924aad0dc4b | 66 | 986.000000 22.125000 |
htdoughe | 31:c924aad0dc4b | 67 | 986.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 68 | 986.000000 22.187500 |
htdoughe | 31:c924aad0dc4b | 69 | 987.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 70 | 987.000000 22.187500 |
htdoughe | 31:c924aad0dc4b | 71 | 986.000000 22.187500 |
htdoughe | 31:c924aad0dc4b | 72 | 986.000000 22.125000 |
htdoughe | 31:c924aad0dc4b | 73 | 987.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 74 | 987.000000 22.312500 |
htdoughe | 31:c924aad0dc4b | 75 | 986.000000 22.125000 |
htdoughe | 31:c924aad0dc4b | 76 | 987.000000 22.375000 |
htdoughe | 31:c924aad0dc4b | 77 | 987.000000 22.312500 |
htdoughe | 31:c924aad0dc4b | 78 | 986.000000 22.187500 |
htdoughe | 31:c924aad0dc4b | 79 | 987.000000 22.312500 |
htdoughe | 31:c924aad0dc4b | 80 | 987.000000 22.375000 |
htdoughe | 31:c924aad0dc4b | 81 | 987.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 82 | 986.000000 22.125000 |
htdoughe | 31:c924aad0dc4b | 83 | 986.000000 22.187500 |
htdoughe | 31:c924aad0dc4b | 84 | 987.000000 22.375000 |
htdoughe | 31:c924aad0dc4b | 85 | 986.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 86 | 986.000000 22.187500 |
htdoughe | 31:c924aad0dc4b | 87 | 986.000000 22.125000 |
htdoughe | 31:c924aad0dc4b | 88 | 987.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 89 | 987.000000 22.312500 |
htdoughe | 31:c924aad0dc4b | 90 | 987.000000 22.375000 |
htdoughe | 31:c924aad0dc4b | 91 | 986.000000 22.187500 |
htdoughe | 31:c924aad0dc4b | 92 | 987.000000 22.437500 |
htdoughe | 31:c924aad0dc4b | 93 | 987.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 94 | 987.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 95 | 987.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 96 | 986.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 97 | 987.000000 22.375000 |
htdoughe | 31:c924aad0dc4b | 98 | 986.000000 22.250000 |
htdoughe | 31:c924aad0dc4b | 99 | 987.000000 22.312500 |
htdoughe | 31:c924aad0dc4b | 100 | 986.000000 22.125000 |
htdoughe | 31:c924aad0dc4b | 101 | |
htdoughe | 31:c924aad0dc4b | 102 |