Skip to content

LRA Wireling Tutorial

TinyCircuits Accelerometer Wireling product photo

This Wireling lets you control a Linear Resonant Actuator (LRA) or Eccentric Rotating Mass (ERM) via the I²C bus and the DRV2605 IC, to create Haptic vibration type motion.

Technical Details

TI DRV2605 LRA Haptic Driver Specs

  • Flexible Haptic/Vibra Driver
    • LRA (Linear Resonance Actuator)
    • ERM (Eccentric Rotating Mass)
  • I2C Controlled Digital Playback Engine
    • Real-Time Playback Mode via I2C
  • Smart Loop Architecture(1)
    • Automatic Overdrive/Braking (ERM/LRA)
    • Automatic Resonance Tracking (LRA)
    • Automatic Actuator Diagnostic (ERM/LRA)
    • Automatic Level Calibration (ERM/LRA)
  • Licensed Immersion™ TouchSense® 2200
    features:
    • Integrated Immersion Effect Library
    • Audio to Vibe
  • Optional PWM Input with 0% to 100% Duty Cycle
    Control Range
  • Optional Analog Input Control
  • Optional Hardware Trigger Pin
  • Efficient Output Drive
  • Fast Start Up Time
  • Constant Acceleration Over Supply Voltage
  • 1.8 V Compatible, VDD Tolerant Digital Pins
TinyDuino Power Requirements
  • Voltage: 3.0V - 5.5V
  • Current: 2.5mA
Pins Used
  • A5/SCL - I²C Serial Clock line
  • A4/SDA - I²C Serial Data line
  • A(x)/INT - Interrupt Pin
    • Note: (x) corresponds to the Port number used
Dimensions
  • 10mm x 10mm (.394 inches x .394 inches)
  • Max Height 7.07mm (0.278 inches)
  • Weight: 1 gram (.04 ounces)

Notes

  • The DRV2605 chip is used for controlling LRA and ERM motors.
    • A Linear Resonance Actuator (LRA) is a buzzing motor that produces noise. Due to their construction and operating method, LRAs outlast traditional vibration motors several times over and are tuned to operate at frequencies that are optimal for skin contact. This is the type of motor soldered to the LRA Wireling
    • An Eccentric Rotating Mass (ERM) motor is a vibrating motor that produces vibration, sometimes referred to as a pager motor. Current popular uses for an ERM motor include giving feedback on user interfaces via cellphones, watches, remote controls, and touch-enabled devices.

Materials

To interface with any TinyCircuits Arduino board, you will need the Arduino IDE and a Micro USB Cable

There are multiple processor/adapter combinations that can be used with Wirelings. Use the following table to find the combination that works for you.

Processor Adapter
*TinyDuino and USB TinyShield Wireling Adapter TinyShield
*TinyZero Wireling Adapter TinyShield
*TinyScreen+ Wireling Adapter TinyShield
WirelingZero N/A
*RobotZero N/A
Arduino Wireling Arduino Shield
Raspberry Pi Wireling Pi Hat

* These processors have a 32-pin connector and can have multiple Wireling Adapter TinyShields stacked to increase the number of Wireling ports up to a maximum of 32 total Wireling ports.

In order to interface with Wirelings, you'll need the appropriate number of Wireling Cables and the Wireling.h Library (You can download this from GitHub as linked, or from the Library Manager in the Arduino IDE).

You will also need the LRA Wireling and the included example Arduino sketch.

Wireling Code
Port 0 LRA Example Sketch

Hardware Assembly

Depending on the development system you choose, you will need to put together a TinyDuino stack using the 32-pin tan connectors, or you will just need to plug in your Wireling to Port 0 using a Wireling Cable. (You can change this port in the included Arduino Sketch using the selectPort() function)

NOTE: Be mindful when inserting Wireling Cables - the connector pins inside the 5-pin connectors on Wirelings can be bent when cables are inserted at an angle.


Software Setup

If you have not already done so, download the LRA/ERM Haptic Wireling Example Sketch and open it in the Arduino IDE. All the necessary files for the program are included in the zipped folder.

Make the correct Tools selections for your development board. If unsure, you can double check the Help page that mentions the Tools selections needed for any TinyCircuits processor.


Upload Program

This program will print the motor effect # being produced on the ERM/LRA motor used with the Wireling to the Serial Monitor.

Code
/*************************************************************************
 * DRV2605 LRA ERM Haptic Driver Wireling
 * This program is an expanded example that is part of the Adafruit_DRV2605 
 * library. The DRV_2605 will send 116 different waveform effects to a 
 * vibrating or buzzing motor. If you are interested in the individual 
 * effects, the list of effects can be found on page 57 of the datasheet: 
 * http://www.ti.com/lit/ds/symlink/drv2605.pdf
 * 
 * Modified by: Laveréna Wienclaw for TinyCircuits 
 *************************************************************************/

#include <Wire.h>             // For using I2C communication
#include "Adafruit_DRV2605.h" // For interfacing with the DRV2605 chip
#include <Wireling.h>

Adafruit_DRV2605 drv;   // The variable used to interface with the DRV2605 chip
uint8_t effect = 1;     // The global variable used to keep track of Waveform effects

// Make Serial Monitor compatible for all TinyCircuits processors
#if defined(ARDUINO_ARCH_AVR)
  #define SerialMonitorInterface Serial
#elif defined(ARDUINO_ARCH_SAMD)
  #define SerialMonitorInterface SerialUSB
#endif

void setup() {
  // Initialize and power wireling
  Wireling.begin();

  //The port is the number on the Adapter board where the sensor is attached
  Wireling.selectPort(0);

  SerialMonitorInterface.begin(9600);
  SerialMonitorInterface.println("DRV Effects Test");
  drv.begin();

  drv.selectLibrary(1);

  // I2C trigger by sending 'go' command
  // default, internal trigger when sending GO command
  drv.setMode(DRV2605_MODE_INTTRIG);
  drv.useLRA();
}

// Print the DRV effect number and then play the effect
void loop() {
  setup();
  SerialMonitorInterface.print("Effect #"); 
  SerialMonitorInterface.println(effect);

  // Set the effect to play
  drv.setWaveform(0, effect);  // Set effect
  drv.setWaveform(1, 0);       // End waveform

  // Play the effect
  drv.go();

  // Pause for differentiation between effects
  delay(1000);

  effect++;
  if (effect > 117) effect = 1;
}

With the program uploaded, you should be able to hold the motor in your hands and feel all the different motor effects available with the built-in library. Note what effects are best for your project (there are over 100)!

Notice that this example has a call to the function useLRA(). This makes the DRV2605 chip compatible with the use of LRA motors, like the once that comes with the LRA Wireling. If you choose to use an ERM motor instead, you would use the function useERM() to correctly initialize the chip for proper usage. Without using the correct mode, your motor will not work as expected.


Downloads


Contact Us

If you have any questions or feedback, feel free to email us or make a post on our forum. Show us what you make by tagging @TinyCircuits on Instagram, Twitter, or Facebook so we can feature it.

Thanks for making with us!