LSM9DS0 accelerometer sensor

hello good day’ i’m new in using arduino… i’m just asking on how to convert the x, y and z value of lsm9ds0 accelerometer… i just need an exact value of steps taken… thank you so much… this code is from the library of lsm9ds0 :

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_LSM9DS0.h>

/* This driver uses the Adafruit unified sensor library (Adafruit_Sensor),
which provides a common 'type' for sensor data and some helper functions.

To use this driver you will also need to download the Adafruit_Sensor
library and include it in your libraries folder.

You should also assign a unique ID to this sensor for use with
the Adafruit Sensor API so that you can identify this particular
sensor in any data logs, etc. To assign a unique ID, simply
provide an appropriate value in the constructor below (12345
is used by default in this example).

Connections (For default I2C)
Connect SCL to analog 5
Connect SDA to analog 4
Connect VDD to 5V DC
Connect GROUND to common ground

2014/JULY/25 - First version (KTOWN)

/* Assign a unique base ID for this sensor */
Adafruit_LSM9DS0 lsm = Adafruit_LSM9DS0(1000); // Use I2C, ID #1000

/* Or, use Hardware SPI:
G_SDO + XM_SDO -> tied together to SPI MISO
then select any two pins for the two CS lines:

#define LSM9DS0_XM_CS 10
#define LSM9DS0_GYRO_CS 9
//Adafruit_LSM9DS0 lsm = Adafruit_LSM9DS0(LSM9DS0_XM_CS, LSM9DS0_GYRO_CS, 1000);

/* Or, use Software SPI:
G_SDO + XM_SDO -> tied together to the MISO pin!
then select any pins for the SPI lines, and the two CS pins above

#define LSM9DS0_SCLK 13
#define LSM9DS0_MISO 12
#define LSM9DS0_MOSI 11

//Adafruit_LSM9DS0 lsm = Adafruit_LSM9DS0(LSM9DS0_SCLK, LSM9DS0_MISO, LSM9DS0_MOSI, LSM9DS0_XM_CS, LSM9DS0_GYRO_CS, 1000);

Displays some basic information on this sensor from the unified
sensor API sensor_t type (see Adafruit_Sensor for more information)
void displaySensorDetails(void)
sensor_t accel, mag, gyro, temp;

lsm.getSensor(&accel, &mag, &gyro, &temp);

Serial.print (F("Sensor: ")); Serial.println(;
Serial.print (F("Driver Ver: ")); Serial.println(accel.version);
Serial.print (F("Unique ID: ")); Serial.println(accel.sensor_id);
Serial.print (F("Max Value: ")); Serial.print(accel.max_value); Serial.println(F(" m/s^2"));
Serial.print (F("Min Value: ")); Serial.print(accel.min_value); Serial.println(F(" m/s^2"));
Serial.print (F("Resolution: ")); Serial.print(accel.resolution); Serial.println(F(" m/s^2"));

Serial.print (F("Sensor: ")); Serial.println(;
Serial.print (F("Driver Ver: ")); Serial.println(mag.version);
Serial.print (F("Unique ID: ")); Serial.println(mag.sensor_id);
Serial.print (F("Max Value: ")); Serial.print(mag.max_value); Serial.println(F(" uT"));
Serial.print (F("Min Value: ")); Serial.print(mag.min_value); Serial.println(F(" uT"));
Serial.print (F("Resolution: ")); Serial.print(mag.resolution); Serial.println(F(" uT"));

Serial.print (F("Sensor: ")); Serial.println(;
Serial.print (F("Driver Ver: ")); Serial.println(gyro.version);
Serial.print (F("Unique ID: ")); Serial.println(gyro.sensor_id);
Serial.print (F("Max Value: ")); Serial.print(gyro.max_value); Serial.println(F(" rad/s"));
Serial.print (F("Min Value: ")); Serial.print(gyro.min_value); Serial.println(F(" rad/s"));
Serial.print (F("Resolution: ")); Serial.print(gyro.resolution); Serial.println(F(" rad/s"));

Serial.print (F("Sensor: ")); Serial.println(;
Serial.print (F("Driver Ver: ")); Serial.println(temp.version);
Serial.print (F("Unique ID: ")); Serial.println(temp.sensor_id);
Serial.print (F("Max Value: ")); Serial.print(temp.max_value); Serial.println(F(" C"));
Serial.print (F("Min Value: ")); Serial.print(temp.min_value); Serial.println(F(" C"));
Serial.print (F("Resolution: ")); Serial.print(temp.resolution); Serial.println(F(" C"));


Configures the gain and integration time for the TSL2561
void configureSensor(void)
// 1.) Set the accelerometer range

// 2.) Set the magnetometer sensitivity

// 3.) Setup the gyroscope

Arduino setup function (automatically called at startup)
void setup(void)
while (!Serial); // wait for flora/leonardo

Serial.println(F("LSM9DS0 9DOF Sensor Test")); Serial.println("");

/* Initialise the sensor */
/* There was a problem detecting the LSM9DS0 ... check your connections */
Serial.print(F("Ooops, no LSM9DS0 detected ... Check your wiring or I2C ADDR!"));
Serial.println(F("Found LSM9DS0 9DOF"));

/* Display some basic information on this sensor */

/* Setup the sensor gain and integration time */

/* We're ready to go! */

Arduino loop function, called once 'setup' is complete (your own code
should go here)
void loop(void)
/* Get a new sensor event */
sensors_event_t accel, mag, gyro, temp;

lsm.getEvent(&accel, &mag, &gyro, &temp);

// print out accelleration data
Serial.print("Accel X: "); Serial.print(accel.acceleration.x); Serial.print(" ");
Serial.print(" \tY: "); Serial.print(accel.acceleration.y); Serial.print(" ");
Serial.print(" \tZ: "); Serial.print(accel.acceleration.z); Serial.println(" \tm/s^2");

// print out magnetometer data
Serial.print("Magn. X: "); Serial.print(mag.magnetic.x); Serial.print(" ");
Serial.print(" \tY: "); Serial.print(mag.magnetic.y); Serial.print(" ");
Serial.print(" \tZ: "); Serial.print(mag.magnetic.z); Serial.println(" \tgauss");

// print out gyroscopic data
Serial.print("Gyro X: "); Serial.print(gyro.gyro.x); Serial.print(" ");
Serial.print(" \tY: "); Serial.print(gyro.gyro.y); Serial.print(" ");
Serial.print(" \tZ: "); Serial.print(gyro.gyro.z); Serial.println(" \tdps");

// print out temperature data
Serial.print("Temp: "); Serial.print(temp.temperature); Serial.println(" *C");



What do you mean by “steps taken”?

i mean an exact number of walk taken..

Steps taken by you?

If you are making a pedometer, you will need to study the output of the sensor while you are walking, and decide what features of the output represent a "step". You then have to program the Arduino to recognize those features and count steps.

the code above shows the value of x, y and z axis.. i don't know ho to convert it to steps..

Google "arduino pedometer"