====== Setting up the Syntouch Numatac Sensor====== **Author:** Francis Palustre Email: palusf1@unlv.nevada.edu \\ **Date:** Last modified on 06/13/2023 \\ **Keywords:** Syntouch, Numatac, Tactile, Sensor \\ {{ :c959b91c1029fb421216f6953e52d8fc.png?1000 |}} This screenshot above depicts the Arduino receiving pressure data which can be seen in the serial monitor and the line graph. The intent of this tutorial is to have students who don't understand how to retrieve data from the sensor and view the results . This tutorial is mainly used as a quick setup to those who wish to program using a tactile sensor because knowing the necessary information and understanding is difficult and time consuming. As most of the complex setup and information is given, this shouldn’t take longer than 15 minutes, but time will vary depending on what the objective is. ---- ===== Motivation and Audience ===== The tutorial’s motivation is to help those who wish to gain a basic understanding of compliant tactile sensors and serial communication, mainly SPI (the one being used for this example). The tutorial assumes the reader has the following background: * Basic concept of serial communication \\ * Basic understanding of programming \\ * Basic understanding of Arduino \\ * Knowing how to solder \\ The rest of this tutorial is presented as follows; all students must understand the safety precautions section: * [[cnc_course#items_required|Items Required]] * [[cnc_course#items_required|Warnings]] * [[cnc_course#safety_precautions|Preparations]] * [[cnc_course#machine_setup|Setup]] * [[cnc_course#software_usage|Programming]] * [[cnc_course#basic_operations|Videos]] * [[cnc_course#final_words|Final Words]] ---- ===== Items Required ===== To complete this tutorial, you'll need the following items: ^ PART NAME/DESCRIPTION ^ VENDOR ^ VENDOR Number or URL ^ PRICE ^ QTY ^ | SynTouch’s NumaTac®\\ tactile sensor | Syntouch.com | https://syntouchinc.com/ | 4,000-5,000 | 1 | | Arduino Mega | Amazon.com | https://www.amazon.com/ELEGOO-ATmega2560-ATMEGA16U2-Arduino-Compliant/dp/B01H4ZDYCE/ref=sr_1_4?crid=30HZB6FN1KLH2&keywords=arduino%2Bmega&qid=1686085632&sprefix=arduino%2Bme%2Caps%2C257&sr=8-4&th=1 | 20.99 | 1 | | JST 6-Pin (1mm Pitch) | Amazon.com | https://www.amazon.com/SH-Connector-Female-Cables-Batteries/dp/B0BKSNMCV4/ref=sr_1_1?crid=25IH0WCSSV0SS&keywords=JST+6-Pin+1mm+pitch&qid=1686251293&sprefix=jst+6-pin+1mm+pitch%2Caps%2C207&sr=8-1 | 9.49 | 1 | | Breadboard Jumper Wires | Amazon.com | https://www.amazon.com/Solderless-Flexible-Breadboard-Jumper-Package/dp/B016KI622U/ref=sr_1_10?crid=2EVT7BYN76G02&keywords=jumper+wires+breadboard&qid=1686085707&sprefix=jumper+wires+breadboar%2Caps%2C175&sr=8-10 | 7.99 | 6 | | Soldering Station | Amazon.com | https://www.amazon.com/YIHUA-Soldering-194%C2%BAF-896%C2%BAF-Adjustable-Calibration/dp/B082F1WKP9/ref=sr_1_1_sspa?keywords=soldering+iron+kit&qid=1686523734&sprefix=solder%2Caps%2C250&sr=8-1-spons&psc=1&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEzM1hVNllNUU5SMUdHJmVuY3J5cHRlZElkPUEwODM5NzczMlhIS09TSThOQVhOMiZlbmNyeXB0ZWRBZElkPUEwODc1NTQwM08yWFJCUzRJRjlNUCZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU= | 39.99 | 1 | | Wire Stripper | Amazon.com | https://www.amazon.com/Southwire-Equipment-S1626STR-Stranded-Stripping/dp/B00LQMRS7O/ref=sr_1_4_sspa?keywords=wire+sheathing+stripper&qid=1686523810&sprefix=wire+sheathing+%2Caps%2C366&sr=8-4-spons&psc=1&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUEySFQ3SEM2Q1JORE5WJmVuY3J5cHRlZElkPUEwNjg0NzYwMzgyVUxZS0tIUTY3TCZlbmNyeXB0ZWRBZElkPUEwMDE2MTY3MThPNTM5WDlHNUpIUyZ3aWRnZXROYW1lPXNwX2F0ZiZhY3Rpb249Y2xpY2tSZWRpcmVjdCZkb05vdExvZ0NsaWNrPXRydWU= | 13.01 | 1 | | Arduino IDE | Arduino.com | https://www.arduino.cc/en/software | Free | N/A | \\ The Snytouch Package should come with the following: \\ * 2x Syntouch Sensors \\ * 1x USB-B Cable \\ * 1x TotalPhase Cheetah USB/SPI Adaptor \\ * 1x 5V Mini USB AC Adapter \\ * NumaTac Cables ---- ===== Warnings ===== PLEASE READ THOROUGHLY * The maximum force applied to the NumaTac should not exceed 100N. \\ * Do not supply the NumaTac 5V input with greater than 5.5V of voltage. This can cause damage to the electrical components, which could make the NumaTac unusable. \\ * Be gentle with cable pins as they are small and can easily be damaged. ---- ===== Preparations ===== As the sensor uses a 6-pin JST connector and the Arduino doesn’t, we would need to make our own cable. The following picture shows what port of the JST leads to what. Therefore, when soldering the jumper wires to JST, pay attention to what goes where as it is very important. {{ :pins.png?400 |}} This tutorial will not tell you how to solder as this is not meant for it, but I will explain how to setup the JST-Jumper wires: \\ \\ **Step 1** \\ Cut the wires and start unsheathing them, separate the JST wires if they are stuck together \\ **Step 2** \\ Take note on what wire is corresponding to each pins and solder the JST to one another. Try your best to follow color convections (Red = 5V, Black = GND) \\ \\ By the end of this, your result should look similar to this: {{ :rotate.png?500 |}} If you like to learn how to do solder, here is a video on how to do it: {{youtube>6rmErwU5E-k?}} ---- ===== Setup ===== After looking at the header code, please connect each pin to its respective GPIO, the result should look like this: {{ :thing.png?400 |}} \\ Note: With this wire setup, Red = GND and Black = 5V, although this shouldn't affect anything, it is best to follow the convection as mentioned earlier. ---- ===== Programming ===== This is the header file needed to run the Arduino file: #include int misoPin = 50; int mosiPin = 51; int clkPin = 52; int csPin = 53; int clockRate = 1000000; // between 500kHz and 10 MHz // Word structure: 2-byte words, 16 bits. // Clock Priority = Idle Low // Clock Phase = first Edge // WHILE LISTENING TO RESPONSES FROM SENSORS, HOST SHOULD WRITE OUT A 0x0001 TO MOSI LINES TO AVOID ERRORS // FUNCTION: Prints a byte in binary with all leading 0's void printBin(byte aByte) { for (int8_t aBit = 7; aBit >= 0; aBit--) Serial.write(bitRead(aByte, aBit) ? '1' : '0'); } // FUNCTION: Sends a sample command to the SynTouch NumaTac sensors for DC Pressure. int samplePDC() { // SPI interfacing SPI.beginTransaction(SPISettings(clockRate, MSBFIRST, SPI_MODE0)); // Open up Arduino SPI channel digitalWrite(csPin, LOW); // Open comms with NT sensor SPI.transfer(0b10000011); // Sample DC Pressure Command (1st Byte) SPI.transfer(0x01); // Sample DC Pressure Command (2nd Byte) [Ignored by NumaTac] digitalWrite(csPin, HIGH);// Close comms with NT sensor delayMicroseconds(100); // Mandatory delay; Need minimum of 50 us before can read data from NumaTacs digitalWrite(csPin, LOW); // Open comms with NT sensor byte reading1 = SPI.transfer(0x01); // Send a dummy 0x01 while reading the SPI buffer. byte reading2 = SPI.transfer(0x01); // Send a dummy 0x01 while reading the SPI buffer. digitalWrite(csPin, HIGH);// Close coms with NT sensor SPI.endTransaction(); // Close Arduino SPI channel int byteHandler = 0x0000; byteHandler = ((reading1 >> 1) << 5) + (reading2 >> 3); return byteHandler; } // FUNCTION: Sends a sample command to the SynTouch NumaTac sensors for AC Pressure. int samplePAC() { // SPI interfacing SPI.beginTransaction(SPISettings(clockRate, MSBFIRST, SPI_MODE0)); // Open up Arduino SPI channel digitalWrite(csPin, LOW); // Open comms with NT sensor SPI.transfer(0b10000000); // Sample AC Pressure Command (1st Byte) SPI.transfer(0x01); // Sample AC Pressure Command (2nd Byte) [Ignored by NumaTac] digitalWrite(csPin, HIGH);// Close comms with NT sensor delayMicroseconds(100); // Mandatory delay; Need minimum of 50 us before can read data from NumaTacs digitalWrite(csPin, LOW); // Open comms with NT sensor byte reading1 = SPI.transfer(0x01); // Send a dummy 0x01 while reading the SPI buffer. byte reading2 = SPI.transfer(0x01); // Send a dummy 0x01 while reading the SPI buffer. digitalWrite(csPin, HIGH);// Close coms with NT sensor SPI.endTransaction(); // Close Arduino SPI channel int byteHandler = 0x0000; byteHandler = ((reading1 >> 1) << 5) + (reading2 >> 3); return byteHandler; } \\ \\ This file is the main Arduino file: #include "NumaTac.h" int offset; void setup() { // put your setup code here, to run once: pinMode(csPin, OUTPUT); // set CS pin as an OUTPUT. SPI.begin(); // Initalize the SPI library Serial.begin(115200); // Begin serial comms with computer port (for printing purposes) delay(100); offset = samplePDC(); } int dcPressure; int acPressure; void loop() { // put your main code here, to run repeatedly: dcPressure = samplePDC(); acPressure = samplePAC(); Serial.print(dcPressure); Serial.print(","); Serial.println(acPressure); } ---- ===== Video ===== The following video is what should happen if everything is setup correctly: \\ {{youtube>wzt8DMfU9I4?large}} ---- =====Final Words ===== The tutorial’s objective was to give those interested an output from a Syntouch pressure sensor and give some understanding of how data is being perceived.