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 - it's pretty simple stuff!
- Connect Vin to the power supply, (red wire in STEMMA QT version). 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 (black wire in STEMMA QT version)
- Connect the SCL pin to the I2C clock SCL pin on your Arduino (yellow wire in STEMMA QT version). 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 (blue wire in STEMMA QT version). 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
- Controller Motor - to motor negative (black wire in STEMMA QT version).
- Controller Motor + to motor positive (red wire in STEMMA QT version).
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 it's the end.
When you are ready to place the full waveform sequence, send the go()
command!
Text editor powered by tinymce.