lab 6
Dependencies: ADXL362 mbed MPL3115A2
report.txt@29:f328fa35e8eb, 2018-03-08 (annotated)
- Committer:
- htdoughe
- Date:
- Thu Mar 08 21:18:29 2018 +0000
- Revision:
- 29:f328fa35e8eb
- Parent:
- 12:c6b056ad171e
- Child:
- 30:9e127911409d
documentation of altimeter added to report.txt
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 | 29:f328fa35e8eb | 20 | Our altimeter code (measureAlt()) reports the atmospheric pressure in 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 | 29:f328fa35e8eb | 39 | Currently, our code relies on being connected to a pc with a keyboard as it is |
htdoughe | 29:f328fa35e8eb | 40 | measuring values. This is a limitation of our code that we are attempting to |
htdoughe | 29:f328fa35e8eb | 41 | (and fully plan to) address. |
htdoughe | 29:f328fa35e8eb | 42 | |
htdoughe | 29:f328fa35e8eb | 43 | Example output: |
htdoughe | 29:f328fa35e8eb | 44 | |
htdoughe | 29:f328fa35e8eb | 45 | 98763.000000 22.187500 |
htdoughe | 29:f328fa35e8eb | 46 | 98763.000000 22.187500 |
htdoughe | 29:f328fa35e8eb | 47 | 98763.000000 22.187500 |
htdoughe | 29:f328fa35e8eb | 48 | 98763.000000 22.187500 |
htdoughe | 29:f328fa35e8eb | 49 | 98763.000000 22.187500 |
htdoughe | 29:f328fa35e8eb | 50 | 98763.000000 22.187500 |
htdoughe | 29:f328fa35e8eb | 51 | 98763.000000 22.187500 |
htdoughe | 29:f328fa35e8eb | 52 | 98763.000000 22.187500 |
htdoughe | 29:f328fa35e8eb | 53 | 98749.000000 22.062500 |
htdoughe | 29:f328fa35e8eb | 54 | 98749.000000 22.062500 |
htdoughe | 29:f328fa35e8eb | 55 | 98749.000000 22.062500 |
htdoughe | 29:f328fa35e8eb | 56 | 98749.000000 22.062500 |
htdoughe | 29:f328fa35e8eb | 57 | 98749.000000 22.062500 |
htdoughe | 29:f328fa35e8eb | 58 | 98749.000000 22.062500 |
htdoughe | 29:f328fa35e8eb | 59 | 98749.000000 22.062500 |
htdoughe | 29:f328fa35e8eb | 60 | 98749.000000 22.062500 |
htdoughe | 29:f328fa35e8eb | 61 | 98749.000000 22.062500 |
htdoughe | 29:f328fa35e8eb | 62 | 98797.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 63 | 98797.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 64 | 98797.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 65 | 98797.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 66 | 98797.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 67 | 98797.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 68 | 98797.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 69 | 98797.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 70 | 98797.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 71 | 98797.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 72 | 98785.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 73 | 98785.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 74 | 98785.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 75 | 98785.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 76 | 98785.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 77 | 98785.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 78 | 98785.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 79 | 98785.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 80 | 98785.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 81 | 98785.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 82 | 98794.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 83 | 98794.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 84 | 98794.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 85 | 98794.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 86 | 98794.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 87 | 98794.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 88 | 98794.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 89 | 98794.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 90 | 98794.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 91 | 98794.000000 22.125000 |
htdoughe | 29:f328fa35e8eb | 92 | 98842.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 93 | 98842.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 94 | 98842.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 95 | 98842.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 96 | 98842.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 97 | 98842.000000 22.250000 |
htdoughe | 29:f328fa35e8eb | 98 | 98842.000000 22.250000 |