Multi-touch force & position sensing with Arduino
When we optimized for speed, we reduced serial communication overhead by removing spaces and line breaks, as well as compressing strings of repeated zero values. As a result, if we plugged the optimized unit into a standard serial terminal, the output would look like a jumbled mess.
No problem, we'll just write a simple receiving app to grab the serial data and display some graphic feedback - much more exciting than a text terminal anyway. To accomplish this, we'll use Processing. For those unfamiliar, Processing is a Wiring-based language / IDE. It's probably the quickest, easiest tool for creating graphical Arduino interface apps, among other things. You can download Processing here.
For this example, we'll make a basic visualizer that displays a black 16x10 grid. When force is detected on the MatrixArray, we'll shade the corresponding grid cell green, with intensity proportional applied force.
Example visualizer code is given below, but first, the results!
The green blobs show a thumb press in the corner of the MatrixArray, and a fingertip press near the center. As expected, the refresh rate is quite fast and feels responsive.
To run or modify the visualizer code below, you'll need to download and install Processing. Then, open the .pde in Processing and run it much like you would run an Arduino sketch.