Skip to main content
deleted 178 characters in body
Source Link

I'm trying to use a 16-channel capacitive touch sensor named TTP229-BSF with an Arduino Uno. I use the following code that doesn't work. When I touch the keys it detects the keysworks correctly when i touch directly but also prints outwhen i place two 4 mm plexiglass pads on top and try to touch over them some times wrong keys before and after detectingnumbers are printed out in the touched keyserial terminal. I linked the required jumper as shown in the attached picture. i used 22p capacitors instead of the existing 33p sensitivity capacitors for increasing sensitivity

Is there a better and more robust way to do this based on the timing diagram of the datasheet that I attached? i tried using interrupts but it didn't work

 #define SCL_PIN 98
#define SDO_PIN 3
 byte Count;9
  byte Key_State = 0;
/* Used to store the key state */
intbyte Key1;Key;

void setup()
{
  /* Initialise the serial interface */
  Serial.begin(9600);
  /* Configure the clock and data pins */
  pinMode(SCL_PIN, OUTPUT);
   
  pinMode(SDO_PIN, INPUT); 
}


/* Main program */
void loop()
{
  /* Read the current state of the keypad */
  Key1Key = Read_Keypad();
  
  /* If a key has been pressed output it to the serial port */
  if (Key1Key)
  {
   
  Serial.println(Key1Key); 
  }
     

  /* Wait a little before reading again 
     so not to flood the serial port*/
  delay(300);
}


/* Read the state of the keypad */
byte Read_Keypad(void)
{
 
  pinMode(SDO_PIN, OUTPUT);
  digitalWrite(SDO_PIN, LOW);
  delayMicroseconds(100);
  digitalWrite(SDO_PIN, HIGH);
 byte delayMicroseconds(100);Count;
  digitalWrite(SDO_PIN,byte LOW);
Key_State = delayMicroseconds(20);0;
  pinMode(SDO_PIN, INPUT);
  /* Pulse the clock pin 16 times (one for each key of the keypad) 
     and read the state of the data pin on each pulse */
  for (Count = 1; Count <= 16; Count++)
  {
    digitalWrite(SCL_PIN, LOW); 
    
    /* If the data pin is low (active low mode) then store the 
       current key number */
    digitalWrite(SCL_PIN, HIGH);
    delayMicroseconds(100);
    if (!digitalRead(SDO_PIN))
      Key_State = Count; 
    digitalWrite(SCL_PIN, LOW);
    delayMicrosecondsdigitalWrite(100SCL_PIN, HIGH);
    
 }  
  }
  return Key_State; 
}

enter image description here enter image description hereenter image description here

enter image description here enter image description hereenter image description here

I'm trying to use a 16-channel capacitive touch sensor named TTP229-BSF with an Arduino Uno. I use the following code that doesn't work. When I touch the keys it detects the keys but also prints out some wrong keys before and after detecting the touched key. I linked the required jumper as shown in the attached picture.

Is there a better and more robust way to do this based on the timing diagram of the datasheet that I attached? i tried using interrupts but it didn't work

 #define SCL_PIN 9
#define SDO_PIN 3
 byte Count;
  byte Key_State = 0;
/* Used to store the key state */
int Key1;

void setup()
{
  /* Initialise the serial interface */
  Serial.begin(9600);
  /* Configure the clock and data pins */
  pinMode(SCL_PIN, OUTPUT);
  
 
}


/* Main program */
void loop()
{
  /* Read the current state of the keypad */
  Key1 = Read_Keypad();

  /* If a key has been pressed output it to the serial port */
  if (Key1)
  {
    Serial.println(Key1);
  }


  /* Wait a little before reading again
     so not to flood the serial port*/
  delay(300);
}


/* Read the state of the keypad */
byte Read_Keypad(void)
{
 
  pinMode(SDO_PIN, OUTPUT);
  digitalWrite(SDO_PIN, LOW);
  delayMicroseconds(100);
  digitalWrite(SDO_PIN, HIGH);
  delayMicroseconds(100);
  digitalWrite(SDO_PIN, LOW);
  delayMicroseconds(20);
  pinMode(SDO_PIN, INPUT);
  /* Pulse the clock pin 16 times (one for each key of the keypad)
     and read the state of the data pin on each pulse */
  for (Count = 1; Count <= 16; Count++)
  {
    /* If the data pin is low (active low mode) then store the
       current key number */
    digitalWrite(SCL_PIN, HIGH);
    delayMicroseconds(100);
    if (digitalRead(SDO_PIN))
    Key_State = Count;
    digitalWrite(SCL_PIN, LOW);
    delayMicroseconds(100);
    
   
  }
  return Key_State;
}

enter image description here enter image description here enter image description here

I'm trying to use a 16-channel capacitive touch sensor named TTP229-BSF with an Arduino Uno. I use the following code it works correctly when i touch directly but when i place two 4 mm plexiglass pads on top and try to touch over them some times wrong numbers are printed out in the serial terminal. I linked the required jumper as shown in the attached picture. i used 22p capacitors instead of the existing 33p sensitivity capacitors for increasing sensitivity

Is there a better and more robust way to do this based on the timing diagram of the datasheet that I attached?

#define SCL_PIN 8
#define SDO_PIN 9

/* Used to store the key state */
byte Key;

void setup()
{
  /* Initialise the serial interface */
  Serial.begin(9600);
  /* Configure the clock and data pins */
  pinMode(SCL_PIN, OUTPUT);  
  pinMode(SDO_PIN, INPUT); 
}


/* Main program */
void loop()
{
  /* Read the current state of the keypad */
  Key = Read_Keypad();
  
  /* If a key has been pressed output it to the serial port */
  if (Key)
  {  
  Serial.println(Key); 
  }
     

  /* Wait a little before reading again 
     so not to flood the serial port*/
  delay(300);
}


/* Read the state of the keypad */
byte Read_Keypad(void)
{
  byte Count;
  byte Key_State = 0;

  /* Pulse the clock pin 16 times (one for each key of the keypad) 
     and read the state of the data pin on each pulse */
  for(Count = 1; Count <= 16; Count++)
  {
    digitalWrite(SCL_PIN, LOW); 
    
    /* If the data pin is low (active low mode) then store the 
       current key number */
    if (!digitalRead(SDO_PIN))
      Key_State = Count; 
    
    digitalWrite(SCL_PIN, HIGH);
  }  
  
  return Key_State; 
}

enter image description here

enter image description here enter image description here

added the new code
Source Link

I'm trying to use a 16-channel capacitive touch sensor named TTP229-BSF with an Arduino Uno. I use the following code that doesn't work. When I touch the keys it detects the keys but also prints out some wrong keys before and after detecting the touched key. I linked the required jumper as shown in the attached picture.

What is the problem here? I tried putting a delay in the order of microseconds to make the SCL clock slower but it didn't make any change on the overall performance.

Is there a better and more robust way to do this based on the timing diagram of the datasheet that I attached? i tried using interrupts but it didn't work

 #define SCL_PIN 89
#define SDO_PIN 73
 byte Count;
  byte Key_State = 0;
/* Used to store the key state */
byteint Key;Key1;

void setup()
{
  /* Initialise the serial interface */
  Serial.begin(9600);
  /* Configure the clock and data pins */
  pinMode(SCL_PIN, OUTPUT);
  pinMode(SDO_PIN, 
 INPUT_PULLUP);
}


/* Main program */
void loop()
{
  /* Read the current state of the keypad */
  KeyKey1 = Read_Keypad();

  /* If a key has been pressed output it to the serial port */
  if (KeyKey1)
  {
    Serial.println(KeyKey1);
  }


  /* Wait a little before reading again
     so not to flood the serial port*/
  delay(300);
}


/* Read the state of the keypad */
byte Read_Keypad(void)
{
  
 byte Count;pinMode(SDO_PIN, OUTPUT);
  bytedigitalWrite(SDO_PIN, Key_StateLOW);
 = 0;delayMicroseconds(100);
  digitalWrite(SDO_PIN, HIGH);
  delayMicroseconds(100);
  digitalWrite(SDO_PIN, LOW);
  delayMicroseconds(20);
  pinMode(SDO_PIN, INPUT);
  /* Pulse the clock pin 16 times (one for each key of the keypad)
     and read the state of the data pin on each pulse */
  for (Count = 1; Count <= 16; Count++)
  {
    digitalWrite(SCL_PIN, LOW);
   
    /* If the data pin is low (active low mode) then store the
       current key number */
    digitalWrite(SCL_PIN, HIGH);
    delayMicroseconds(100);
    if (!digitalRead(SDO_PIN))
      Key_State = Count;
    digitalWrite(SCL_PIN, HIGHLOW);
    delayMicroseconds(100);
  }  
   
  }
  return Key_State;
}

enter image description here

enter image description here

enter image description hereenter image description here enter image description here enter image description here

I'm trying to use a 16-channel capacitive touch sensor named TTP229-BSF with an Arduino Uno. I use the following code that doesn't work. When I touch the keys it detects the keys but also prints out some wrong keys before detecting the touched key. I linked the required jumper as shown in the attached picture.

What is the problem here? I tried putting a delay in the order of microseconds to make the SCL clock slower but it didn't make any change on the overall performance.

Is there a better and more robust way to do this based on the timing diagram of the datasheet that I attached?

#define SCL_PIN 8
#define SDO_PIN 7

/* Used to store the key state */
byte Key;

void setup()
{
  /* Initialise the serial interface */
  Serial.begin(9600);
  /* Configure the clock and data pins */
  pinMode(SCL_PIN, OUTPUT);
  pinMode(SDO_PIN, INPUT_PULLUP);
}


/* Main program */
void loop()
{
  /* Read the current state of the keypad */
  Key = Read_Keypad();

  /* If a key has been pressed output it to the serial port */
  if (Key)
  {
    Serial.println(Key);
  }


  /* Wait a little before reading again
     so not to flood the serial port*/
  delay(300);
}


/* Read the state of the keypad */
byte Read_Keypad(void)
{
  byte Count;
  byte Key_State = 0;

  /* Pulse the clock pin 16 times (one for each key of the keypad)
     and read the state of the data pin on each pulse */
  for (Count = 1; Count <= 16; Count++)
  {
    digitalWrite(SCL_PIN, LOW);
   
    /* If the data pin is low (active low mode) then store the
       current key number */
    if (!digitalRead(SDO_PIN))
      Key_State = Count;
    digitalWrite(SCL_PIN, HIGH);
    
  }

  return Key_State;
}

enter image description here

enter image description here

enter image description here

I'm trying to use a 16-channel capacitive touch sensor named TTP229-BSF with an Arduino Uno. I use the following code that doesn't work. When I touch the keys it detects the keys but also prints out some wrong keys before and after detecting the touched key. I linked the required jumper as shown in the attached picture.

What is the problem here?

Is there a better and more robust way to do this based on the timing diagram of the datasheet that I attached? i tried using interrupts but it didn't work

 #define SCL_PIN 9
#define SDO_PIN 3
 byte Count;
  byte Key_State = 0;
/* Used to store the key state */
int Key1;

void setup()
{
  /* Initialise the serial interface */
  Serial.begin(9600);
  /* Configure the clock and data pins */
  pinMode(SCL_PIN, OUTPUT);
  
 
}


/* Main program */
void loop()
{
  /* Read the current state of the keypad */
  Key1 = Read_Keypad();

  /* If a key has been pressed output it to the serial port */
  if (Key1)
  {
    Serial.println(Key1);
  }


  /* Wait a little before reading again
     so not to flood the serial port*/
  delay(300);
}


/* Read the state of the keypad */
byte Read_Keypad(void)
{
  
  pinMode(SDO_PIN, OUTPUT);
  digitalWrite(SDO_PIN, LOW);
  delayMicroseconds(100);
  digitalWrite(SDO_PIN, HIGH);
  delayMicroseconds(100);
  digitalWrite(SDO_PIN, LOW);
  delayMicroseconds(20);
  pinMode(SDO_PIN, INPUT);
  /* Pulse the clock pin 16 times (one for each key of the keypad)
     and read the state of the data pin on each pulse */
  for (Count = 1; Count <= 16; Count++)
  {
    /* If the data pin is low (active low mode) then store the
       current key number */
    digitalWrite(SCL_PIN, HIGH);
    delayMicroseconds(100);
    if (digitalRead(SDO_PIN))
    Key_State = Count;
    digitalWrite(SCL_PIN, LOW);
    delayMicroseconds(100);
    
   
  }
  return Key_State;
}

enter image description here enter image description here enter image description here

added 15 characters in body
Source Link
ocrdu
  • 9.3k
  • 23
  • 32
  • 42

Problem with ttp229BSFTTP229-BSF using Arduino Uno

hi I'm trying to use a 16 channel-channel capacitive touch sensor named ttp229BSFTTP229-BSF with an Arduino unoUno. iI use the following code that doesn't work. when iWhen I touch the keys it detects the keys but also prints out some wrong keys before detecting the touched key  . iI linked the required jumper as shown in the attached pic .
here is the link to the datasheet https://www.sunrom.com/get/611100 here is my codepicture. what

What is the problem here? iI tried putting a delay in the order of microseconds for makingto make the SCL clock slower but it didn't make any change on the overall performance. is

Is there a better and more robust way to do this based on the timing diagram of the datasheet that iI attached?

#define SCL_PIN 8
#define SDO_PIN 7

/* Used to store the key state */
byte Key;

void setup()
{
  /* Initialise the serial interface */
  Serial.begin(9600);
  /* Configure the clock and data pins */
  pinMode(SCL_PIN, OUTPUT);
  pinMode(SDO_PIN, INPUT_PULLUP);
}


/* Main program */
void loop()
{
  /* Read the current state of the keypad */
  Key = Read_Keypad();

  /* If a key has been pressed output it to the serial port */
  if (Key)
  {
    Serial.println(Key);
  }


  /* Wait a little before reading again
     so not to flood the serial port*/
  delay(300);
}


/* Read the state of the keypad */
byte Read_Keypad(void)
{
  byte Count;
  byte Key_State = 0;

  /* Pulse the clock pin 16 times (one for each key of the keypad)
     and read the state of the data pin on each pulse */
  for (Count = 1; Count <= 16; Count++)
  {
    digitalWrite(SCL_PIN, LOW);
   
    /* If the data pin is low (active low mode) then store the
       current key number */
    if (!digitalRead(SDO_PIN))
      Key_State = Count;
    digitalWrite(SCL_PIN, HIGH);
    
  }

  return Key_State;
}

?enter image description here   

enter image description here   

enter image description here

Problem with ttp229BSF using Arduino Uno

hi I'm trying to use a 16 channel capacitive touch sensor named ttp229BSF with Arduino uno. i use the following code that doesn't work. when i touch the keys it detects the keys but also prints out some wrong keys before detecting the touched key  . i linked the required jumper as shown in the attached pic .
here is the link to the datasheet https://www.sunrom.com/get/611100 here is my code. what is the problem here? i tried putting a delay in the order of microseconds for making SCL clock slower but it didn't make any change on the overall performance. is there a better and more robust way to do this based on the timing diagram of the datasheet that i attached

#define SCL_PIN 8
#define SDO_PIN 7

/* Used to store the key state */
byte Key;

void setup()
{
  /* Initialise the serial interface */
  Serial.begin(9600);
  /* Configure the clock and data pins */
  pinMode(SCL_PIN, OUTPUT);
  pinMode(SDO_PIN, INPUT_PULLUP);
}


/* Main program */
void loop()
{
  /* Read the current state of the keypad */
  Key = Read_Keypad();

  /* If a key has been pressed output it to the serial port */
  if (Key)
  {
    Serial.println(Key);
  }


  /* Wait a little before reading again
     so not to flood the serial port*/
  delay(300);
}


/* Read the state of the keypad */
byte Read_Keypad(void)
{
  byte Count;
  byte Key_State = 0;

  /* Pulse the clock pin 16 times (one for each key of the keypad)
     and read the state of the data pin on each pulse */
  for (Count = 1; Count <= 16; Count++)
  {
    digitalWrite(SCL_PIN, LOW);
   
    /* If the data pin is low (active low mode) then store the
       current key number */
    if (!digitalRead(SDO_PIN))
      Key_State = Count;
    digitalWrite(SCL_PIN, HIGH);
    
  }

  return Key_State;
}

?enter image description here  enter image description here  enter image description here

Problem with TTP229-BSF using Arduino Uno

I'm trying to use a 16-channel capacitive touch sensor named TTP229-BSF with an Arduino Uno. I use the following code that doesn't work. When I touch the keys it detects the keys but also prints out some wrong keys before detecting the touched key. I linked the required jumper as shown in the attached picture.

What is the problem here? I tried putting a delay in the order of microseconds to make the SCL clock slower but it didn't make any change on the overall performance.

Is there a better and more robust way to do this based on the timing diagram of the datasheet that I attached?

#define SCL_PIN 8
#define SDO_PIN 7

/* Used to store the key state */
byte Key;

void setup()
{
  /* Initialise the serial interface */
  Serial.begin(9600);
  /* Configure the clock and data pins */
  pinMode(SCL_PIN, OUTPUT);
  pinMode(SDO_PIN, INPUT_PULLUP);
}


/* Main program */
void loop()
{
  /* Read the current state of the keypad */
  Key = Read_Keypad();

  /* If a key has been pressed output it to the serial port */
  if (Key)
  {
    Serial.println(Key);
  }


  /* Wait a little before reading again
     so not to flood the serial port*/
  delay(300);
}


/* Read the state of the keypad */
byte Read_Keypad(void)
{
  byte Count;
  byte Key_State = 0;

  /* Pulse the clock pin 16 times (one for each key of the keypad)
     and read the state of the data pin on each pulse */
  for (Count = 1; Count <= 16; Count++)
  {
    digitalWrite(SCL_PIN, LOW);
   
    /* If the data pin is low (active low mode) then store the
       current key number */
    if (!digitalRead(SDO_PIN))
      Key_State = Count;
    digitalWrite(SCL_PIN, HIGH);
    
  }

  return Key_State;
}

enter image description here 

enter image description here 

enter image description here

Source Link
Loading