The prototype has additional capability that is not shown in the hardware section, but is represented in this sketch. Additional capabilities include:
Potentiometer to control the overall level of the force. The algorithm is pretty basic. Ideally x-sim Force Profiler configuration could be changed to accomplish the same thing and more. However, for tuning it seemed like convenient thing to have.
There is a 20x4 LCD display. This is used to get information on the inner workings of the code. It will used in future to display other information. There is a potentiometer here too in order to adjust the contrast of the display.
I was starting to play around with a wired remote from an old Sony car audio head unit. This code can be stripped out (like the stuff above).
Yes, the code is nasty.
Parsing x-sim generated lat/long force pair
x-sim Force Profiler is configured to output 3 bytes for each update (NUL, lat force, long force). Lat and log force are transformed by x-sim to have values from 1-255. Midpoint is 127 (see code for details).
Calculate angle and magnitude of force
Math is done to turn lat/long force to an angle and a magnitude. The magnitude is limited to a value within the specs of the particular vibrators used. This value was determined by a test circuit (including potentiometer) and a multimeter.
Also, turn the angle into a number from 0-360 degrees. Since the vibrators are every 30 degrees (360 / 12) this will aide in the next step.
Mapping force to vibrator(s)
The current algorithm calls for up to two vibrators on at any one time. If the angle is completely aligned with one vibrator, power it up to 100% of the magnitude. If the angle is between two vibrators, the total power will be equal to the magnitude, however it will be proportionally distributed between them. For example, if the angle is half way between two vibrators, each will be powered up at 50% of the magnitude.
There are other options here but this seemed like a reasonable approach for first attempt.
Enabling vibrators
Use Pulse Width Modulation (PWM) to enable the vibrator(s) and disable as ones that aren't needed anymore.