This examples shows you how to read and visualize force map data from the attached matrix sensor. Required Hardware and Software
You can find two connectors on Snowboard. One is for the Matrix Sensor 1610 and the other is for Matrix Sensor 1007. In this tutorial, we assume to use Matrix Sensor 1610. ConnectionConnect the Matrix Sensor 1610 or 1007 to Snowboard. Snowboard is then connected to a PC. Upload Firmware1. Run Arduino IDE. 2. In Tools-Board, choose Arduino Leonardo. Snowboard 2 users need to choose their own Arduino in this step. 3. In Tools-Port, choose an appropriate port which your Snowboard is attached. 4. Go to File-Examples-Snowboard and choose snowforce to open the example. Visualization1. Go to the unzipped folder you create during the installation, find and double click snowforce.exe. The application will run, automatically find Snowboard, and visualize force map from the matrix sensor.
Arduino CodeIn the program below, the first thing you do is to declare Snowforce class instance with the line Snowforce snowforce; In the setup, you will tell Snowboard to start I2C and serial communication. I2C is for internal communication between Arduino component and force touch controller in Snowboard. By starting serial, your Snowboard is ready to send data from the touch controller to a PC. Wire.begin(); // start i2c communication Serial.begin(115200); // start serial for output After that Snowboard will tell the controller to initialize itself. In the main loop, when Snowboard gets an arbitrary data from PC via serial it will read force data and send it to PC. Actually, only following two lines are required to get data from a matrix sensor. byte data[160] = {0, }; snowforce.read(data); data[] represents 2D force map obtained from a matrix sensor and has the following strucure: data[0]: Force signal of (D0, A0) data[1]: Force signal of (D0, A1) ... data[9]: Force signal of (D0, A9) ... data[150]: Force signal of (D15, A0) data[151]: Force signal of (D15, A1) ... data[159]: Force signal of (D15, A9) where (Di, Aj) indicates the crossing point of ith drive line and jth sense line on the matrix sensor. See Snowboard product page to know pin map. #include <Wire.h> #include <Snowforce.h> Snowforce snowforce; void setup() { Wire.begin(); // start i2c communication Serial.begin(115200); // start serial for output snowforce.begin(); // start tactile sensing part of snowboard } void loop() { // pressure mapping data // tactile sensing part always give maximum // number of data (10x16 = 160) byte data[160] = {0, }; // send data only pc wants it if (Serial.available() > 0) { int inByte = Serial.read(); snowforce.read(data); for (int i = 0; i < 159; i++) { Serial.print(data[i]); Serial.print(","); } Serial.println(data[159]); } } |
Snowboard > 2. Examples >