The Basics
Makers loves servos and, perhaps not surprisingly, some of my favorite servo applications are for building accessible haptic displays such as interactive tactile dials, gauges, and meters.
Servo motors are ubiquitous in hobby robotics. They are awesome little motors that incorporate a feedback system, making them extremely easy to use with Arduino and other microcontrollers. A few decades ago they were quite expensive, having most applications in aerospace or other fancy fields, but with the growth of hobby robotics and the maker movement, to say nothing of the popularity of RC vehicles, the size and price of servos have come down significantly at the same time as the reliability has gone up. Today you can buy little servos for well under $10 each and they are well supported with a Servo Library in the Arduino environment.
Servos come in two basic flavors: those with a range of motion of 0-180° and those that can rotate freely through 360°. Both kinds tend to be small rectangular boxes with a motor shaft sticking out of one side capable of mating with a variety of wheels, gears, arms, and other shapes designed to apply torque in one way or another. 180° servos have a built-in position sensor that lets you set the motor shaft to a specific orientation. Continuous rotation 360° servos have similar sensors, but for motor speed and direction instead of position. We will return to the topic of 360° servos presently. There are many other kinds of specialized servos, but for now we will stick to discussing these two types.
The 180° servos are capable of rotating their shafts through a half rotation and back again like a windshield wiper. More interestingly, you can tell the 180° servo to go to any position between 0° and 180°, and it will faithfully turn the shaft to that orientation and keep it there, even if you physically try to turn it away from that orientation. It's able to do this because it has a built-in sensor (usually a potentiometer) that lets it know what position it's in – if you try to force it away from where it's supposed to be, it tries to move back. This means it can reliably be placed at a specific angle and be counted upon to stay there.
Which Wires Are Which?
Before continuing with the discussion of using servos for accessibility we need to make the servos themselves accessible. Most servos have a color-coded, 3-conductor ribbon cable with a 3-pin female connector on the end. The colors are great if you can see, but if you can't, you'll need to know what's what with the wires.
Place your servo on a flat surface in front of you with the shaft pointing up and the ribbon cable toward you, making sure that the cable lies flat and is not twisted. In this configuration, the wires in the cable are FROUND, POWER, and SIGNAL from left to right for most servos. Check your product documentation if you are using an unusual servo.
Analog Gauges and Why They're Cool
Analog gauges have many distinct advantages over digital or text-to-speech for quantitative output. They are dynamic so readings can be constant rather than sampled at longer intervals. For example, a gauge that wiggles every time a wire is touched lets you know immediately that there's a loose connection, whereas an instrument with only a digital display might not catch this. A quick glance at a gauge lets you know if you are within an acceptable range much more efficiently than a digital readout, and a slightly longer look at the gauge gives you a reasonably accurate quantitative reading. All of these benefits apply to tactile versions of gauges as well.
Blind people have a long history of removing the glass from gauges in order to be able to read the position of the needle by touch. This worked great for analog alarm clocks which were designed to be thrown around a bit, but in most cases the glass is there for a reason: the needle is not designed to be touched. A delicate needle can move while being touched leading to a false reading. Worse, touching the needle could cause a delicate measurement instrument to permanently lose its calibration, leading to a long future of incorrect readings.
Meet the ServoMeter
The 180° servo is an ideal tool for building reliable and inexpensive gauges and meters designed to be touched – a category of displays I have dubbed ServoMeters. The robustness and pushback of the 180° servo is perfect for building tactile gauges, and the addition of tactile markings or braille numbers around the dial makes for an inexpensive, simple, and powerfully quantitative tool.
Servos are also much less expensive than TTS boards, putting tactile displays within easy reach of even the most financially strapped blind maker.
The most basic example of a servometer can be found right in the libraries directory of your Arduino development environment under Servo > Examples > Knob. The Knob.INO sketch demonstrates how to set the position of a 180° servo using a 10K potentiometer. From this example it is only a short hop of the imagination to see how you can use a servo to represent almost any quantitative Arduino output. The following is a modified version of the Knob.INO sketch I have used for teaching about servometers – a fundamental concept of accessible hardware design.
In reality, many inexpensive 180° servos are a little unreliable at the extremes. It's generally best to limit your 180° servometer's range of motion to 160° (i.e. not using the 0-10° and 170-180° ends of the semicircle) as we have done in the sketch above. This can make placement of tactile markings something of a squeeze unless you have a rather long pointer attached to your servometer. For this reason it's often nice to have a gauge with more rotation than 180°. In fact, it's nice to be able to aim a pointer in any direction you want, giving you maximum flexibility with your servometer. Imagine, for example, trying to build a tactile digital compass.
The Continuous Rotation ServoMeter
Arduino communicates with continuous rotation 360 servos using the same servo object as the 180° servos. The Servo.write method accepts a value between 0 and 180, making it super easy to implement the 180° servometer. However, it is not so simple for 360° servos. Continuous rotation servos respond to the 0-180 input by rotating the servo shaft at a particular speed and direction with an input of 90 being no rotation, values slightly larger than 90 rotating the servo shaft slowly clockwise, and values slightly less than 90 rotating the shaft slowly counterclockwise. As values approach 0 or 180 the speed of rotation increases in a counterclockwise or clockwise direction respectively. This is cool, but it makes it pretty hard to rotate the shaft to a particular orientation and keep it there as is needed for a servometer. Luckily, you can buy a special 360° servo with a position feedback sensor built right into the unit. Parallax 900-00360 Feedback 360° High Speed Continuous Rotation
The product I have been experimenting with is the Parallax Feedback 360° High Speed Servo. It includes a Hall Effect sensor that provides reliable feedback regarding the orientation of the servo shaft. It requires a little knowledge of Arduino hardware interrupts and some mental-rotation gymnastics to implement something like the Knob sketch above, but it's not that complicated. The following short sections explain a little about how it works, but if you are impatient, feel free to skip it, download the knobFBS sketch, and start experimenting.
Sensor Feedback
The orientation of the servo shaft is measured not with a pot as is often done with 180° servos, but with a magnetic sensor that uses something called the Hall Effect. Feel free to study up on this cool electromagnetic phenomenon, but you don't need to understand how it works. What you do need to know is that, when the servo is hooked up to power and ground, the sensor sends almost a thousand pulses per second to the Arduino, and that the duration of each pulse is proportional to the angle of rotation. When the shaft is oriented to an arbitrary zero point, the pulses are at a minimum and are extremely short (about 24 microseconds). As the shaft rotates clockwise the duration of each pulse increases until the shaft has rotated almost all the way around to the starting point where the pulses will again become extremely short. Just before returning to zero, the pulses are much longer and are at a maximum (about 1076 microseconds). By measuring the duration of each pulse with the Arduino, and with knowledge of the exact durations of the shortest and longest possible pulses, we can calculate the current orientation of the shaft.
Being able to measure the orientation of the shaft makes it possible to use the servo speed and direction control to automate the movement of the servo shaft to any desired position – exactly what we need for a servometer. It also provides the possibility of using the feedback servo not just to display data, but also as a knob that can be adjusted by the user and read by the Arduino – a nice option for interactive accessible data display and input.
Measuring Minimum and Maximum Pulse duration
The best way to measure short pulses with an Arduino is by using external interrupts. Please feel free to explore this fascinating topic on your own, but for this project you just need to know that it's possible to use interrupts to instantly trigger desired actions through activity on certain digital pins. These actions take place regardless of what the main loop is currently doing, so interrupts are really great for catching input events that might otherwise be missed by a slower loop routine.
The following basicFBS.INO sketch allows you to measure the minimum and maximum pulse durations for your individual unit. It also provides a simple Sonification scheme for the servo's position sensor so you know it's working – as the servo turns clockwise the tone rises to about 1KHz and then jumps back down. Use a serial monitor and a screen reader to read the minimum and maximum pulse widths for use in the next section. I've tried to explain all the specific technical details in the code and comments, so take a careful read through this sketch to understand what's happening.
Now that you have measured the minimum and maximum pulse durations for your feedback servo, you can use the knobFBS.INO sketch below as a starting point for your own 360° servometer. Substitute your measured values for minTime and maxTime in the sketch and you should be up and running. As above, I tried to provide lots of explanatory comments in the sketch itself, so the best way to understand it is to read through it, download it, and play with it.