lab 6

Dependencies:   ADXL362 mbed MPL3115A2

Committer:
htdoughe
Date:
Fri Mar 09 16:21:15 2018 +0000
Revision:
31:c924aad0dc4b
Parent:
30:9e127911409d
Child:
33:5df68b9e96de
report and code tweaks

Who changed what in which revision?

UserRevisionLine numberNew 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 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 30:9e127911409d 43 In addition, our code does not include the GPIO pin at the moment because screen
htdoughe 30:9e127911409d 44 breaks when it is added.
htdoughe 31:c924aad0dc4b 45
htdoughe 31:c924aad0dc4b 46 example output:
htdoughe 29:f328fa35e8eb 47
htdoughe 31:c924aad0dc4b 48 986.000000 22.250000
htdoughe 31:c924aad0dc4b 49 986.000000 22.187500
htdoughe 31:c924aad0dc4b 50 986.000000 22.187500
htdoughe 31:c924aad0dc4b 51 986.000000 22.125000
htdoughe 31:c924aad0dc4b 52 986.000000 22.250000
htdoughe 31:c924aad0dc4b 53 986.000000 22.250000
htdoughe 31:c924aad0dc4b 54 987.000000 22.312500
htdoughe 31:c924aad0dc4b 55 986.000000 22.250000
htdoughe 31:c924aad0dc4b 56 986.000000 22.250000
htdoughe 31:c924aad0dc4b 57 986.000000 22.250000
htdoughe 31:c924aad0dc4b 58 986.000000 22.312500
htdoughe 31:c924aad0dc4b 59 987.000000 22.375000
htdoughe 31:c924aad0dc4b 60 986.000000 22.125000
htdoughe 31:c924aad0dc4b 61 986.000000 22.187500
htdoughe 31:c924aad0dc4b 62 987.000000 22.375000
htdoughe 31:c924aad0dc4b 63 986.000000 22.187500
htdoughe 31:c924aad0dc4b 64 987.000000 22.312500
htdoughe 31:c924aad0dc4b 65 986.000000 22.312500
htdoughe 31:c924aad0dc4b 66 987.000000 22.312500
htdoughe 31:c924aad0dc4b 67 987.000000 22.312500
htdoughe 31:c924aad0dc4b 68 986.000000 22.187500
htdoughe 31:c924aad0dc4b 69 986.000000 22.125000
htdoughe 31:c924aad0dc4b 70 986.000000 22.250000
htdoughe 31:c924aad0dc4b 71 986.000000 22.187500
htdoughe 31:c924aad0dc4b 72 987.000000 22.250000
htdoughe 31:c924aad0dc4b 73 987.000000 22.187500
htdoughe 31:c924aad0dc4b 74 986.000000 22.187500
htdoughe 31:c924aad0dc4b 75 986.000000 22.125000
htdoughe 31:c924aad0dc4b 76 987.000000 22.250000
htdoughe 31:c924aad0dc4b 77 987.000000 22.312500
htdoughe 31:c924aad0dc4b 78 986.000000 22.125000
htdoughe 31:c924aad0dc4b 79 987.000000 22.375000
htdoughe 31:c924aad0dc4b 80 987.000000 22.312500
htdoughe 31:c924aad0dc4b 81 986.000000 22.187500
htdoughe 31:c924aad0dc4b 82 987.000000 22.312500
htdoughe 31:c924aad0dc4b 83 987.000000 22.375000
htdoughe 31:c924aad0dc4b 84 987.000000 22.250000
htdoughe 31:c924aad0dc4b 85 986.000000 22.125000
htdoughe 31:c924aad0dc4b 86 986.000000 22.187500
htdoughe 31:c924aad0dc4b 87 987.000000 22.375000
htdoughe 31:c924aad0dc4b 88 986.000000 22.250000
htdoughe 31:c924aad0dc4b 89 986.000000 22.187500
htdoughe 31:c924aad0dc4b 90 986.000000 22.125000
htdoughe 31:c924aad0dc4b 91 987.000000 22.250000
htdoughe 31:c924aad0dc4b 92 987.000000 22.312500
htdoughe 31:c924aad0dc4b 93 987.000000 22.375000
htdoughe 31:c924aad0dc4b 94 986.000000 22.187500
htdoughe 31:c924aad0dc4b 95 987.000000 22.437500
htdoughe 31:c924aad0dc4b 96 987.000000 22.250000
htdoughe 31:c924aad0dc4b 97 987.000000 22.250000
htdoughe 31:c924aad0dc4b 98 987.000000 22.250000
htdoughe 31:c924aad0dc4b 99 986.000000 22.250000
htdoughe 31:c924aad0dc4b 100 987.000000 22.375000
htdoughe 31:c924aad0dc4b 101 986.000000 22.250000
htdoughe 31:c924aad0dc4b 102 987.000000 22.312500
htdoughe 31:c924aad0dc4b 103 986.000000 22.125000
htdoughe 31:c924aad0dc4b 104
htdoughe 31:c924aad0dc4b 105