What The Tech

Gauge Stepper

Rob Bell & Mike Hansell

Issue 15, September 2018

This article includes additional downloadable resources.
Please log in to access.

Log in

Want to make your own analogue gauge? Now you can with the Adafruit x27.168 Automotive Gauge Stepper Motor.

Have you ever wondered about the mechanics behind your vehicle’s dashboard? While many modern cars and motorcycles have high-resolution digital displays in the dashboard, there are often still a few traditional analogue gauges at least.

For some applications, an analogue gauge can be better at displaying the measurement compared to a numerical digital. For instance, it's more noticeable to see the fuel gauge needle close to empty, compared to seeing numbers of litres left.

If you were asked to guess what drove those mechanical gauges, a servo motor would be an acceptable response. However, a stepper motor would also be an acceptable response! In fact, both are used in real and simulation dashboards. It really comes down to their specific application, who designed them, and various other design considerations along the way.

Stepper motor based gauges are a great way to control a pointer gauge. They are small in size, low power and can respond with a smooth but quick movement. The hundreds of steps allow them to be very accurate as well.

This brings us to the Adafruit x27.168 Stepper Motor, which we were introduced to in a recent Adafruit New Products video. We were captivated by their video demonstration so we had to get one to play with ourselves.

WHAT IS IT?

The Adafruit x27.168 Stepper Motor is an awesome piece of hardware. It’s really not unique to Adafruit, but that’s where we found it, and indeed the stock available via Core Electronics comes from Adafruit too.

The product we received wasn’t supplied with a datasheet and we couldn’t see one on their website. They did have a link to a datasheet for a similar gauge though, which is enough to get us started.

A quick internet search of the part number “X27.168” which is printed on the unit, alludes to GM motors and Chevy trucks using these gauge steppers. Whatever their history, they appear to be well-made. They also include a red gauge needle, similar to what you see on many dashboards.

The stepper is quite small. It measures just 32mm in diameter by 9mm deep and has a needle length of 42mm. There are two mounting holes and a quick look at the back shows four PCB mount pins. Conveniently, these are at a standard pitch to fit into a breadboard.

A FEW DIFFERENCES

As is the case with any 4-wire stepper motors, its operation can be made simply using a dual H-bridge driver and an Arduino. However, there are a few key differences between this stepper motor and ones that you may have come across before.

Noise

Usually, stepper motors and servos are horrifically noisy. We can, after all, make music with 3D printers as a byproduct of this noise! This stepper is very quiet, far quieter than a NEMA style servo or a standard hobby servo, even when moving quickly.

Limited Range

Unlike most stepper motors, this unit does not allow continuous revolution. It has an effective rotation of 315°, which is perfect for gauge use. You won’t be able to use it for any continuous rotation applications though.

Low Torque

It’s clearly designed to point a needle rather than drive a substantial load. The torque is low enough that a simple finger in the way of the needle is enough to make the internal gears slip and stop. It appears, however, that this may be by design. An internal inspection of the gears shows little to no wear even after this happening for some time. This slippage can also assist with “zeroing” the needle to the first or last step since the internal stopper will prevent the drive pin from over-rotation too (since you cannot drive at -10km/h, this makes sense). This is indeed handy, so no “memory” of gauge position needs to be stored during power off, simply reset and expect it will be at the zero point.

GETTING IT RUNNING

While there was no recommended operating voltage provided, given it’s an automotive-origin item, it was safe to assume that 12V is within normal operating voltages.

We managed to get it running successfully from 5V, but as soon as we tried to bump the speed it would bind or not turn. This is an artifact often found with stepper motors, with many steppers allowing faster steps with higher voltages. The shift from 5V to 12V power was almost a 2-fold increase in reliable stepping speed during some of our tests. 12V power is recommended.

With no solid datasheet available, specs are a little ambiguous, but here’s what we do know.

AXIAL FORCE MAXIMUM: 150N

AXIAL PULL FORCE MAXIMUM: 100N

RADIAL FORCE MAXIMUM: 12N

ROTATION ANGLE MAXIMUM: 315°

COIL RESISTANCE: 260 ohm

GENERAL TOLERANCE: ± 0.1 / ± 5°

ROTATION ANGLE MAXIMUM: ~315°

600 STEPS PER ‘ROTATION’ (315° ROTATION)

That was enough information for us to get something working, which describe in the following practical example.

Practical Example:

Parts Required:Jaycar
1 × Arduino UNO or EquivalentXC4410
1 × Adafruit x27.168 Stepper Gauge-
1 × L293D H-Bridge Motor Driver ICZK8880

You’ll also need a breadboard and prototyping hardware, as well as a 12V and 5V supply.

To test the gauge, we came up with a simple circuit using an Arduino UNO to control an L293D dual H-bridge motor driver IC that drives the gauge. This setup requires only 4 GPIO pins on the Arduino, leaving quite a number free for other purposes.

The armature of the motor has a needle attached which acts as a good pointer. The full range of the needle’s travel is 315° or about the 7 o’clock position around to the 5 o’clock position. For this range of movement, 600 pulses are required, which is why we have used an L293D IC in the usual H-bridge configuration.

BUILDING THE CIRCUIT

Follow the Fritzing diagram shown above to wire up your circuit onto a breadboard. You may notice that the wiring of the L293D IC is a little unusual. This is fairly standard for an H-bridge though. It’s a 16 pin device and has +5V applied to pin 16 for logic references, as well as +12V from an external supply to pin 8 for actual drive signals.

THE CODE

We have written a sketch that rotates the gauge pointer from min to max and loops. Load up the “stepper_gauge_demo.ino” sketch from the digital resources. You can adjust the delay in the loop to test the limits of the step sequences. You’ll quickly notice the limitations where the sweep becomes unreliable, however, you are unlikely to damage the stepper and it’s an interesting experiment.

Note: Attempting to drive it past it’s minimum or maximum position doesn’t seem to damage it but we don’t recommend doing this on purpose or repeatedly.

WHERE TO FROM HERE?

You could easily create an impressive cluster of gauges into a single panel, and drive them with whatever input signals you would like. Being stepper motors at heart, the only limitation is the control circuitry and how creative you can get!

Adafruit x27.168 Stepper Motor available at Core Electronics: www.core-electronics.com.au

  • Adafruit x27.168 Stepper Motor ADA2424 $16.95