The DRV2605l complete with motor and pinheaders soldered

The DRV2605l complete with motor and pinheaders soldered

Intro

The DRV2605L is a break-out board motor driver especially designed for small haptic feedback motors. It comes pre-programmed with a whopping 117 different effects which in combination with the Arduino IDE are super easy to program. The DRV2605 supports two different kind of motors, the (Linear Resonance Actuator) and ERM (Eccentric Rotating Mass), where ERM is the more common of the two. Communication is done via the I2C protocol, and is handled within the library. The DRV2605L is available for $7.95 on adafruit.

Pinout and connections

The DRV2605L has two supply-pins, three pins for communication and two terminals for the motor. The motors 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(MicroController Unit) which must have the same peak 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 the ESP8266, 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.

In short:

DRV2505 Arduino
VIN +5V/+3.3V
GND GND
SCL A5
SDA A4
IN

Programming

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

Adafruit_DRV2605 drv;

under the inclusion of the library itself and put these lines of code in the setup().

[code lang=”cpp”]
drv.begin();

drv.selectLibrary(1);

// I2C trigger by sending ‘go’ command
// default, internal trigger when sending GO command
drv.setMode(DRV2605_MODE_INTTRIG);
[/code]

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.

 

[code lang=”cpp”]
// set the effect to play
drv.setWaveform(0, effect); // play effect
drv.setWaveform(1, 0); // end waveform

// play the effect!
drv.go();
[/code]