Table of Contents
Syntouch Numatac Sensor "Hello World"
Author: Francis Palustre
Email: palusf1@unlv.nevada.edu
Date: Last modified on 06/13/2023
Keywords: Syntouch, Numatac, Tactile, Sensor
This screenshot above depicts the Arduino receiving pressure data from a foam block.
The intent of this example is to be a continuation of the previous Syntouch article. This tutorial is mainly used to provide a “Hello World” example to give people an introduction to the Syntouch sensor. The actual example shouldn’t take more than 5 minutes as you are mainly tasked to place the objects and rub it against the sensor (carefully). As in getting the materials, that will vary based on how you are going to obtain it.
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
The rest of this tutorial is presented as follows; all students must understand the safety precautions section:
Items Required
To complete this tutorial, you'll need the following items:
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.
*As you are now using materials, PLEASE BE CAREFUL TO NOT DAMAGE THE SENSOR
Preparations
Step 1
Have your setup ready from the previous article [insert article]
Step 2
Get your items ready
Note: Now, I did say you can use your any material, but avoid using rough surfaces like sandpaper and jagged edges because that can easily damage the surface of the sensor.
Setup
This section be will short as you will need is to do is simply rub the sensor against the material after inputting all the necessary code.
Programming
This is the header file needed to run the Arduino file (same as last time):
- | NumTac.h
#include <SPI.h> 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:
- | SyntouchExample.INO
#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(); if ((acPressure < 2070) && (dcPressure ==163 || dcPressure == 164)) { Serial.println("Nothing"); } else if ((acPressure > 2100) && (dcPressure > 150)) { Serial.println("Foam"); } else if ((acPressure < 2100) && (dcPressure != 163 && dcPressure != 164)) { Serial.println("Al"); } }
Video
I'd like to preference that due to possible inconsistencies with how the pressure is being applied, change the code to which suits your situation the best,
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 based on the contact surface the sensor is going up against.
Speculating future work derived from this tutorial, you can use this in more of an application-sense as adding this to some sort of robotic hand. In the big picture, the problem of retrieving data from can be solved with this example.