DRV2605 Haptics Driver
Overview of Haptics, the TI DRV2605 Haptics Driver, DRV2605 Library, and Demo
Hello World
Import programDRV2605L_Haptic_Driver_Demo
Basic DRV2605 driver demo
Library
Import libraryDRV2605
Basic I2C Driver for the TI DRV2605 Haptic Driver. Currently only supports Open-Loop ERM operation using internal Immersion TouchSense 2200 software/library, although user can use the Read/Write Byte methods to manually set registers and control the device.
Pinout
Datasheet
http://www.ti.com/lit/ds/symlink/drv2605.pdfNotes
Haptics
Introduction
There is no doubt, by now, that we have all felt the vibratory sensation through our finger tips as we tap away at our smartphone writing a text message to our friends about the unbound excitement in Dr. Hamblen's Embedded Systems Design class. With each tap a slight, yet eloquent, vibration kisses our finger tip... and for the briefest of moments in time, an ethereal sensation of times long ago. A time when, the all but extinct, tactile switch gave us the pleasing sensation of a click, much like the clicking of a Snapple bottle cap in the back of our parents car as we drove for miles and miles.
Haptics is a form of user interface feedback in hardware applications. More specifically haptics leverages the human sense of touch. Haptics is an emerging field that uses tactile feedback through vibrations to communicate with the user.
Applications
Haptics can be found in many application. Any application in which a user is touching a device could possibly implement haptics. Just a couple examples that currently exist are:
- Smartphones: Creating the sensation of clicking a mechanical button while we type or select buttons. *Image: http://2.bp.blogspot.com/-jyhUDbh6xm4/T0fPr3d0T9I/AAAAAAAABFg/iP5UIBN3W98/s640/haptic.png
- Game Controllers: Creating vibratory feedback during game play, such as shooting a gun, blowing stuff up, or driving off road.
- Image: http://www.nigerianbestforum.com/generaltopics/wp-content/uploads/2010/07/48235893_009429652-1.jpg
How it Works
Haptics implements precise waveforms to control vibratory actuators to create unique tactile vibration feedback. By creating precise waveforms different effects, such as a 'click', 'buzz', or complex effect, can be created to indicate to the user different information.
Haptics Actuators
The three common actuators used in haptics applications are listed below. Each actuator has its own benefits.
- ERM - Eccentric Rotating Mass, more commonly known as a 'pager motor' or 'vibration motor. The ERM is essentially a common DC motor that rotates an off-center mass, creating a vibration when it spins. ERMs are the least precise in waveform playback, but are very cost effective.
- LRA - Linear Resonant Actuator uses the resonant frequency of a spring- mass system to create vibrations. It offers higher precision than the ERM and is the most power efficient of the three devices.
- Piezo - Uses piezo-electrics to produce vibrations. Piezos offer high-fidelity waveform playback.
Drivers
Unlike simple vibrations, to create complex haptic feedback an actuator must be precisely controlled. Further waveforms must be created for different effects and played back on the actuator accurately. Many factors must be considered in the operation of the actuator as well as waveform development. Waveforms can be fairly complex, and have long playback times (hundreds of milliseconds for some!). Actuators are mechanical devices and must have circuitry able to drive it. Microcontrollers are often unable to drive such a load directly, and thus require supporting circuitry. Given the processor time required and circuitry needed it is often best to use an IC driver specifically designed for haptic devices.
DRV2605 Haptics Driver
The Texas Instruments DRV2605/L offers a complete solution to haptics ERM and LRA control and waveform playback. It offers open-loop and closed-loop control methods to optimize start-up and braking. I2C is used for communication between the DRV2605 and host processor. The user can create waveforms by streaming I2C data. The DRV2605 also has methods for analog and PWM inputs.
Most notably it offers Immersion's TouchSense 2200 software/library, which has 123 haptic waveforms. The TouchSense waveforms can be played individually, or a sequence of up to eight waveforms can be played successively.
If that all wasn't enough the DRV2605 offers an Audio-to-Vibe mode that transforms audio into a tactile experience for the user.
Hardware Description
Given the great depth of options this small chip offers, only the open-loop ERM TouchSense Library mode will be discussed. The top portion of the schematic (the DRV2605 and ERM motor) shows the basic setup for the device. The "IN" pin is left as a "no connect" as the library uses only I2C interface for control. The bottom portion of the schematic shows the Sparkfun MPR121 Breakout board that is utilized for user input in the DRV2605 library demo.
Library Description
The Library supports basic Open-Loop ERM Immersion TouchSense 2200 software/library operation. User should run the init() function prior to using other methods. After successful calibration user can make calls to play_waveform() to play a single Immersion TouchSense 2200 library waveforms. To play a sequence of waveforms user can use the load_waveform_sequence() to load desired sequence of waveforms and then call the play() method to start sequence playback. If the user has issues getting the ERM motor to run, use the diagnostics() method to perform device/actuator diagnostics. The return value is the diagnostics results from the DRV2605 STATUS Register (0x00). The register will indicate a lot of useful information for debugging. Refer to device datasheet STATUS Register (0x00) description for the meaning of the returned results.
Import libraryDRV2605
Basic I2C Driver for the TI DRV2605 Haptic Driver. Currently only supports Open-Loop ERM operation using internal Immersion TouchSense 2200 software/library, although user can use the Read/Write Byte methods to manually set registers and control the device.
The starting Member Function Line Up
This section takes a quick glance of the main member functions of the DRV2605 class that will be used be the user in an application.
- DRV2605(PinName sda, PinName scl) - Constructor for DRV2605 objects. Takes care of setting up the I2C bus.
- int init(float actuator_peak_voltage, Library lib = B) - Initializes the device, runs calibration, etc. This should be called after the constructor before using other methods. The return value contains the auto- calibration results (see device datasheet STATUS Register (0x00) description).
- uint8_t diagnostics() - Performs diagnostics on the actuator and device. Great place to start debugging if something is not working. See device datasheet STATUS Register (0x00) description.
- void play_waveform(int waveform_effect) - Play a single waveform from the Immersion Touch Sense 2200 library. Valid entries are 1 to 123. Refer to device datasheet for a description of each waveform.
- void load_waveform_sequence(int effect1 = 0, int effect2 = 0, int effect3 = 0, int effect4 = 0, int effect5 = 0, int effect6 = 0, int effect7 = 0, int effect8 = 0) - Loads up to eight Immersion Touch Sense 2200 waveforms in to the Sequence Registers of the device. By starting playback each waveform will be played back sequentially until the end of the sequence registers or until a value of 0 is reached.
- void play() - Plays the currently loaded waveform or waveform sequence. This function should be called only after calling the play() method or the load_waveform_sequence() method at least once.
Demo Program
The Demo Program utilizes the Sparkfun MPR121 Keypad Breakout Board and the Adafruit DRV2605L Breakout Board. The keypad provides user interface with haptics. All keys, except '4' and '8', are valid inputs. Each key press plays a single waveform. Each key cycles through about 10 waveforms, key '11' has about 12 or 13. This setup allows the user to experience all the waveforms in the Immersion library.
Import programDRV2605L_Haptic_Driver_Demo
Basic DRV2605 driver demo
The demo starts by performing auto-calibration and diagnostics and printing the results of the STATUS Register (DRV2605 0x00) to a USB virtual com port (not shown in the video). It then loads the DRV2605 Sequence Registers (0x04 to 0x0B) with eight unique wavefroms from the Immersion TouchSense 2200 effects library located in ROM on the DRV2605. After playback of the sequence, a new sequence is loaded and played two seconds later. After completion of the second sequence the program waits for user input via the touch keypad.The video shows the playback of a single Immersion waveform effect for each key press. Different keys play a different effect, and each key also cycles through a given set of waveforms allowing the user to play all effects in the Immersion library.
References
DRV2605 Specific Documentation
- TI DRV2605 Product Page, includes data sheet and techincal documentation http://www.ti.com/product/drv2605
- DRV2605 Datasheet download http://www.ti.com/lit/ds/symlink/drv2605.pdf
- DRV2605 Setup Guide, a more concise guide to setting up and configuring the device http://www.ti.com/lit/an/sloa189/sloa189.pdf
- Adafruit DRV2605L Breakout Board Product Page, Contains product instructions and getting started material https://learn.adafruit.com/adafruit-drv2605-haptic-controller-breakout/overview
Haptics References
- A little light reading in the introduction of Haptics and Haptics design http://www.precisionmicrodrives.com/haptics-haptic-feedback-vibration-alerting
Where to Buy Stuff
- Adafruit DRV2605L Breakout Board https://www.adafruit.com/products/2305
- Adafruit ERM Motor https://www.adafruit.com/products/1201
- Sparkfun MPR121 Keypad https://www.sparkfun.com/products/12017
You need to log in to post a discussion