In the not too distant past, the ability to determine the spatial orientation of an object was far beyond the budget of most hobbyists. Today, there are many reasonably priced sensors available to help you build a walking robot or even a Segway-like balancing bot.
An innovative hobbyist might even utilize an orientation
sensor to help position the gripper on a robot arm.
Choosing a sensor that meets your needs, though, can
be confusing. There are magnetometers (compasses),
accelerometers, and gyroscopes, as well as various
combinations of these devices often referred to as IMUs
(inertial measurement devices). Understanding exactly what
each device measures and how they work can be helpful in
determining what you need for your projects.
The sensing elements in a magnetometer are typically
composed of various thin metallic surfaces integrated with
semiconductor layers in a manner that produces voltages
proportional to an intersecting magnetic field. The readings
from two sensors mounted at right angles to each other
can be used to calculate a compass heading.
The sensing elements in an accelerometer
measure forces from gravity or acceleration. Basically,
each sensor is a capacitor where the distance between
the two plates is proportional to the forces acting on
those plates. The change in capacitance is converted
to a change in frequency or voltage with appropriate
circuitry integrated internal to the accelerometer chip.
Unlike accelerometers, gyroscopes are not
affected by static forces such as gravity. Gyros respond
to changes in angular rotation. Their sensing elements
are tiny vibrating mechanisms that produce forces
perpendicular to the vibration and proportional to the
angular velocity. As with accelerometers, these forces alter
the distance between the plates of tiny integrated
Since magnetometers, accelerometers, and gyroscopes
all respond to different forces, it makes sense to combine
two or even all three of these sensors to create an inertial
measurement device (IMU). The data from multiple devices
makes it possible to accurately depict the sensor’s
orientation. A simple example can clarify this idea.
Figure 1 shows two magnetometer elements (labeled
X and Y) mounted at right angles to each other. Assume
the compass is mounted on the robot so that element Y is
aligned with the robot’s heading. Notice in this figure that
the robot is currently facing north. In this case, element Y
will detect the maximum magnetic effect since it is aligned
with the field. Element X, on the other hand, will detect no
magnetic field since it is perpendicular to it.
Figure 2 shows the same robot (and sensing elements)
now facing NW by 65°. Each of the two elements will now
If you are thinking of building a robot that needs a sense of balance,
you will need an accelerometer and/or gyroscope in addition to the
compass often used by hobby robots. This article will help you
understand how such sensors work and will give you the background
needed to make better purchasing decisions.
Sensing Orientation By John Blankenship
SERVO 07.2016 43