Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Component Documentation

How to Use LSM303C (6 DOF): Examples, Pinouts, and Specs

Image of LSM303C (6 DOF)
Cirkit Designer LogoDesign with LSM303C (6 DOF) in Cirkit Designer

Introduction

The LSM303C is a 6 Degrees of Freedom (6 DOF) sensor manufactured by SparkFun (Part ID: SEN-13303). It integrates a 3-axis accelerometer and a 3-axis magnetometer into a single compact package, enabling precise motion and orientation detection in three-dimensional space. This sensor is ideal for applications requiring motion tracking, navigation, and orientation sensing, such as robotics, drones, augmented reality devices, and mobile electronics.

The LSM303C communicates via I²C or SPI interfaces, making it compatible with a wide range of microcontrollers, including Arduino boards. Its small size and low power consumption make it suitable for portable and embedded systems.

Explore Projects Built with LSM303C (6 DOF)

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Raspberry Pi 5-Based Multi-Sensor IMU System with MPU-6050 and LSM303c
Image of GRS: A project utilizing LSM303C (6 DOF) in a practical application
This circuit integrates a Raspberry Pi 5 with multiple sensors, including an MPU-6050 accelerometer and gyroscope, and an LSM303c 6DOF IMU, to collect and process motion and orientation data. The Raspberry Pi serves as the central processing unit, interfacing with the sensors via GPIO pins and providing power to them.
Cirkit Designer LogoOpen Project in Cirkit Designer
Self-Balancing Scooter with MPU-6050 and STM32 Nucleo
Image of Segway TRMK 2024: A project utilizing LSM303C (6 DOF) in a practical application
This circuit is a self-balancing scooter system that uses an MPU-6050 sensor to detect tilt and control two DC motors via PWM motor controllers to maintain balance. The STM32 Nucleo F303RE microcontroller processes the sensor data and adjusts the motor speeds accordingly. Additional components include a potentiometer, LEDs for status indication, and a load cell interface for potential weight measurement.
Cirkit Designer LogoOpen Project in Cirkit Designer
Battery-Powered Robotic Car with Raspberry Pi Pico and L298N Motor Driver
Image of sma sci-oly: A project utilizing LSM303C (6 DOF) in a practical application
This circuit is a motor control system using a Raspberry Pi Pico to interface with an L298N motor driver and two DG01D-E motors. It also includes an Adafruit 9-DoF sensor for orientation and motion sensing, powered by a 4 x AAA battery pack and controlled via a rocker switch.
Cirkit Designer LogoOpen Project in Cirkit Designer
Arduino UNO-Based IMU and Bluetooth Communication System
Image of New one: A project utilizing LSM303C (6 DOF) in a practical application
This circuit features an Arduino UNO microcontroller interfaced with a Bluetooth HC-06 module for wireless communication and an Adafruit BNO085 9-DOF Orientation IMU for motion sensing. The Arduino handles data acquisition from the IMU via I2C and communicates the data wirelessly through the Bluetooth module.
Cirkit Designer LogoOpen Project in Cirkit Designer

Explore Projects Built with LSM303C (6 DOF)

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of GRS: A project utilizing LSM303C (6 DOF) in a practical application
Raspberry Pi 5-Based Multi-Sensor IMU System with MPU-6050 and LSM303c
This circuit integrates a Raspberry Pi 5 with multiple sensors, including an MPU-6050 accelerometer and gyroscope, and an LSM303c 6DOF IMU, to collect and process motion and orientation data. The Raspberry Pi serves as the central processing unit, interfacing with the sensors via GPIO pins and providing power to them.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of Segway TRMK 2024: A project utilizing LSM303C (6 DOF) in a practical application
Self-Balancing Scooter with MPU-6050 and STM32 Nucleo
This circuit is a self-balancing scooter system that uses an MPU-6050 sensor to detect tilt and control two DC motors via PWM motor controllers to maintain balance. The STM32 Nucleo F303RE microcontroller processes the sensor data and adjusts the motor speeds accordingly. Additional components include a potentiometer, LEDs for status indication, and a load cell interface for potential weight measurement.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of sma sci-oly: A project utilizing LSM303C (6 DOF) in a practical application
Battery-Powered Robotic Car with Raspberry Pi Pico and L298N Motor Driver
This circuit is a motor control system using a Raspberry Pi Pico to interface with an L298N motor driver and two DG01D-E motors. It also includes an Adafruit 9-DoF sensor for orientation and motion sensing, powered by a 4 x AAA battery pack and controlled via a rocker switch.
Cirkit Designer LogoOpen Project in Cirkit Designer
Image of New one: A project utilizing LSM303C (6 DOF) in a practical application
Arduino UNO-Based IMU and Bluetooth Communication System
This circuit features an Arduino UNO microcontroller interfaced with a Bluetooth HC-06 module for wireless communication and an Adafruit BNO085 9-DOF Orientation IMU for motion sensing. The Arduino handles data acquisition from the IMU via I2C and communicates the data wirelessly through the Bluetooth module.
Cirkit Designer LogoOpen Project in Cirkit Designer

Technical Specifications

Below are the key technical details of the LSM303C sensor:

General Specifications

  • Manufacturer: SparkFun
  • Part ID: SEN-13303
  • Sensor Type: 6 DOF (3-axis accelerometer + 3-axis magnetometer)
  • Communication Interfaces: I²C (default) or SPI
  • Operating Voltage: 1.8V to 3.6V
  • Current Consumption:
    • Accelerometer: 90 µA (typical)
    • Magnetometer: 100 µA (typical)
  • Operating Temperature Range: -40°C to +85°C
  • Package: LGA-12 (2 mm x 2 mm x 1 mm)

Accelerometer Specifications

  • Measurement Range: ±2g, ±4g, ±8g
  • Output Data Rate (ODR): 10 Hz to 1.6 kHz
  • Resolution: 16-bit

Magnetometer Specifications

  • Measurement Range: ±16 gauss
  • Output Data Rate (ODR): 10 Hz to 100 Hz
  • Resolution: 16-bit

Pin Configuration

The LSM303C sensor has 12 pins. Below is the pinout description:

Pin Name Description
1 VDD Power supply (1.8V to 3.6V)
2 GND Ground
3 SCL/SPC I²C clock line (SCL) or SPI clock line (SPC)
4 SDA/SDI/SDO I²C data line (SDA) or SPI data input/output (SDI/SDO)
5 CS SPI chip select (active low). Tie to VDD for I²C mode.
6 INT1 Interrupt 1 output (configurable)
7 INT2 Interrupt 2 output (configurable)
8-12 NC Not connected (leave floating or connect to GND for stability)

Usage Instructions

Connecting the LSM303C to an Arduino UNO

The LSM303C can be easily interfaced with an Arduino UNO using the I²C protocol. Below is the wiring guide:

LSM303C Pin Arduino UNO Pin
VDD 3.3V
GND GND
SCL A5 (SCL)
SDA A4 (SDA)
CS Connect to VDD

Arduino Code Example

The following example demonstrates how to read accelerometer and magnetometer data from the LSM303C using the SparkFun LSM303C library.

#include <Wire.h>
#include <SparkFunLSM303C.h>

// Create LSM303C object
LSM303C myIMU;

void setup() {
  Serial.begin(9600); // Initialize serial communication
  Wire.begin();       // Initialize I²C communication

  // Initialize the LSM303C sensor
  if (myIMU.begin() != 0) {
    Serial.println("Failed to initialize LSM303C!");
    while (1); // Halt execution if initialization fails
  }
  Serial.println("LSM303C initialized successfully.");
}

void loop() {
  // Read accelerometer data
  float accelX = myIMU.readAccelX();
  float accelY = myIMU.readAccelY();
  float accelZ = myIMU.readAccelZ();

  // Read magnetometer data
  float magX = myIMU.readMagX();
  float magY = myIMU.readMagY();
  float magZ = myIMU.readMagZ();

  // Print accelerometer data
  Serial.print("Accel (g): X=");
  Serial.print(accelX, 2);
  Serial.print(", Y=");
  Serial.print(accelY, 2);
  Serial.print(", Z=");
  Serial.println(accelZ, 2);

  // Print magnetometer data
  Serial.print("Mag (gauss): X=");
  Serial.print(magX, 2);
  Serial.print(", Y=");
  Serial.print(magY, 2);
  Serial.print(", Z=");
  Serial.println(magZ, 2);

  delay(500); // Wait 500ms before the next reading
}

Important Considerations

  1. Power Supply: Ensure the sensor is powered with a voltage between 1.8V and 3.6V. Using a voltage higher than 3.6V may damage the sensor.
  2. Pull-Up Resistors: The I²C lines (SCL and SDA) require pull-up resistors. If your microcontroller does not have built-in pull-ups, add external resistors (4.7kΩ recommended).
  3. Interrupt Pins: The INT1 and INT2 pins can be configured for specific events, such as data-ready or threshold detection. Refer to the LSM303C datasheet for details.

Troubleshooting and FAQs

Common Issues

  1. Sensor Not Detected:

    • Ensure the wiring is correct and matches the pinout table.
    • Verify that the I²C address (default: 0x1E for the magnetometer, 0x1D for the accelerometer) is correct in your code.
    • Check for proper pull-up resistors on the I²C lines.
  2. Incorrect or No Data:

    • Confirm that the sensor is properly initialized in the code.
    • Ensure the power supply voltage is within the specified range (1.8V to 3.6V).
    • Verify that the output data rate (ODR) is configured correctly for your application.
  3. Noise in Readings:

    • Minimize external electromagnetic interference near the sensor.
    • Use proper decoupling capacitors on the power supply lines.

FAQs

Q1: Can the LSM303C be used with a 5V microcontroller?
A1: Yes, but you must use a logic level shifter to step down the 5V signals to 3.3V for the sensor.

Q2: How do I switch between I²C and SPI modes?
A2: To use I²C mode, connect the CS pin to VDD. For SPI mode, connect the CS pin to the microcontroller and configure it as a chip select line.

Q3: What is the maximum cable length for I²C communication?
A3: The maximum cable length depends on the pull-up resistor values and the I²C clock speed. For standard 100 kHz I²C, a length of up to 1 meter is typically reliable.

By following this documentation, you can effectively integrate the LSM303C sensor into your projects for accurate motion and orientation sensing.