Arduino Density Exercise

Posted: February 14, 2013 by lucmehl in Planetary Science Announcements

We will develop our Arduino coding skills by using the serial monitor to calculate the density of the Earth with variable crust/mantle/core proportions.

Refer to page 30 in the Faure text for density/depth values.

To print results to the serial monitor, you need to include this text within setup:

void setup()

{
//calculation code here

Serial.begin(9600);
Serial.print(“Label: “);
Serial.println(variable);

Serial.print(“Another label: “);
Serial.println(anotherVariable);
}

Let’s start simple and add complexity.

1) Start be assigning percentages and average densities for crust, mantle and core. Then use something like this to calculate the density of the earth:

float densityEarth=
percCrust * densityCrust
+ percMantle * densityMantle
+ percCore * densityCore;

This is similar to the density of rock problem that you did in Ch. 3.

2) Now let’s incorporate volumes.

Starting by defining the radius of the Earth as 6380000 m.
Define the crust to be 30 km thick, and calculate the inner radius.
Calculate the volume of the crust and volume of the earth, and divide vCrust/vEarth to update your percCrust value.

Continue this process working toward the core of the Earth.

The density of the Earth is 5.52 g/cm^3.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s