Controls multiple DRV2605 Haptic Drivers via I²C protocol using midi files.
Midi notes read from a midi file are mapped to 8 DR2605 drivers using a TCA9548A switch. The midi notes velocity is used as the drivers amplitude.
Midi Note | Note velocity | Driver | Amplitude | |
---|---|---|---|---|
0 | 1 | -> | 0x01 | 1 |
1 | 10 | -> | 0x02 | 10 |
3 | 100 | -> | 0x03 | 100 |
... | ... | -> | ... | ... |
- Raspberry Pi 4 Model B
- DRV2605 Haptic Motor Driver
- Multiplexer TCA9548A1
- ERM or LRA Vibration Motor
Connecting the Multiplexer to the Raspberry Pi via GPIO (Vin/Ground/SDA/SCL). On the multiplexer use SDA/SCA 0-7 to connect up to 8 DRV2605L. You need one DRV2605 for each motor, since they all have the same adress 0x5A. 5V or 3.3V (both can be used, but has impact on Motor Strength) Connection and Ground from the Raspberry Pi can be in serial and soldered together.
ERM Motor is cheap but less precise. To accomplish good haptic Effects you need LRAs. Mode for each, LRA and ERM, is planned to be adjustable in the software.
A Makefile for basic usage is available (Maven Wrapper is included).
Install dependencies with
make build
Start the program with. Lets you select a midi file from the midi_test_files folder.
make start-midi
Start the program without any I²C devices connected (only reads and logs the selected midi file).
start-log
Prints help to the console.
make help