The DRV2605L is a motor driver from TI. Available on a small break-out board and especially designed for driving a vibration-motor (haptic feedback motor). It comes pre-programmed with 117 different haptic effects, which in combination with the Arduino IDE are very easy to program. The DRV2605 supports two different kind of motors, the (Linear Resonance Actuator) and ERM (Eccentric Rotating Mass). The closed-loop actuator-control system makes it different from driving a motor with a regular transistor based system. Closed loop means that the behavior of the motor is sensed by the driver circuit. The same connections that drive the motor are used to sense the motor’s activity and adapt the driving signal accordingly. Communication between the integrated circuit and a micro-controller is done via the I2C protocol, and is handled within the library. Check the external links.
Pinout and connections
The DRV2605L has two supply-pins, three pins for communication and two terminals for connecting the motor. The motor and the male header pins still need to be soldered on, tips on that can be found here. The supply pin is connected to the positive supply pin of the MCU (Micro-Controller Unit) which must have the same value as the logic level. So, for an Arduino Uno, the supply pin is connected to +5V, but for 3.3V based MCU’s, such as Teensy and ESP32, the supply pin must be connected to the +3.3V line. Ground is connected to ground-pin of the MCU.
The I2C pins, SCL and SDA are connected to A5 and A4, respectively. The IN pin is optional and can be used to feed an audio signal to the driver which will let the motor buzz depending on what kind of sound is coming in.
Programming can be done with the Arduino IDE. Start by downloading and installing the library for the DRV2605L which can be found here. Within the library are some excellent example codes to try out. For those who want to write their own code, remember to include ‘Wire.h’, declare an object drv of class Adafruit_DRV2605 by typing
under the inclusion of the library itself and put these lines of code in the setup().
// I2C trigger by sending ‘go’ command
// default, internal trigger when sending GO command
Now, all that is left is to add the following lines of code at the right place in the sketch and upload it to the Arduino.
// set the effect to play
drv.setWaveform(0, effect); // play effect
drv.setWaveform(1, 0); // end waveform
// play the effect!