A Tale of Two Trackers

作者:Tom Cantrell

投稿人:Convergence Promotions LLC


A Hall effect sensor and an ‘optical finger navigator’ present two easy ways to let your finger do the walking.


By now it is just older readers (and writers) who can recall a time when if you could not do it with a keyboard, it didn’t get done. Remember when disco-era arcade and home video games gave us the joystick, ushering in the ‘point and shoot’ era? Has it really been almost 30 years since Apple unleashed that now ubiquitous rodent, the mouse?

Now touch screens are all the rage, but they do come with some usability limits. For example, if the screen is too small, your finger obscures the view, making it difficult to see exactly what you’re selecting. Also, a touch screen really isn’t suitable for single-handed ‘road-warrior’-style one-hand operation – that is, holding the device in the palm and pointing/selecting with the thumb.

You might be thinking that what the world needs now is a traditional mouse/joystick pointing device, but one evolved to meet the needs of modern applications – namely one that it smaller, smarter, and lower power. Well, when it comes to silicon it’s “ask and ye shall receive.” Let’s take a look at two trackers that enable you to prod your application into action while barely lifting a finger.

Easy does it

Hall effect sensors aren’t new. The phenomenon – voltage generated when current flows in the presence of a magnetic field – was discovered by Edwin Hall in 1879. No surprise that Hall effect applications are historically old-school blue-collar stuff like burglar alarms and simple rotation and proximity sensors. These applications benefit greatly from the advantages the Hall effect offers: non-contact, no moving parts, and the ability to work in harsh environments that would put fussier mechanical and optical sensors down for the count.

Figure 1: The austriamicrosystems AS5013.

Figure 1: The austriamicrosystems combines Hall effect sensors and digital logic to integrate a complete finger-tracking joystick on a chip.

austriamicrosystems’ EasyPoint™ AS5013 re-purposes Hall’s ancient art to serve our modern need for a smaller joystick. As shown in Figure 1, the concept is intriguingly simple. Just lay down four Hall effect sensors on the corners of an IC (and one in the center for good measure) and you can determine the position of a small magnet. Better yet, the AS5013 does all the head scratching for you, converting and signal processing the raw magnetic field data to deliver the digital answer you need – the XY coordinates – via I2C bus.

With 8-bit resolution for the XY coordinates across a 4 mm area of magnet travel (+/-2 mm from center) we are talking about very precise position sensing – in the range of tens of micrometers. Edwin would be pleased. Besides the chip itself, austriamicrosystems also offers a variety of ‘EasyPoint’ modules (see Figure 2) that integrate the AS5013 into a complete joystick package.

Figure 2: EasyPoint modules that combine the AS5013 Hall effect IC with a magnet and centering spring.

Figure 2: For a turnkey solution, austriamicrosystems offers a range of EasyPoint modules that combine the Hall effect IC with a magnet and centering spring.

Remember that the electronics are only half the battle. The mechanical aspects can be daunting as well, a fact that becomes all the more apparent when you pop the EasyPoint hood. There is definitely some precise machine work here (see Figure 3), including an intricate spiral centering spring and tactile pushbutton action for ‘clicking’ the stick.

Figure 3: The joystick's self-centering action relies on a precision spiral spring.

Figure 3: The joystick's self-centering action relies on a precision spiral spring to achieve the optimum combination of centering accuracy and repeatability with ease of actuation.

Any gadget destined for mobile applications must include power management features to extend battery life. This is all the more true for a pointing device, considering that the duty cycle may be low, with long periods of inactivity while the user looks at the screen, talks on the phone, and so forth.

EasyPoint offers a combination of hardware and software power management, a versatile approach that offers the best of both worlds. During normal operation you simply initialize a control register specifying the sample rate – there are eight options between 20 and 320 ms – and EasyPoint automatically checks for motion at the chosen interval. You can configure EasyPoint to interrupt an attached MCU with each reading, or alternatively to ignore motion within a user-defined ‘dead zone’ around the center.

At any time, you can switch to software driven mode in which the MCU initiates position readings and thus controls the sample rate. This lets you override the built-in sample timing and take position readings at high speed or when it is otherwise convenient for your application, such as by piggybacking on an existing sleep timer routine.

FingerCam

The second tracker in this tale comes courtesy of Avago Technologies US, Inc. Their ADBS-A320 Optical Finger Navigation (OFN) sensor is a marvel, essentially a complete ‘finger recognition’ camera on a chip (see Figure 4).

Figure 4: The Avago OFN silicon.

Figure 4: The Avago OFN silicon is quite complex, and so is the special lens that brings your finger into focus.

Under the plastic window – actually a special Avago-supplied ‘lens’ – there is a lot going on. An IR LED illuminates the window, and an image acquisition system captures a 19 x 19 pixel array. Next, a built-in DSP searches the image for the fingertip and computes the change in location, providing an 8-bit ΔX and ΔY for delivery via I2C or SPI. The tracking capability is impressive, with selectable resolution from 250 all the way to an amazing 1250 counts per inch.

The OFN handles its own power management by automatically down-shifting the sample rate during periods of inactivity. The only caveat is that the timing – which determines how much and when the sample rate is changed – is hardwired, as shown in Table 1. Alternatively, you can take control of matters via the SHUTDOWN pin (preserve registers) or even just power off the chip (require register initialization) if that works for your application.

Mode Response Time (nominal) Downshift Time (nominal)
Rest 1 19.5 ms 250 mn
Rest 2 96 ms 9.5 s
Rest 3 482 mn 582 s

Table 1: Hall effect device accuracy with higher pole-pair count.

Here again you can take advantage of an integrated solution if you prefer not to mess with the chip packaging, lenses, and such. Parallax, Inc. offers a clever solution that floats the encapsulated ADBS-A320 module on top of a small metal ball, which in turn rests on a dimple switch. This gives the setup a positive clicking action and also allows the OFN some leeway to move with your finger, a bit of ‘wobble’ that actually enhances the controllability and feel.

Take a spin

Time for a little hands-on, more correctly ‘finger-on’, testing. I used a development board from Parallax, Inc. to connect the EasyPoint and OFN modules to the Parallax Propeller multicore MCU. As you can see in Figure 5, the hardware interface between the trackers and MCU is blessedly simple, just a half-dozen or so lines each, including power, I2C, interrupt, and reset.

Figure 5: The EasyPoint and OFN modules.

Figure 5: The EasyPoint and OFN modules both include I2C interfaces (the OFN has SPI as well), so connection to an MCU is easy as can be.

Thanks to its built-in intelligence, the software is easy too. It was not long before I was poking at the trackers and displaying the changing XY coordinates on the PC screen. While that was sufficient for a basic checkout, it was hard to get a feel for how the numbers streaming by would translate into a real-world application.

I needed to actually see a cursor moving on a screen, ideally a small one like you’d find in a typical handheld application. Scrounging through my gear I could not find a spare ¼ VGA or the like that was not otherwise occupied. Then, I noticed the bottom of my junk drawer contained an old handheld LCD TV. Well it just so happens one of the features of the Propeller is unique high-speed timer logic that enables it to generate composite video. While the TV did not have an AUX IN connector, the Propeller is fast enough to modulate said video for broadcasting. I just hung a jumper cable on the Propeller pin sourcing the video, tuned the TV to channel 2, and voila, I was – literally – on the air (Figure 6).

Figure 4: Portable TV used to get a feel for how the trackers would work.

Figure 6: Exploiting the Propeller ability to broadcast video, I was able to use a portable TV to get a feel for how the trackers would work in their likely small-screen applications.

Taking advantage of existing software in the Propeller library (I2C, video, and graphics), I quickly cobbled together a simple test program that let me move a cursor around the 256 x 128 TV screen. This worked great, giving me a true ‘feel’ for the way the modules would actually perform in a small screen application.

I made versions of the program for each of the tracker modules, allowing side by side comparison. Let’s take a look at the code, starting with the OFN. As you can see in Figure 7, after a bit of initialization the program sits waiting (WAITPNE statement) for either a MOTION or BUTTON interrupt from the OFN. When either or both are asserted, the program calls for the display to update (UpdateTV) using the corresponding ‘normal’ or ‘button’ cursor, and then goes back to sleep waiting for the next MOTION or BUTTON pin trigger.

Figure 7: Software to drive the OFN.

Figure 7: Software to drive the OFN is simple, especially if you rely on the unit's built-in automatic "downshift" power-management capability.

The UpdateTV routine is where the action begins. It’s a two-step process of interrogating the OFN to determine the new cursor position and then updating the display.

Getting the ΔX and ΔY readings is as simple as reading the so-named OFN registers. Notice that I found it helpful to scale horizontal motion by a factor of two so I could easily sweep the entire screen. Otherwise, there were times when I had to lift and reposition my finger when it hit the edge of the OFN before the cursor reached the edge of the screen. Next it’s a simple matter of calculating the new position from the old and clipping the result to keep the cursor on the screen. To update the display, the position is translated to put (0,0) in the center and then the display is redrawn with the newly positioned cursor of the requested type (‘normal’ or ‘button’) and updated coordinate values.

Now let’s take a look at the EasyPoint version (Figure 8). It’s a little more involved, but hardly rocket science. The difference is due to EasyPoint’s hybrid hardware/software power management scheme and also the fact that it’s a joystick which has offset (centering) issues that the mouse-like OFN doesn’t.

Figure 8: EasyPoint software.

Figure 8: EasyPoint software is a little more difficult because you are responsible for a) dealing with the offset intrinsic to a joystick but not a mouse; and b) power management - that is, detecting inactivity and "downshifting" the sample rate.

Once again, you can see that the program starts by waiting for an INT or BUTTON pin event. As an aside, note that for both trackers the button is completely separate from the motion tracking silicon; the motion or a button press may occur at any time.

At the start of the program (EasyPointInit), the EasyPoint is initialized to use its slowest and thus lowest power sampling rate (320 ms). So once something happens (INT, BUTTON, or both), the program switches the unit into software-driven sampling mode for faster response. Then, much like the OFN version, the program calls for a display update using the appropriate cursor. The only embellishment is that the software keeps track of a nomotion flag. If no motion occurs for timeout (a user-defined constant) samples, the program puts the EasyPoint back into low-speed, power-sampling mode and displays a ‘sleep’ cursor.

Moving on to the UpdateTV routine, you can see that the new cursor position is read directly from the EasyPoint. Note that the x_reg reading is assigned to the y variable and vice-versa. That is not a typo, it is a convenient way to accommodate my particular mounting orientation (that is, rotated 90 degrees). Remember to read the modules y_reg last, since that clears the interrupt in preparation for the next reading.

As with the OFN, I found it preferable, indeed necessary, to double X for a better match with the display’s widescreen (2:1) aspect ratio. Next, the position reading is compensated for this particular unit’s center offset. The following step involves checking whether the motion exceeds a threshold (another user-defined constant) that qualifies as meaningful (i.e., not just jostling in a pocket). If not, the nomotion counter is incremented, which eventually (when it exceeds threshold) will cause the main loop to put the EasyPoint back into low-speed, low-power mode. Finally, the display is updated using the same code shown in the OFN example.

Apples and oranges

So how did the units perform in my kick of the tires? Before getting into the results, I must remind you that a joystick (EasyPoint) is fundamentally different than a mouse (OFN). That is quite apparent if, for example, you ever tried playing a video game with a mouse or using a word processor with a joystick.

It is kind of like the difference between AC and DC; just as with electricity, you can enable a joystick and mouse to stand in for each other by using the software equivalent of a rectifier or inverter. However, a joystick has a unique advantage – a ‘ground reference’, if you will, in its spring-loaded, self-centering action.

The good news is that your application can take advantage of the fact that a joystick returns to the center. The bad news is that there is inevitably an offset error – when the joystick is released and centered by the spring, it will not necessarily end up exactly at (0,0). While there is no specification for this in the datasheet, the EasyPoint I used tended to center itself around (-10,18).

Your software can compensate for this, as does my program; just watch out for subtle side effects. For instance, in this example, multiplying the X reading by two was not just a matter of speeding up cursor motion. With an X offset of -10, the compensated X-position ranges from -118 to +137 which means a) absent of doubling the value, the cursor will not be able to reach the left edge of the screen, and b) the value no longer fits in a single byte.

The bottom line

Now that the mouse versus joystick issue is out of the way, here is my experience poking around.

Both trackers are very responsive. Notably, thanks to its direct position reading, the EasyPoint can move the cursor from one edge of the screen to the other in an instant, while the OFN exhibits a vestige of a mouse-like trail. The bottom line is that both are plenty fast, so speed of response is not an issue.

Both devices feature very fine control, being able to quickly zero in within a few pixels of a desired location. Here the OFN has a bit of an advantage with a very light and direct feel. EasyPoint is certainly acceptable, but can not help but suffer a bit with a spring in the mix.

The button action award goes to the OFN. It was easy to zero in on a spot and then click on it. By contrast, trying to click with the EasyPoint tended to move the cursor before the switch closed. Indeed, I noticed in the EasyPoint datasheet that the force required to actuate the button is rather higher than the lateral force to move the joystick. Practice makes perfect, so I suspect a combination of user experience and suitable tuning of the user interface and driver software would counter the EasyPoint tendency to miss the target.

On the other hand, in many user interfaces ‘click’ is followed by ‘drag’ and here EasyPoint gets the nod. Controllability suffers a bit from the fact that your finger is doing double duty, both moving the cursor and pushing down to overcome the stiff button action, but at least your finger remains centered and aligned relative to the switch action. With the OFN there was a tendency (likely exacerbated by the ‘wobble’ feature) to prematurely ‘unclick’ when my finger neared the edge of the touch surface because the downward force becomes less centered and aligned with the switch action.

EasyPoint is the easy winner when it comes to power consumption. As you can see in the measurements I took (see Figure 9), the module burns a mere 100 µA during full-speed sampling (about 30 Hz), dropping to less than 10 µA when idling (about 3 Hz).

Figure 9: If you're looking for a low-power solution, look no further than the EasyPoint.

Figure 9: If you're looking for a low-power solution, look no further than the EasyPoint.

Not surprisingly, the OFN’s blazing LED and ‘brainiac’ image processing calls for a hearty power supply. Fortunately, the built-in power management takes the edge off with an automatic ‘downshift’ scheme that you can see at work in Figure 10. Peak power demand of 4 mA quickly drops after just a fraction of a second of inactivity (REST1), then again after about ten seconds (REST2), before ultimately (after nearly ten minutes, not shown here) bottoming out (REST3).

Figure 10: The OFN consumes a lot of peak power.

Figure 10: The OFN consumes a lot of peak power, so power management is a must, which explains why Avago went to the effort to include it.

The bottom line is that EasyPoint consumes roughly the same power running full bore as the OFN does in its deepest sleep mode. Note that both of these modules were running at 3.3 V; the silicon can get by with less, but running them at their lowest voltage would not materially change the results. While the OFN automatic power management is nice, battery-driven applications would benefit from additional ‘timeout’ software (as in the EasyPoint code) to explicitly shutdown the module, perhaps using the pushbutton (rather than finger motion) as a wakeup signal.

Ultimately, whether your application calls for a joystick (absolute position reading with centering) or mouse (relative position change) may be the deciding factor. Or maybe one of the other differences (EasyPoint low-power; OFN nice feel, easy software) will be pivotal.

Whichever you choose, I think this tale of two trackers has a happy ending.

References
  1. austriamicrosystems AS5013 Hall sensor and EasyPoint modules
  2. Avago ADBS-A320 Optical Finger Navigator (OFN)
  3. Parallax Propeller Development Board and OFN module

免责声明:各个作者和/或论坛参与者在本网站发表的观点、看法和意见不代表 DigiKey 的观点、看法和意见,也不代表 DigiKey 官方政策。

关于此作者

Tom Cantrell

关于此出版商

Convergence Promotions LLC