LSM303AGR eCompass @Dronebotworkshop
LSM303AGR eCompass  @Dronebotworkshop
Uploaded November 2025 | Updated November 2026, 3 hours ago
The LSM303 Multifunction “eCompass” sensor combines an Accelerometer and a Magnetometer. We’ll test it out and build a small compass with an OLED display.

Article with code: dronebotworkshop.com/lsm303agr
More articles and tutorials: dronebotworkshop.com
Join the conversation on the forum: forum.dronebotworkshop.com
Subscribe to the newsletter and stay in touch: dronebotworkshop.com/subscribe

Today, we’re checking out an inexpensive yet useful sensor from STMicroelectronics and Adafruit, the LSM303AGR “Multifunction eCompass Sensor”. This little gem is both an accelerometer and a magnetometer, enabling it to sense direction, speed, and motion.

This device is actually two sensors in one, and you can program them independently. Both sensors are “MEMS” (Micro-Electro-Mechanical-System) sensors, and I’ll show you how they operate and what Adafruit libraries can be used with them.

I’ll also show you how to calibrate the Magnetometer to increase its accuracy. And we’ll run some sample sketches to make sure everything is working correctly.

After that, we’ll finish the video by building a compass or “eCompass” with an OLED display.

Here is the Table of Contents for today's video:

00:00 - Introduction
01:23 - LSM303AGR Module
04:48 - LSM303AGR Hookup
05:34 - Using the Accelerometer
11:34 - Introducing the Magnetometer
15:14 - Calibrating the Magnetometer
22:20 - Using the Magnetometer
25:17 - Simple Compass
27:42 - OLED Compass
34:22 - Conclusion

This sensor is perfect for robotic and navigation applications, and as you’ll soon see, it is very easy to use.

I hope you enjoy the video!

Bill
LSM303AGR eCompassTB6612FNG H-Bridge Motor Controller - Better than L298N?Raspberry Pi Autofocus Camera & libcameraESP32 Boards Manager 3 - Upgrade your Older CodeEthernet & Power-over-Ethernet with ESP32 - Build a PoE Camera and a Web ServerGetting Started with PlatformIORGB LEDs with Arduino - Standard & NeoPixelMeasuring Carbon Dioxide - CO₂ & eCO₂ SensorsArduino Nano 33 IoT - Getting StartedArduino Programming with XOD - Learning XODRaspberry Pi Cameras - The BIG PictureArduino Color Sensors - TCS230 & ISL29125
DroneBot Workshop |

LSM303AGR eCompass

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER