CircuitPython module for the DRV2605 haptic feedback motor driver. See examples/ for a demo of the usage.

  • Author(s): Tony DiCola

class adafruit_drv2605.DRV2605(i2c: I2C, address: int = 90)[source]

TI DRV2605 haptic feedback motor driver module.

  • i2c (I2C) – The board I2C object

  • address (int) – The I2C address

property library: int

The library selected for waveform playback. Should be a value of:


  • LIBRARY_TS2200A: TS2200 library A (the default)

  • LIBRARY_TS2200B: TS2200 library B

  • LIBRARY_TS2200C: TS2200 library C

  • LIBRARY_TS2200D: TS2200 library D

  • LIBRARY_TS2200E: TS2200 library E

  • LIBRARY_LRA: LRA library

See the datasheet for the meaning and description of effects in each library.

property mode: int

The mode of the chip. Should be a value of:

  • MODE_INTTRIG: Internal triggering, vibrates as soon as you call play(). Default mode.

  • MODE_EXTTRIGEDGE: External triggering, edge mode.

  • MODE_EXTTRIGLVL: External triggering, level mode.

  • MODE_PWMANALOG: PWM/analog input mode.

  • MODE_AUDIOVIBE: Audio-to-vibration mode.

  • MODE_REALTIME: Real-time playback mode.

  • MODE_DIAGNOS: Diagnostics mode.

  • MODE_AUTOCAL: Auto-calibration mode.

See the datasheet for the meaning of modes beyond MODE_INTTRIG.

play() None[source]

Play back the select effect(s) on the motor.

property realtime_value: int

The output value used in Real-Time Playback mode. When the device is switched to MODE_REALTIME, the motor is driven continuously with an amplitude/direction determined by this value.

By default, the device expects a SIGNED 8-bit integer, and its exact effect depends on both the type of motor (ERM/LRA) and whether the device is operating in open- or closed-loop (unidirectional/bidirectional) mode.

See the datasheet for more information!


# Start real-time playback
drv.realtime_value = 0
drv.mode = adafruit_drv2605.MODE_REALTIME

# Buzz the motor briefly at 50% and 100% amplitude
drv.realtime_value = 64
drv.realtime_value = 127

# Stop real-time playback
drv.realtime_value = 0
drv.mode = adafruit_drv2605.MODE_INTTRIG
property sequence: _DRV2605_Sequence

List-like sequence of waveform effects. Get or set an effect waveform for slot 0-7 by indexing the sequence property with the slot number. A slot must be set to either an Effect or Pause class. See the datasheet for a complete table of effect ID values and the associated waveform / effect.


# Getting the effect stored in a slot
slot_0_effect = drv.sequence[0]

# Setting an Effect in the first sequence slot
drv.sequence[0] = Effect(88)
set_waveform(effect_id: int, slot: int = 0) None[source]

Select an effect waveform for the specified slot (default is slot 0, but up to 8 effects can be combined with slot values 0 to 7). See the datasheet for a complete table of effect ID values and the associated waveform / effect.

  • effect_id (int) – The effect ID of the waveform

  • slot (int) – The sequence slot to use

stop() None[source]

Stop vibrating the motor.

use_ERM() None[source]

Use an eccentric rotating mass motor (the default).

use_LRM() None[source]

Use a linear resonance actuator motor.

class adafruit_drv2605.Effect(effect_id: int)[source]

DRV2605 waveform sequence effect.


effect_id (int) – The ID number of the effect

property id: int

Effect ID.

property raw_value: int

Raw effect ID.

class adafruit_drv2605.Pause(duration: float)[source]

DRV2605 waveform sequence timed delay.


duration (float) – The duration of the pause in seconds

property duration: float

Pause duration in seconds.

property raw_value: int

Raw pause duration.