Close

Haptic Motor Control

A project log for Kerbal Spaceship Potato

This is an input focused control panel for Kerbal Space Program.

matthew-peverillMatthew Peverill 10/02/2019 at 23:220 Comments

I hooked up my motor control! This is a cool little breakout board for the DRV2605L haptic motor control chip. This thing is very powerful - I'm certain I could do more with it than I am. I tried out the demo, which plays effects from a library, but I realized that they don't give much control. What I really want is to control vibration on a continuous scale, so I can scale it with thrust and/or drag (not sure what would feel best). 

How we do that mechanically is to put the chip in PWM mode, which scales vibration with PWM input (for testing, I controlled the PWM with a potentiometer). Initially, I ran in to an issue where vibration was strongest when PWM was at zero and 100%. I had to get deep in to the (long) datasheet to figure this out: this is default behavior for the chip in 'open loop mode', which (if I'm reading the sheet right) uses feedback from the motor to calibrate some of its features. I could put it in closed loop mode and have it respond more intuitively, but I'd have to know more about my motor (which I don't, because I scavenged it from an old xbox controller). Instead, this can be handled by scaling the output signal from 50-100% instead of 0-100% via the map command. Here's the relevant code:

outputValue = map(sensorValue, 0, 1023, 127, 255);

If we map outputValue and sensorValue to the plotter, they respond like this, with the vibration being zero when the red line is at minimum and maximum at maximum:

I also purchased a little USB in line amp meter so I can start figuring out power utilization. The difference in power consumption between minimum and maximum vibration is about .026A.

Discussions