BounceMe

An app for the Kookaberry

Tony Strasser

Developed by
Tony Strasser

AustSTEM

This measures, logs, and displays instantaneous acceleration using its on-board accelerometer.

Suggested usage is not to throw the Kookaberry about as it will get damaged.  Instead, users can be dropped carefully on a padded surface; held whilst you jump on a trampoline; go on a swing; go down a slippery dip; go on a seesaw; and run or hop.The Kookaberry can also be carefully secured to a bungee cord and dropped so it doesn’t strike anything; or swung securely on a pendulum.

Directions

Step 1: Setup

There are no peripherals to set up with this app.

Step 2: Running the app

Navigate to the BounceMe app and press Button B to run. Hold the Kookaberry level and read the following to learn what is showing on the screen.

       

What is showing on the screens.
  1. Top Row: The name of the app and the ID of the Kookaberry. This is the first two characters of Name and Surname in the Kappconfig text file in the root directory of its USB memory
  2. Second Row: The box shows the instantaneous average gravitational acceleration at rest together with its measured value. For the first two screenshots,the first reading is with the Kookaberry horizontal, the second with it on its side. The third shot shows the acceleration change during a bounce. It is showing “Stored” because it is a frozen image of the first two seconds of data.
  3. Third Row: The duration of the recording interval in secs and whether the screen is showing live or stored data. When capturing data, this line says “Logging xxxx msecs” indicating it is logging and how long to go.
  4. Fourth Row: Button A is Exit from application; Button C reduces the recording duration time by 2 secs between 2 and 10 secs. The default time is 4 secs. Button D increases the recording duration time; and Button B stops and starts the recording. Button B has to be pressed for longer than 1 sec to start recording. The Live indicator changes to Store 1 after 2 secs of the first recording.
Step 3: Using the app
  1. Select a soft surface on which to drop the Kookaberry (See box above for precautions) and press Button B for more than 1 second. Data logging will now start for the default duration of 4 secs (or as adjusted by Buttons C and D). The time (in milliseconds) remaining for data logging is indicated.
  2. Drop the Kookaberry and wait for the Kookaberry to freeze the first two seconds of the recording period on the graph so that users can see what happened (in part). The screen displays Store X to indicate that the recording is not Live. Restoring the live display requires a short press of Button B.
  3. Further ”Bounce” recordings can now be made by a long press on Button B again.
  4. The full period of each bounce s recorded in the BounceMe.csv file as before except each recording session is preceded by “Recording n’ and column heading lines.

The logging file is called “BouncMe.csv” to keep it separate from other apps.

The file is initialised on app startup.  Thereafter one or more captures are appended to the file.  The file is opened only during capture and closed afterwards thereby minimising the risk of inadvertent loss of data.

The trace will free-run continuously, logging or not.  This is because it auto-zeroes and it takes a couple of seconds to stabilise.  When multiple traces are captured in the logging file they will overlay in Excel so that successive bounces can be compared.

The trace below is a graph of the measured and logged values when dropping the K onto a padded chair from about half a metre.  You can clearly see the free-fall (zero-g) followed by an acceleration impulse and decay oscillation.  The capture period was set to 2 seconds. The graph heading includes the full name from Kappconfig.txt.

Mathematics

[The following explanation is taken from a BBC microbit tutorial]

The accelerometer in the Kookaberry measures movement along three axis when being held perfectly flat and level.

  • X axis: Tilting from left to right
  • Y axis: Tilting forwards and backwards
  • Z axis: Moving up and down

Acceleration is what is known as a vector quantity – it has a magnitude (size, length) and a direction. To get the overall magnitude, irrespective of orientation, with only X and Y axes (i.e. we had a 2D accelerometer) the situation would be:

The single vector calculated as above is what is shown on the screen. Gravity’s acceleration at rest is 9.8 meters per second squared when measured in a direct line from your head through your feet when standing vertically. 

This should be the value shown on the screen when the Kookaberry is held perfectly flat, but the accelerometer is not perfect and requires calibration. This is what you do when you calibrate the Compass app.

Algorithm

  1. Read Kappconfig file for ID and data pertaining to the running of this app 
  2. Set up CSV file parameters and screen display
  3. Read status of buttons and process and display the first two seconds of captured data on the screen following a long press of Button B. 
  4. Write the full data captured during the set duration to the USB memory.
  5. If long press of Button B  not detected, read individual values on each of the accelerometer’s three axis; compute the value of a single vector as shown above; and display.

 

 

Version:1


Last updated:1 week ago


Device:Kookaberry


Radio code:


App ID:...


lib_dependencies:kbtimer.py


root_dependencies:Kappconfig.txt


Downloads



Download on GitHub
Image

Support

Issues resolved in the support forum:

8 out of 11
View support forum

Leave a Reply

Bitnami