Adafruit DRV2605L Haptic Controller Delay Question

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ZachGoode331
 
Posts: 3
Joined: Sun Mar 19, 2023 6:44 pm

Adafruit DRV2605L Haptic Controller Delay Question

Post by ZachGoode331 »

Hi, I am using an Adafruit DRV2605L Haptic Controller for a coin vibration motor and a Jetson Nano. After initializing the I2C bus and DRV2065 module and trying to run play the sequence, it takes 10 seconds for the motor to start to vibrate. How do I decrease the amount of time it takes until my motor vibrates?

Below is my code:

Code: Select all

class Motor:

 # Initalize I2C bus and DRV2065 module
        self.i2c = busio.I2C(board.SCL, board.SDA)
        self.drv = adafruit_drv2605.DRV2605(self.i2c)
        # Set effect number
        self.effect_num = effect_num

   def run(self,run_time=5):
        # Run vibrations
        self.drv.sequence[0] = adafruit_drv2605.Effect(self.effect_num)

        # Run for five seconds then stop
        self.drv.play()
        time.sleep(run_time)
        self.drv.stop()
Last edited by dastels on Sun Mar 19, 2023 8:03 pm, edited 1 time in total.
Reason: Add code tags

User avatar
dastels
 
Posts: 15608
Joined: Tue Oct 20, 2015 3:22 pm

Re: Adafruit DRV2605L Haptic Controller Delay Question

Post by dastels »

It should be instantaneous unless the library is grossly over complex.

Could you post all the code?

Why is this in a class? There's nothing in what you posted that requires (or benefits from) being in a class.

Dave

User avatar
ZachGoode331
 
Posts: 3
Joined: Sun Mar 19, 2023 6:44 pm

Re: Adafruit DRV2605L Haptic Controller Delay Question

Post by ZachGoode331 »

Hi Dave, thank you for your help. I put it in a class because it's part of a larger project where I'll be taking input from microphones, running an ML model, getting a result, and run different devices based on this result including these pancake motors, LED lights, etc. I'll have a single file that imports the different classes for these devices to run them from one place.

This is the library for the DRV2605L Haptic Controller: https://github.com/adafruit/Adafruit_DRV2605_Library

This is the example code I used to help me write the code below: https://learn.adafruit.com/adafruit-drv ... cuitpython

This is the code for the pancake motors and DRV2605L haptic controller. Please let me know if you need more info. Thank you:

import board
import busio
import adafruit_drv2605
import time

class Steering_Wheel_MotorController:
def __init__(self, effect_num=118):
# Initalize I2C bus and DRV2065 module
self.i2c = busio.I2C(board.SCL, board.SDA)
self.drv = adafruit_drv2605.DRV2605(self.i2c)
# Set effect number
self.effect_num = effect_num

def run(self,run_time=5):
# Run vibrations
self.drv.sequence[0] = adafruit_drv2605.Effect(self.effect_num)

# Run for five seconds then stop
self.drv.play()
time.sleep(run_time)
self.drv.stop()


This is the code pertaining to the pancake motors and DRV2605L haptic controller in my single file that runs all my devices:

from steering_wheel_motor_control import Steering_Wheel_MotorController

# Running Steering Wheel Motors
steering_wheel_mc = Steering_Wheel_MotorController(effect_num=118)
steering_wheel_mc.run()

User avatar
ZachGoode331
 
Posts: 3
Joined: Sun Mar 19, 2023 6:44 pm

Re: Adafruit DRV2605L Haptic Controller Delay Question

Post by ZachGoode331 »

Hi nevermind figured it out. The controller has a real-time playback mode that allows the host processor to bypass the library.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”