DRV2605L Haptic Motor Driver (0x5A)
Table of Contents
The DRV2605 Haptic Motor Driver is a sensor that has a vibrating and clicking feature. This haptic device can also be controlled by touching it by adding another touch sensor as input to the motor driver. The vibrating and clicking levels can be controlled by their intensity level. To receive an output of this sensor, another device must be connected to the output pins of the hardware. A vibration motor controller is used to buzz and click received by the haptic motor driver.
The budget was relatively cheap. A toolkit, a soldering kit, and a prototype lab are present before the project. The facilities at Humber College made the project drastically cheaper due to accessable sources.
The schedule should roughly take a few days considering all the steps provided. Buying the parts online should take around a week including shipment time/delay.
The given project took a few months to complete. However, with the following steps required the project should last 2 weeks including the shipment of parts.
- Acquiring items (roughly 5-7 days)
- Raspberry Pi setup (a couple hours considering internet speeds)
- Soldering of the Haptic Motor Driver and Vibrating motor disc (1 hour)
- Soldering of the PCB with the pinouts should take 1 hour (1.5 hours if soldering of all pins of the raspberry pi is needed)
- Case Enclosure using CorelDRAW with laser cutting and assembly (3 hours if trial and error is not present within the process)
- Installing the libraries in the Pi, Reading and Writing the code (3 hours)
- Verification of functionality (1 hour)
The sensor would be placed on a breadboard. The pinouts would be connected to the raspberry pinouts through wiring.
The following pinout is as follows:
| Device Pin | Pi Pinout |
|---|---|
| 1 (VIN) | 1 (3.3V) |
| 2 (GND) | 9 (GND) |
| 3 (SCL) | 5 (GPI03) |
| 4 (SDA) | 3 (GPI02) |
HERE you can click a tutorial on how to solder safely and efficiently.
A 5 pinout socket was placed on the bottom layer of the sensor. Both sides of the pin sockets were soldered. The vibrating controller motor was soldered with the blue wire on the negative socket and the red wire on the positive socket.
The program Fritzing was used to make a diagram for wiring the raspberry pi and sensor.
Fritzing was also used to do the PCB Milestone. The wires were placed so the upper levels wires won't overlap each other. The wires were placed so the lower level wires won't overlap each other.
A SD Card (SD Card is provided from the raspberry pi 3 kit) formatter was installed.
https://www.sdcard.org/downloads/formatter_4/
NOOBS was installed to give the operating system (os) for the SD card.
https://www.raspberrypi.org/downloads/noobs/
The setup for the raspberry pi was done with reference by Lynda.
-
Format the 8GB SD Card provided from the raspberry pi kit.
-
Download NOOBS, once downloaded unzip the files.
-
Remove the SD Card from the computer, insert the SD Card into the raspberry pi, connect the raspberry pi computer to a screen. At this point the screen should show the raspberry pi instructions.
-
Select "Raspbian" as the operating system for the Pi. Select "US" for the keyboard settings.
-
Open terminal in the top left corner of the desktop screen and type in the following:
wget https://raw.githubusercontent.com/six0four/StudentSenseHat/master/firmware/hshcribv01.sh \
-O /home/pi/hshcribv01.sh
chmod u+x /home/pi/hshcribv01.sh
/home/pi/hshcribv01.sh
- Set up VNC connection to access the Raspberry Pi from computer screens.
Start Menu -> Preferences -> Raspberry Pi Configuration -> Interfaces -> Enable VNC
- Go back to the desktop screen, in the top right corner check if the VNC logo is on. Record the IP address of the VNC of the Raspberry Pi.
The following link installs the software to view the Raspberry Pi in any computer screen.
https://www.realvnc.com/en/connect/download/vnc/
- To turn off the Raspberry Pi:
Start Menu -> Shutdown
- Connect the Raspberry Pi to the computer using an ethernet cable. Open VNC Viewer from the computer, connect to the raspberry pi by inputting the IP address.
A soldering toolkit is required to solder the PCB. The vias were soldered with soldering wire. A 40 pinout socket was used to solder on the lower level of the board for the raspberry pi pins. A 5 pinout socket was used to solder on the upper level board for the haptic motor drive pins.
Top View:
Bottom View:
The PCB laser cutting procedure was done at Humber College's Prototype lab.
To begin VNC, the sensor must be connected to the pcb with the raspberry pi and must be booted up.
Proceed to the following steps to enable vnc:
- Open terminal and type the following:
sudo raspi-config
-
Interface options -> go to i2c -> select "enable" -> finish
-
Once VNC is enabled, the following code was typed to identify the address of the given sensor.
sudo i2cdetect -y 1
If you see the given address, you may proceed to the next step. If you DO NOT see the given address, review soldering, installation of the raspberry pi and motor driver.
CorelDRAW has been used to create the raspberry pi case with acrylic.
The design files for the Raspberry Pi case for this project can be found by clicking HERE .
The following link was used as reference for the Raspberry Pi case in CorelDRAW
https://github.com/diy-electronics/raspberrypi-b-plus-case
The laser cutting procedure was done at Humber College's Prototype lab.
The following case was raised by 40mm to cover the haptic motor driver and vibration motor disc. The top of the case was covered since both the motor and motor disc are sensitive to outside environments because of its fragile feature.
For the Driver to begin its testing, A python and circuitpython installation has been made into the raspberry pi. Adafruit has been used as reference to install the libraries.
The link to completely install python can be found by clicking HERE .
Build the circuitpython tools package:
python3 -m venv .env
source .env/bin/activate
pip install circuitpython-build-tools
Once installed, test run if its connected to the tools package:
source .env/bin/activate
Run the build:
circuitpython-build-bundles --filename_prefix adafruit-circuitpython-drv2605 --library_location
Install CircuitPython:
sudo pip3 install adafruit-circuitpython-drv2605
Once installed, import the modules and identify the i2c connection with the motor:
import board
import busio
import adafruit_drv2605
i2c = busio.I2C(board.SCL, board.SDA)
drv = adafruit_drv2605.DRV2605(i2c)
Here is an example of code running the Haptic Motor Drive by Adafruit:
# 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.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 7 different slots to combine
# them in interesting ways. Index the sequence property with a
# slot number 0 to 6.
# 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)
# Increment effect ID and wrap back around to 1.
effect_id += 1
if effect_id > 117:
effect_id = 1
Set a waveform for the motor's ID corresponding to its physical effects. Here is an example:
drv.set_waveform(84) # Effect 84 in slot 0
drv.set_waveform(1, slot=1) # Effect 1 in slot 1
drv.set_waveform(0, slot=2) # End effects after slot 1 (set slot 2 to 0)
drv.play()
Corresponding to the attributes of a haptic motor drive, this table is to determine the outputs
https://learn.adafruit.com/adafruit-drv2605-haptic-controller-breakout/overview
https://www.lynda.com/Raspberry-Pi-tutorials/Raspberry-Pi-Essential-Training/667376-2.html






