Arduino Code

Wiring for Arduino

You can easily wire this breakout to any microcontroller, we'll be using an Arduino. For another kind of microcontroller, just make sure it has I2C capability, then port the code - its pretty simple stuff!

  • Connect Vin to the power supply, 3-5V is fine. Use the same voltage that the microcontroller logic is based off of. For most Arduinos, that is 5V
  • Connect GND to common power/data ground
  • Connect the SCL pin to the I2C clock SCL pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A5, on a Mega it is also known as digital 21 and on a Leonardo/Micro, digital 3
  • Connect the SDA pin to the I2C data SDA pin on your Arduino. On an UNO & '328 based Arduino, this is also known as A4, on a Mega it is also known as digital 20 and on a Leonardo/Micro, digital 2

Install Adafruit_DRV2605 Library

To begin controling the motor chip, you will need to install the Adafruit_DRV2605 Library. You can do that by going to the Arduino library manager under Sketch -> Include Library -> Manage Libraries...

Then search for DRV2605 and find the Adafruit DRV2605 Library and click Install

We also have a great tutorial on Arduino library installation at:
http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use

Load Demo Sketch

Now you can open up File->Examples->Adafruit_DRV2605->basic and upload to your Arduino wired up to the breakout

Open up the serial console and hold the vibration motor between your fingers.

The sketch will play all 123 built in vibration effects in order. The full list with names is available in the DRV2605 datasheet

Here's a screenshot for quick reference

Multiple Waveforms

You can also string together multiple effects in a row, up to 7. Check out the complex example sketch, and setWaveform for each slot. The last slot should be set to 0 to indicate its the end.

When you are ready to place the full waveform sequence, send the go() command!

Audio

You can also turn the DRV2605 into an audio-to-vibration driver. Use a 1uF capacitor in series to line level voltage audio into the IN pin, then load up the audio example sketch. If you don't feel anything, try boosting up the source audio volume, it has to be pretty loud!

This guide was first published on Dec 17, 2014. It was last updated on Dec 17, 2014. This page (Arduino Code) was last updated on Nov 11, 2019.