# Simulating Natural Disasters With BrainPad

0

## Happy #CSEdWeek!

With so many awesome activities floating around the interweb space I thought I would create my own project between travels. In this activity we will simulate different natural disasters (Earthquake, Tornado, Hurricane, etc) using Brainpad.

## Brainpad is a new STEAM tool on the market that I have written about here and here.

Since the Brainpad has an internal accelerometer, we can read the X, Y and Z position of the board. Lying the board flat produces an X and Y value of 0. `x`: acceleration in the left and right direction.
`y`: acceleration in the forward and backward direction.
`z`: acceleration in the up and down direction.
`strength`: the resulting strength of acceleration from all three dimensions (directions).

Forces in space

Since we don’t live on a flat world, forces happen in three dimensional space. If the movement of an object isn’t exactly in the direction of one axis, we need a way to calculate its acceleration from the values measured for all the axes together.

If you put your brainpad on a level table and push it diagonally, you have an acceleration in two dimensions. You can find the acceleration in that direction just like how you calculate the long side of a triangle using the two shorter sides (X and Y):

`strength2D = Math.sqrt((accelX * accelX) + (accelY * accelY))`

If you decide to lift your brainpad off the table, then you’ve just added another dimension, so insert the acceleration value for the Z axis into the equation:

`strength3D = Math.sqrt((accelX * accelX) + (accelY * accelY) + (accelZ * accelZ))`

This calculation is called the Euclidean norm of acceleration.

By suspending the Brainpad, we can simulate earthquakes or wind by exploring the graphing functions of the internal acceleration. Since the Brainpad has an onboard LCD, we get realtime results. This video demonstrates the project.

## If you are interested in learning more about Scratch, Micro:Bit or Python, head on over to our new Code Breaker courses hosted here. # What will you create? # For more lessons, activities and ideas, grab a copy of my book, Code Breaker, on Amazon here! (Visited 338 times, 1 visits today)