touchread problems with pin 1, 18, 19

Status
Not open for further replies.

teano

Member
I have touchread working, but pin 1, 18, 19 gives me problems. They are not sensing the touch. I am using teensy 3.2 with the prop shield. The prop shield is used for the audio output and flash memory.

Pin 18/19: I see that pin 18/19 are used for I2C Data and Clock for the motion sensors. Would that create a conflict with touchread? Can i turn off the I2C?

Pin 1: What could create a conflict with Pin 1 and touchread? Can it be the serial communication?

Otherwise, I have success with Pin 0, 15, 16 and 17. The way i stacked the prop shield blocks access to pin 25, 32, and 33.

I am new to this and appreciate the help. Thank you in advance.
 
Pins 18 and 19 have pull-up resistors for i2c, and I would imagine that causes problems with touchread. These are physical connections on the board, so you probably can't remove them (without desoldering them from the board).

I don't see pin 1 listed in the schematic for the prop shield.

One possibility is not to connect pins 1, 18, and 19 to the prop shield and run wires directly to those pins.
 
If your code has Serial1.begin() anywhere, that would cause quite a conflict with touch sensing. Just a blind guess, since we can't see your code...
 
Thank you for the response. I commented out Serial.begin(). I still do not have success on the following pins (1, 18, 19).

Below is the code. I tried to clean it up.

Code:
#include <EEPROM.h>
#include <Audio.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

#define PROP_AMP_ENABLE  5
#define FLASH_CHIP_SELECT 6
#define TOUCH_PIN 16

AudioPlaySerialflashRaw  playFlashRaw1;  //xy=82.57000732421875,164.71998596191406
AudioMixer4              mixer1;         //xy=263.28997802734375,169
AudioOutputAnalog        dac1;           //xy=412.57000732421875,176.8599853515625
AudioConnection          patchCord1(playFlashRaw1, 0, mixer1, 0);
AudioConnection          patchCord2(mixer1, dac1);   
long PinBaseLine;

void setup() {
  
 //  Serial.begin(9600);

  //Audio
  AudioMemory(10);
  dac1.analogReference(EXTERNAL); // much louder!
  delay(50);             // time for DAC voltage stable
  pinMode(PROP_AMP_ENABLE, OUTPUT);
  digitalWrite(PROP_AMP_ENABLE, HIGH); // turn on the amplifier
  delay(10);             // allow time to wake up
  mixer1.gain(0, 0.9);
  if (!SerialFlash.begin(6)) {
    while (1)
    {
      delay (1000);
    } 
  }

  //Take the average value returned from touchread.
  //Set a trigger for 20% greater.
  long sum_reads=0;
  for (int x=0; x<500; x++){
    sum_reads= sum_reads + touchRead(TOUCH_PIN);
    delay(10);
    }
  PinBaseLine =    long((sum_reads/ 500) * 1.2);
   
}

void loop() {

  long theValue=0;
  theValue = touchRead(TOUCH_PIN);
  if (theValue > PinBaseLine)  
  {
    if (!playFlashRaw1.isPlaying()){
      playFlashRaw1.play("0.raw");
    }
  } 
}

Any help would be appreciated. We are making a photo album for grandma. The "touchread" will play audio files when special photos are touched.
 
Your code works for me on all touch pins with your sketch as it is.
I added some serial prints to print out the values at each stage and changed Touch pin for each pin 1 , 18, 19 etc

//Take the average value returned from touchread.
//Set a trigger for 20% greater.
long sum_reads=0;
for (int x=0; x<500; x++){
sum_reads= sum_reads + touchRead(TOUCH_PIN);
delay(10);
}
PinBaseLine = long((sum_reads/ 500) * 1.2);
Serial.println(PinBaseLine);
}

void loop() {
delay(2000);
long theValue=0;
theValue = touchRead(TOUCH_PIN);

Serial.println(theValue);

if (theValue > PinBaseLine)
{
Serial.println("theValue is Greater than Base");

if (!playFlashRaw1.isPlaying()){
playFlashRaw1.play("0.raw");
Serial.println("It is playing");
}
}
Serial.println("Test over go loop again");
}


Results on Teensy monitor below


820
684
Test over go loop again
684
Test over go loop again
683
Test over go loop again
684
Test over go loop again
6660
theValue is Greater than Base
It is playing
Test over go loop again
7601
theValue is Greater than Base
It is playing
Test over go loop again
7489
theValue is Greater than Base
It is playing
Test over go loop again
7555
theValue is Greater than Base
It is playing
Test over go loop again
685
Test over go loop again
685
Test over go loop again
 
thank you for the response. My T3.2 is soldered to the prop shield. I believe that is where the conflicts are occurring.

Pin 18/19: I followed Mr. Meissner's advice to remove the physical connection. Now pins 18/19 work with touchread(). I did not need the "motion" features for my project.

Thanks everyone for the help everyone.
 
Status
Not open for further replies.
Back
Top