Designers are increasingly required to provide directional and motion sensing capabilities for their systems. Fortunately, sensors based on solid-state (semiconductor) and micro-electromechanical systems (MEMS) technology are now available to help them achieve this. These sensors are compact, low-cost, and can deploy motion and direction sensing functions across a wide range of systems, including drones, robots, and of course, handheld products like smartphones and tablets. These sensors can also be utilized in predictive maintenance systems for the Industrial Internet of Things (IIoT), providing data for artificial intelligence (AI) and machine learning (ML) to analyze at the edge.
The main types of MEMS sensors used for detecting motion and direction include accelerometers, gyroscopes, magnetometers, and various combinations of these. While many designers are interested in integrating motion and direction sensors into their designs, they often do not know where to start.
One option is to use evaluation and development kits provided by MEMS sensor manufacturers to support their solutions. If the support is very high, this can be a good approach. However, this requires designers to either limit themselves to using sensors from a single manufacturer or learn the software tools from multiple sensor manufacturers.
Another option is for designers who are not accustomed to using motion and direction sensors, who can use low-cost open-source microcontroller development boards provided by Arduino, along with a low-cost open-source sensor breakout board (BOB) that integrates sensors from multiple manufacturers for experimentation and prototyping.
To help designers get started quickly, this article explains several sensor terms and briefly discusses the roles of motion and direction sensors. It then introduces some of the sensor BOBs offered by Adafruit and their uses.
Introduction to Sensor Terms
When referring to motion and direction sensors, two commonly used terms are “axis count” and “degrees of freedom” (DOF). Unfortunately, these terms are often used interchangeably, which can lead to confusion.
In general, the term axis count can be used to describe the dimensions of the data utilized by the system. In terms of motion and direction, there are three relevant axes: X, Y, and Z.
The visualization of these axes depends on the relevant system. For example, in a flat smartphone, the X-axis is horizontal relative to the screen, pointing to the right, the Y-axis is vertical relative to the screen, pointing upwards, while the Z-axis, which is perpendicular to both of these axes, points out of the screen (Figure 1).
For devices like smartphones, there are two types of relevant motion: linear and angular. In linear motion, the system can move left and right along the X-axis, up and down along the Y-axis, and forward and backward along the Z-axis. In angular motion, the system can rotate around one or more of the three axes.
In the context of motion, DOF refers to any direction in which independent motion can occur. Based on this, a physical system can have a maximum of 6 DOF (6DOF), as it can only move in six ways in three-dimensional space (three linear and three angular).
The term “direction” refers to the physical position or orientation of something in relation to something else. For example, in a smartphone, the direction determines whether the phone is lying flat on its back, standing on its side (either vertically or horizontally), or somewhere in between.
One way to look at this situation is to determine the direction of the device by the DOF values at certain time points tX. By comparing, the motion of the device is determined by the differences in all possible DOF values between time t0 and t1.
Sensors like accelerometers, gyroscopes, and magnetometers can be single-axis, dual-axis, or tri-axis. For example, a single-axis accelerometer can only detect changes along one of the three axes it is aligned with; a dual-axis sensor will detect changes along two of the three axes; while a tri-axis sensor will detect changes along all three axes.
If a sensor platform is described as tracking more than six axes, it indicates that it is providing higher precision by tracking multiple data points along (or around) the X, Y, and Z axes. For example, a 12-axis accelerometer kit utilizes four 3-axis accelerometers for linear acceleration measurements.
Unfortunately, people often confuse DOF with axis count. For instance, a combination of a 3-axis accelerometer, a 3-axis gyroscope, and a 3-axis magnetometer may be described by some manufacturers as a 9DOF sensor, even though a more accurate description would be a 6DOF 9-axis sensor.
Sensor Fusion
Besides measuring acceleration, accelerometers can also measure gravity. For smartphones, even when users are standing still and the device is stationary, a tri-axis accelerometer can determine which direction is down.
A tri-axis accelerometer can also be used to determine the vertical and horizontal orientation of the device, using this information to present its display content in portrait or landscape mode. However, solely relying on an accelerometer cannot determine the direction of the smartphone in relation to the Earth’s magnetic field. This function is necessary for apps like “planetarium,” where users can point the device at areas of interest to identify and locate stars, planets, and constellations in the night sky. In this case, a magnetometer is needed. If the smartphone is always lying flat on a table, then a single-axis magnetometer would suffice. However, since smartphones may be used in any orientation, a tri-axis magnetometer is necessary.
Accelerometers are not affected by surrounding magnetic fields, but they are influenced by motion and vibration. In contrast, magnetometers are not affected by motion and vibration but can be influenced by nearby magnetic materials and electromagnetic fields.
While tri-axis accelerometers can also derive rotational data, the angular momentum data provided by tri-axis gyroscopes is more accurate. Gyroscopes perform well in measuring rotational speed and are not influenced by linear acceleration or magnetic fields. However, even when stationary, gyroscopes do tend to generate small “residual” rotational speeds. This is known as “zero drift.” If a user attempts to use a gyroscope to determine an absolute angle, problems arise, as it requires integrating the rotational speed to obtain angular position. In this case, the issue with integration is that errors accumulate over time. For instance, an initial measurement might have a small error of 0.01 degrees, but after 100 measurements, it could grow to a full degree. This is known as “gyroscope drift.”
The term “sensor fusion” refers to combining perceptual data from different sources so that the uncertainty of the resulting information is less than what could be achieved by using the data from these sources individually.
For example, in a sensor array consisting of a tri-axis accelerometer, a tri-axis gyroscope, and a tri-axis magnetometer, the data provided by the accelerometer and magnetometer can eliminate gyroscope drift. Meanwhile, the data from the gyroscope can compensate for any noise caused by vibrations from the accelerometer and noise caused by magnetic materials/magnetic fields from the magnetometer.
The result of using sensor fusion is that the output accuracy exceeds that of a single sensor.
Introducing Some Representative Sensors
Depending on the application, designers can decide to use only one type of motion/direction sensor, such as an accelerometer, gyroscope, or magnetometer.
We will first introduce the 2019 BOB provided by Adafruit, which features a tri-axis accelerometer with a 14-bit analog-to-digital converter (ADC) (Figure 2).
This high-precision tri-axis sensor has a wide range of ±2g to ±8g, making it suitable for detecting motion, tilt, and basic direction. The sensor requires a 3.3-volt power supply, and the BOB includes a low-dropout 3.3-volt regulator and level-shifting circuit, allowing it to safely work with 3-volt or 5-volt power supplies and logic circuits. Communication between the BOB and Arduino (or another microcontroller) occurs via I2C.
For applications that only require a gyroscope sensor to detect twisting and rotation, the Adafruit BOB with the STMicroelectronics L3GD20H tri-axis gyroscope is a great entry-level development board. The L3GD20H supports both I2C and SPI interfaces that can connect to Arduino (or another microcontroller) and can be set to ±250, ±500, or ±2000 degrees/second scale for a wide sensitivity range. Again, this sensor requires a 3.3-volt power supply, and the BOB includes a 3.3-volt regulator and level-shifting circuit, allowing it to safely work with 3-volt or 5-volt power supplies and logic circuits.
Similarly, for applications that only require a magnetic sensor, the Adafruit 4479 BOB is a good evaluation choice, featuring the STMicroelectronics LIS3MDL tri-axis magnetometer. The LIS3MDL has a sensing range from ±4 Gauss (±400 microteslas (µT)) to ±16 Gauss (±1600 microteslas or 1.6 milliteslas (mT)). The BOB communicates with Arduino (or another microcontroller) via I2C. Additionally, this BOB includes a 3.3-volt regulator and level-shifting circuit, allowing it to safely work with 3-volt or 5-volt power supplies and logic circuits.
It is common to use multiple sensors in combination. For example, an accelerometer can be used alongside a gyroscope to perform tasks like 3D motion capture and inertial measurement; that is, enabling users to determine how an object moves in 3D space. One such combination is the Adafruit 4480 BOB (Figure 3), which utilizes the STMicroelectronics LSM6DS33 sensor chip.
The tri-axis accelerometer can provide data on which direction is facing the ground by measuring gravity and the acceleration of the circuit board in three-dimensional space. Meanwhile, the tri-axis gyroscope can measure spin and twist. Like the other sensor BOBs introduced, the 4480 BOB also includes a 3.3-volt regulator and level-shifting circuit, allowing it to safely work with 3-volt or 5-volt power supplies and logic circuits. Additionally, sensor data can be accessed using I2C or SPI interfaces without any complex hardware setup, allowing it to work with Arduino (or other microcontrollers).
Another dual-sensor BOB example is Adafruit’s 1120, which utilizes the STMicroelectronics LSM303 sensor chip that combines a tri-axis accelerometer and a tri-axis magnetometer. Communication between the microcontroller and the 1120 occurs via the I2C interface, and this BOB includes a 3.3-volt regulator and level-shifting circuit, allowing it to safely work with 3-volt or 5-volt power supplies and logic circuits.
Some applications require the use of accelerometers, gyroscopes, and magnetometers. In this case, a useful entry-level BOB is Adafruit’s 3463, which features two sensor chips: a tri-axis gyroscope and a combination of a tri-axis accelerometer and tri-axis magnetometer. Communication between the BOB and the microcontroller is achieved via the SPI interface. Furthermore, this BOB includes a 3.3-volt regulator and level-shifting circuit, allowing it to safely work with 3-volt or 5-volt power supplies and logic circuits.
One advantage of the 3463 BOB is that designers can obtain raw data from three sensors. The corresponding downside is that using this sensor (operating and processing its data) will require approximately 15 kilobytes (Kb) of microcontroller flash memory and will consume a significant number of clock cycles.
As an alternative, Adafruit’s 2472 BOB utilizes the Bosch BNO055 sensor chip. The BNO055 includes a tri-axis accelerometer, a tri-axis gyroscope, and a tri-axis magnetometer, all provided in a single package (Figure 4).
Additionally, the BNO055 includes a 32-bit Arm Cortex-M0 processor that retrieves raw data from the three sensors, performs complex sensor fusion, and provides processed information in a usable form for designers: quaternions, Euler angles, and vectors. Specifically, through the I2C interface of the 2472 BOB, designers can quickly and easily obtain the following data:
-
Absolute Direction (Euler Vector, 100 Hertz (Hz)): Tri-axis direction data based on a 360° sphere.
-
Absolute Direction (Quaternion, 100Hz): Quaternion output for more precise data processing.
-
Angular Velocity Vector (100 Hz): Tri-axis “rotation speed,” measured in rad/s.
-
Acceleration Vector (100 Hz): Tri-axis acceleration (gravity + linear motion), measured in meters per second squared (m/s2).
-
Magnetic Field Strength Vector (20 Hz): Tri-axis magnetic field induction (in μT).
-
Linear Acceleration Vector (100 Hz): Tri-axis linear acceleration data (acceleration minus gravity), measured in m/s2.
-
Gravity Vector (100 Hz): Tri-axis gravitational acceleration (minus any motion), measured in m/s2.
-
Temperature (1 Hz): Ambient temperature, measured in degrees Celsius.
On-chip sensor fusion can free up storage space and computation cycles on the main microcontroller, which is very ideal for designers building low-cost, real-time systems. Furthermore, sensor fusion algorithms can be difficult to master and time-consuming. Executing sensor fusion on-chip allows system developers to get started and up and running in minutes without spending days or weeks implementing algorithms from scratch.
Conclusion
Many designers are interested in incorporating motion and direction sensors into their designs but often do not know where to start. For designers who are not accustomed to using these devices, familiarizing themselves with sensors from different manufacturers can also be a challenge. One way to initiate experimentation and prototyping is to use low-cost, open-source microcontroller development boards provided by manufacturers like Arduino, along with low-cost open-source BOBs that incorporate sensors from multiple manufacturers.
Author: Clive “Max” Maxfield
Source: Digi-Key


Disclaimer: This article is original to the author, and the content reflects the author’s personal views. The Electronics Enthusiast Network only transmits a different perspective and does not represent the Electronics Enthusiast Network’s endorsement or support of this view. If there are objections, please contact the Electronics Enthusiast Network.
More Hot Articles to Read
-
Breaking ARM and x86 Barriers, Challenges and Opportunities Facing RISC-V’s Latecomers
-
Potentially Reducing Power Consumption by 1000 Times, Memory-Computing Integrated Chips are Breaking Through
-
GaN Chip Shipments Reach 15 Million! Did You Get the GaN Charger that Fueled the iPhone 12?
-
Ignoring Ethics, the U.S. Has Put SMIC on the Export Blacklist; Flash Memory Controllers Set to Rise in Price | Weekly Technology Review
-
HarmonyOS Arrives as Scheduled, the Cross-Terminal Ecosystem of the Internet of Everything is Within Reach