Open Arduino

Enter Your Project for a chance to win a grand prize for the most innovative use of Arduino or a $200 shopping cart! The Birthday Special: Arduino Projects for Arduino Day!

Back to The Project14 homepage

Project14 Home
Monthly Themes
Monthly Theme Poll

 


I am using a STEVAL-STLKT01V1 development kit. The sensor tile is the smallest IOT module I have seen. The sensors I am going to focus on are:

 

1. LSM6DSM - inErtial module, 3D accelerometer and 3D gyroscope

 

2. LSM303AGR - eCompass module with a 3D accelerometer and a 3D magnetometer

 

When Element 14 sent me the Arduino Uno I had no idea that I could program the sensortile using Arduino sketches. That simplifies the programming process and certainly makes it easier. The Arduino Uno has a connector layout and it was just a matter of attaching the sensortile cradle expansion board on top of it and then attaching the sensortile.

 

 

 

I have a draft sketch prepared and still have some work to finalize and test the sketch.

 

Draft Sketch

The goal is to program the sensortile to use a inertial navigation model in which accelerometers and gyroscopes are used to track the position of a object relative to a known starting point. Below is a draft sketch to be developed to achieve this goal. 

 

//Radius of Earth

R = 6378.1

//Calculation of Bearing

brng = Math.atan(magY/magX)

//Calculating distance

d = Step has been taken * stride
//Starting latitude converted to radians

lat1 = 52.20472 * (math.pi * 180)

//Starting longitude converted to radians

lon1 = 0.14056 * (math.pi * 180)

//Calculate next latitude

lat2 = math.asin( math.sin(lat1)*math.cos(d/R) +

math.cos(lat1)*math.sin(d/R) *math.cos(brng))

//Calculate next longitude

lon2 = lon1 + math.atan2(math.sin(brng)*math.sin(d/R)*math.cos(lat1),
  math.cos(d/R)-math.sin(lat1)*math.sin(lat2))

//Convert latitude to degrees

lat2 = math.degrees(lat2)

//convert longitude to degrees

lon2 = math.degrees(lon2)

//print results

print(lat2)

print(lon2)

 

Distance will be calculated by whether a step has been taken The project is designed for a person or animal. If a step has been taken than the stride will be the distance.

length = sqrt(x * x + y * y + z * z);
if(length>=2){
  stepcount+=1;
}

 

 

 

Once the Sensortile has been programed than I will solder the tile to a smaller cradle. The cradle will be powered by a tiny battery and be placed in a plastic case.