PCB programming
For programming, I use the information from the documentation of the week, also relying on other sources:
Matt Keeter // HTM(a)A // Capacitive Multitouch
Step response documentation by Adrian Torres
Load Cells & Force Sensors.
Capacitive Sensors measure low forces.
In the Arduino IDE, the SoftwareSerial.h
and CapacitiveSensor.h
Libraries are included first, then the Rx and Tx configurations in the SoftwareSerial and the declaration of the pins corresponding to the sensor in the line CapacitiveSensor
.
#include
#include
SoftwareSerial mySerial(5, 2); // RX, TX
CapacitiveSensor cs_3_4 = CapacitiveSensor(3,4); // 10M resistor between pins 3 & 4, pin 6 is sensor pin
void setup()
{
//cs_2_3.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an example
mySerial.begin(9600);
}
void loop()
{
long start = millis();
long total1 = cs_3_4.capacitiveSensor(80);
mySerial.print(millis() - start); // check on performance in milliseconds
mySerial.print("\t"); // tab character for debug windown spacing
mySerial.print(total1); // print sensor output 1
mySerial.println("\t");
delay(100); // arbitrary delay to limit data to serial port
}
In this activity what I was able to learn about serial communications is:
π Serial communications allow you to connect two different devices by sending and receiving data between them.
Test
For the communication test, I first use the IDE's integrated monitor:
Where I did run into a snag was when using a visual GUI to display the sensor response. Using the code included in the week, it did not work π.
I also reviewed some tutorials from years past, to observe the installation on a macOS computer, as well as several forums; but still no success π©.