0
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心
发布
  • 发文章

  • 发资料

  • 发帖

  • 提问

  • 发视频

创作活动
2305

2305

  • 厂商:

    ADAFRUIT

  • 封装:

    -

  • 描述:

    DRV2605L - Power Management, Motor Control Evaluation Board

  • 数据手册
  • 价格&库存
2305 数据手册
Adafruit DRV2605L Haptic Controller Breakout Created by lady ada https://learn.adafruit.com/adafruit-drv2605-haptic-controller-breakout Last updated on 2022-07-21 02:36:34 PM EDT ©Adafruit Industries Page 1 of 24 Table of Contents Overview 3 Pinouts 5 • • • • • Power Pins I2C Logic Pins Motor Input Other Power LED and Jumper Assembly • • • • Prepare the header strip: Add the breakout board: And Solder! Attach Motor Arduino Code • • • • • 7 11 Wiring for Arduino Install Adafruit_DRV2605 Library Load Demo Sketch Multiple Waveforms Audio Arduino Docs 15 Python & CircuitPython 15 • • • • • • • CircuitPython Microcontroller Wiring Python Computer Wiring CircuitPython Installation of DRV2605 Library Python Installation of DRV2605 Library CircuitPython & Python Usage Changing Motor Types Full Example Code Python Docs 22 Downloads 22 • • • • Files Schematic and Fab Print STEMMA QT Version Schematic and Fab Print Original Version Fabrication print ©Adafruit Industries Page 2 of 24 Overview The DRV2605 from TI is a fancy little motor driver. Rather than controlling a stepper motor or DC motor, it's 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 Page 3 of 24 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. (https://adafru.it/dDc) We added an onboard 3.3V regulator and logic-level shifting circuitry, making it a perfect choice for interfacing with any 3V or 5V microcontroller or computer, such as Arduino or Raspberry Pi. We've got both Arduino (C/C++) (https://adafru.it/10cE) and Ci rcuitPython (Python 3) libraries (https://adafru.it/10cF) available so you can use it with any microcontroller like Arduino, ESP32, Metro, etc, or with Raspberry Pi or other Linux computers, thanks to Blinka (our CircuitPython library support helper). ©Adafruit Industries Page 4 of 24 As if that weren't enough, we've also added SparkFun qwiic (https://adafru.it/Fpw) co mpatible STEMMA QT (https://adafru.it/Ft4) connectors for the I2C bus so you don't even need to solder. For a no-solder experience, just wire up to your favorite micro (ht tps://adafru.it/Zbo) using a STEMMA QT adapter cable. (https://adafru.it/JnB) The Stemma QT connectors also mean the breakout can be used with our various associated accessories. (https://adafru.it/Ft6) QT Cable is not included, but we have a variety in the shop (https://adafru.it/JnB) There are two versions of this board - the STEMMA QT version shown above, and the original header-only version shown below. Code works the same on both! Pinouts ©Adafruit Industries Page 5 of 24 The default I2C address is 0x5A. 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 Logic Pins • SCL - I2C clock pin, connect to your microcontroller's I2C clock line. This pin has  a 10K pullup to VIN. • SDA -I2C data pin, connect to your microcontroller's I2C data line. This pin has  a 10K pullup to VIN. • STEMMA QT (https://adafru.it/Ft4) - These connectors allow you to connect to development boards with STEMMA QT connectors, or to other things, with vario us associated accessories (https://adafru.it/Ft6). Motor Input • Motor Positive (+) - positive input for a haptic motor • Motor Negative (-) - negative input for a haptic motor ©Adafruit Industries Page 6 of 24 Other • INT - This is a general purpose pin that can be used for a couple different uses. One use is to read analog audio in to control the audio-to-haptic code. Another use is to 'trigger' the effects to go rather than sending a I2C command. Power LED and Jumper • Power LED - In the upper left corner, above the STEMMA connector, on the front of the board, is the power LED, labeled on. It is the green LED. • LED jumper - In the upper right corner on the back of the board is a jumper for the power LED. If you wish to disable the power LED, simply cut the trace on this jumper. Assembly ©Adafruit Industries Page 7 of 24 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 Add the breakout board: Place the breakout board over the pins so that the short pins poke through the breakout pads ©Adafruit Industries Page 8 of 24 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 Page 9 of 24 Attach Motor We prefer to attach the little vibration motor directly to the Motor+ and Motorpads Solder in place Check your work and continue! ©Adafruit Industries Page 10 of 24 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 - 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). ©Adafruit Industries Page 11 of 24 Install Adafruit_DRV2605 Library To begin controling the motor chip, you will need to install the Adafruit_DRV2605 Library (https://adafru.it/eh0). 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 (https:// adafru.it/aYM) 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 Page 12 of 24 Open up the serial console and hold the vibration motor between your fingers. ©Adafruit Industries Page 13 of 24 The sketch will play all 123 built-in vibration effects in order. The full list with names is available in the DRV2605 datasheet (https://adafru.it/eh2) 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! ©Adafruit Industries Page 14 of 24 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! Arduino Docs Arduino Docs (https://adafru.it/-Sb) Python & CircuitPython It's easy to use the DRV2605 controller with Python or CircuitPython, and the Adafruit CircuitPython DRV2605 (https://adafru.it/C4f) module. This module allows you to easily write Python code that controls the vibration of the motor. You can use this sensor with any CircuitPython microcontroller board or with a computer that has GPIO and Python thanks to Adafruit_Blinka, our CircuitPython-forPython compatibility library (https://adafru.it/BSN). CircuitPython Microcontroller Wiring First wire up a DRV2605 to your board exactly as shown on the previous pages for Arduino using an I2C connection.  Here's an example of wiring a Feather M0 to the controller with I2C: ©Adafruit Industries Page 15 of 24 Board 3V to controller VIN (red wire in STEMMA QT version) Board GND to controller GND (black wire in STEMMA QT version) Board SCL to controller SCL (yellow wire in STEMMA QT version) Board SDA to controller SDA (blue wire in STEMMA QT version) Controller Motor - to motor negative (black wire in STEMMA QT version) Controller Motor + to motor positive (red wire in STEMMA QT version) Python Computer Wiring Since there's dozens of Linux computers/boards you can use we will show wiring for Raspberry Pi. For other platforms, please visit the guide for CircuitPython on Linux to see whether your platform is supported (https://adafru.it/BSN).  Here's the Raspberry Pi wired with I2C: ©Adafruit Industries Page 16 of 24 Pi 3V3 to sensor VIN (red wire in STEMMA QT version) Pi GND to sensor GND (black wire in STEMMA QT version) Pi SCL to sensor SCL (yellow wire in STEMMA QT version) Pi SDA to sensor SDA (blue wire in STEMMA QT version) Controller Motor - to motor negative (black wire in STEMMA QT version) Controller Motor + to motor positive (red wire in STEMMA QT version) CircuitPython Installation of DRV2605 Library You'll need to install the Adafruit CircuitPython DRV2605 (https://adafru.it/C4f) library on your CircuitPython board. First make sure you are running the latest version of Adafruit CircuitPython (https:// adafru.it/Amd) for your board. ©Adafruit Industries Page 17 of 24 Next you'll need to install the necessary libraries to use the hardware--carefully follow the steps to find and install these libraries from Adafruit's CircuitPython library bundle  (https://adafru.it/ENC).  Our introduction guide has a great page on how to install the library bundle (https://adafru.it/ABU) 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 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. Next connect to the board's serial REPL (https://adafru.it/Awz) so you are at the CircuitPython >>> prompt. Python Installation of DRV2605 Library You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This may also require enabling I2C on your platform and verifying you are running Python 3. Since each platform is a little different, and Linux changes often, please visit the CircuitPython on Linux guide to get your computer ready (https: //adafru.it/BSN)! Once that's done, from your command line run the following command: • sudo pip3 install adafruit-circuitpython-drv2605 If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use CircuitPython on Python 2.x, it isn't supported! CircuitPython & Python Usage To demonstrate the usage of the board we'll initialize it and vibrate the motor using effects built-in to the DRV2605 chip.  First run the following code to import the necessary modules and initialize the I2C connection with the controller: ©Adafruit Industries Page 18 of 24 import board import busio import adafruit_drv2605 i2c = busio.I2C(board.SCL, board.SDA) drv = adafruit_drv2605.DRV2605(i2c) Now you're ready to start vibrating the motor with different built-in effects.  First you need to choose an effect to play based on its ID number.  See table 11.2 in the datasheet (https://adafru.it/eh2) for a list of all the effects: Each effect needs to be loaded into one of eight slots in the Waveform Sequencer: ©Adafruit Industries Page 19 of 24 You access the Waveform Sequencer by using the sequence property and providing an index for the slot location. To specify the effect, use the special Effect class provided in the library, giving it the effect number. For example, here is how to load Effect ID No. 1 "Strong Click - 100%" into slot 0 of the sequence: drv.sequence[0] = adafruit_drv2605.Effect(1) To play the sequence of effects 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 sequence. Right now, that's just the click effected loaded into slot 0. Try selecting a different effect and playing it, like the "Buzz 1 - 100%", a strong buzz, which is Effect ID 47: drv.sequence[0] = adafruit_drv2605.Effect(47) drv.play() Try other effects to see which ones are interesting and useful in your project! You can select multiple effects to play back at sequentially and create interesting compound effects. When you call play , the sequence is played until it either reaches a 0 or plays through all the slots. There's also a special Pause class you can use to generate a pause. You specify the pause time in seconds and it has to occupy a slot. Let's play the two effects from above, separated by a half second pause: ©Adafruit Industries Page 20 of 24 drv.sequence[0] drv.sequence[1] drv.sequence[2] drv.sequence[3] drv.play() = = = = adafruit_drv2605.Effect(1) adafruit_drv2605.Pause(0.5) adafruit_drv2605.Effect(47) adafruit_drv2605.Effect(0) The call to play is non-blocking, that is, it returns immediately and the rest of the code after that keeps running. The DRV2605 is doing the work of playing back the loaded sequence. If you ever want to stop the current playback, use the stop function: drv.stop() Changing Motor Types Finally it's uncommon but you might want to switch between using a linear resonance actuator motor or eccentric rotating mass motor.  The small flat pancake motors like sold in the Adafruit shop are ERM motors and the library defaults to their usage.  However you can call the use_LRM function to switch to configure the chip to use a LRM style motor: drv.use_LRM() You can also switch back to using an ERM style motor (the default) with the use_ERM function: drv.use_ERM() That's all there is to using the DRV2605 with CircuitPython!  Happy motoring! Full Example Code Here's a complete example of using the board to play the 123 effects for a half second each.  Save this as main.py on your board and watch the REPL output to see the effect ID printed as it plays on the motor. # SPDX-FileCopyrightText: 2017 Tony DiCola for Adafruit Industries # SPDX-License-Identifier: MIT # Simple demo of the DRV2605 haptic feedback motor driver. # Will play all 123 effects in order for about a half second each. import time ©Adafruit Industries Page 21 of 24 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-123). # 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.pdf effect_id = 1 while True: print("Playing effect #{0}".format(effect_id)) drv.sequence[0] = adafruit_drv2605.Effect(effect_id) # Set the effect on slot 0. # You can assign effects to up to 8 different slots to combine # them in interesting ways. Index the sequence property with a # slot number 0 to 7. # Optionally, you can assign a pause to a slot. E.g. # drv.sequence[1] = adafruit_drv2605.Pause(0.5) # Pause for half a second drv.play() # play the effect time.sleep(0.5) # for 0.5 seconds drv.stop() # and then stop (if it's still running) # Increment effect ID and wrap back around to 1. effect_id += 1 if effect_id > 123: effect_id = 1 Python Docs Python Docs (https://adafru.it/C4i) Downloads Files • EagleCAD PCB files on GitHub (https://adafru.it/oEt) • Fritzing object (original version) in the Adafruit Fritzing Library (https://adafru.it/ 10cI) • Fritzing object (STEMMA QT version) in the Adafruit Fritzing Library (https:// adafru.it/10cK) • DRV2605L Datasheet (https://adafru.it/10cJ) • 3D Models on GitHub (https://adafru.it/KEP) ©Adafruit Industries Page 22 of 24 Schematic and Fab Print STEMMA QT Version ©Adafruit Industries Page 23 of 24 Schematic and Fab Print Original Version Fabrication print Dimensions in Inches ©Adafruit Industries Page 24 of 24

很抱歉,暂时无法提供与“2305”相匹配的价格&库存,您可以联系我们找货

免费人工找货