Adafruit DRV2605 Haptic Controller Breakout Created by lady ada Last updated on 2018-02-27 02:38:17 AM UTC
Guide Contents Guide Contents Overview Pinouts 2 3 6 Power Pins I2C Pins Other! 6 6 6 Assembly 8 Prepare the header strip: Add the breakout board: And Solder! Attach Motor 8 9 10 11 Arduino Code Wiring for Arduino Install Adafruit_DRV2605 Library Load Demo Sketch Multiple Waveforms Audio CircuitPython Code Library Installation Usage Downloads Datasheets Schematic Fabrication print © Adafruit Industries https://learn.adafruit.
Overview The DRV2605 from TI is a fancy little motor driver. Rather than controlling a stepper motor or DC motor, its designed specifically for controlling haptic motors - buzzers and vibration motors. Normally one would just turn those kinds of motors on and off, but this driver has the ability to have various effects when driving a vibe motor. For example, ramping the vibration level up and down, 'click' effects, different buzzer levels, or even having the vibration follow a musical/audio input.
This chip is controlled over I2C - after initialization, a 'string' of multiple effects can be strung together in the chips memory and then triggered to actuate in a row. The built in effects are much much nicer than just 'on' and 'off' and will make your haptic project way nicer feeling. © Adafruit Industries https://learn.adafruit.
According to the product page, it can be used with both LRA (Linear Resonance Actuator) and ERM (Eccentric Rotating Mass) type motors but we have only used it with our little vibration pancake ERM. We put this nice chip onto a breakout board. it works with both 3V and 5V power/logic, we have code specifically for Arduino but porting it to any I2C-capable processor should be quite simple. Check it out and get buzzing! © Adafruit Industries https://learn.adafruit.
Pinouts Power Pins The motor driver/controller on the breakout requires 3-5V power. You can use either, whichever logic level you use on your embedded processor Vin - To power the board, give it the same power as the logic level of your microcontroller - e.g. for a 5V micro like Arduino, use 5V GND - common ground for power and logic I2C Pins SCL - I2C clock pin, connect to your microcontrollers I2C clock line. This pin can be used with 3V or 5V logic, and there's a 10K pullup on this pin.
command. © Adafruit Industries https://learn.adafruit.
Assembly Prepare the header strip: Cut the strip to length if necessary. It will be easier to solder if you insert it into a breadboard - long pins down © Adafruit Industries https://learn.adafruit.
Add the breakout board: Place the breakout board over the pins so that the short pins poke through the breakout pads © Adafruit Industries https://learn.adafruit.
And Solder! Be sure to solder all pins for reliable electrical contact. Solder the longer power/data strip first (For tips on soldering, be sure to check out our Guide to Excellent Soldering (https://adafru.it/aTk)). You're done! Check your solder joints visually and continue onto the next steps © Adafruit Industries https://learn.adafruit.
Attach Motor We prefer to attach the little vibration motor directly to the Motor+ and Motor- pads Solder in place Check your work and continue! © Adafruit Industries https://learn.adafruit.
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.
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 © Adafruit Industries https://learn.adafruit.
Open up the serial console and hold the vibration motor between your fingers. The sketch will play all 117 built in vibration effects in order. The full list with names is available in the DRV2605 datasheet © Adafruit Industries https://learn.adafruit.
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.
CircuitPython Code It's easy to use the DRV2605 controller with CircuitPython and the Adafruit CircuitPython DRV2605 module. This module allows you to easily write Python code that controls the vibration of the motor. First wire up a DRV2605 to your board exactly as shown on the previous pages for Arduino using an I2C connection.
library bundle for both express and non-express boards. Remember for non-express boards like the, you'll need to manually install the necessary libraries from the bundle: adafruit_drv2605.mpy adafruit_bus_device You can also download the adafruit_drv2605.mpy from its releases page on Github. Before continuing make sure your board's lib folder or root filesystem has the adafruit_drv2605.mpy, and adafruit_bus_device files and folders copied over.
Now to play the effect call the play function: drv.play() You should feel the motor vibrate in a sharp click! Every time you call the play function the motor will play back the sharp click effect. Try selecting a different effect and playing it, like the strong buzz with effect ID 47: drv.set_waveform(47) drv.play() Try other effects to see which ones are interesting and useful in your project! There are a few other handy features to be aware of with the DRV2605 module.
when the play function is called. Simply provide the slot number as an optional keyword argument to set_waveform (the default if not specified is slot 0). For example try running: drv.set_waveform(84) drv.set_waveform(1, slot=1) drv.set_waveform(0, slot=2) drv.play() # Effect 84 in slot 0 # Effect 1 in slot 1 # End effects after slot 1 (set slot 2 to 0) This will build a compound effect from two waveforms: Effect #84 (ramp up, medium smooth) in slot 0, the default slot.
# Simple demo of the DRV2605 haptic feedback motor driver. # Will play all 117 effects in order for about a half second each. # Author: Tony DiCola import time import board import busio import adafruit_drv2605 # Initialize I2C bus and DRV2605 module. i2c = busio.I2C(board.SCL, board.SDA) drv = adafruit_drv2605.DRV2605(i2c) # Main loop runs forever trying each effect (1-117). # See table 11.2 in the datasheet for a list of all the effect names and IDs. # http://www.ti.com/lit/ds/symlink/drv2605.
Downloads Datasheets DRV2605 Datasheet EagleCAD PCB files on GitHub Fritzing object in the Adafruit Fritzing Library Schematic Click to embiggen Fabrication print Dimensions in Inches © Adafruit Industries https://learn.adafruit.
© Adafruit Industries https://learn.adafruit.