If I wire two in parallel to an Arduino input (and 3.3V/GND supply), when one is pressed the other TP223 lights up. Do I need diode or similar?
Yes. But a diode will drop the voltage and using 3.3v, plus the diode drop, may not give you a good enough high for a 5 volt Arduino's input. If you can, use the TTP233 on 5 volts.
As this is a capacitive sensor, its input impedance will be high, have you got any wiring around the sensors that could contribute towards the effect of bounce?
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Can you post a picture of your project so we can see your component layout?
It's not a contact switch, there's no sparking. You're timing how long a probe takes to charge to see if it's sufficiently coupled with a field to call it a touch.
I used 2 of the Arduino Playground cap sense articles to make different cap sense probes work. The ones you buy that connect to touch sense port pins (Uno has none) work better in a more active fashion but basically the same. You want pictures from 6 or 7 years ago?
I don't get bounce from piezos as buttons or light reflect or beam break or ultrasonic ping or Hall sensing or much any except for switches that open and close contacts.
Wiring:
Power to each switch - 3V and GND
Left switch (orange wire) to D5
Right switch (yellow wire) to D7
Relay - activates via D6 (soldered on rear of shield)
Here is the code, works perfectly on a breadboard. Seems too simple!
Will be interesting to see how it works in real life (one switch would be aprox 6m away). I wonder if capacitance would cause an issue.
//v002 - 2 x TTP223 touch switches (pulled low), Wemos D1 mini, Relay shield.
//Credits to 3Dgeo for help with the code originally
const byte TOUCH1_Pin = D5; // define your buttons pins here
const byte RELAY_Pin = D6; // define your relay shield pin here
const byte TOUCH2_Pin = D7; // define your buttons pins here
void setup()
{
pinMode(RELAY_Pin , OUTPUT); //sets relay pin D6 as an output
digitalWrite(RELAY_Pin, LOW); //sets relay to OFF state
pinMode(TOUCH1_Pin, INPUT); //sets touch button 1 as an input
pinMode(TOUCH2_Pin, INPUT); //sets touch button 2 as an input
attachInterrupt(digitalPinToInterrupt(TOUCH1_Pin), flipRelayOutput, HIGH); // making I/O pin as interrupt pin, triggers on high state
attachInterrupt(digitalPinToInterrupt(TOUCH2_Pin), flipRelayOutput, HIGH); // making I/O pin as interrupt pin, triggers on high state
}
void loop()
{
}
void flipRelayOutput() // a function to flip the relay output, is called from the physical button.
{
digitalWrite(RELAY_Pin, !digitalRead(RELAY_Pin)); //writes the inverse value to the relay pin (booleon NOT operator )
}
877:
I've just finished building the circuit, with 2 x TTP223's going to different inputs, and a relay coil connected to another.
You had me worried there - suggesting connecting a relay coil to a GPIO pin, but you are in fact using the correct relay module with its driver transistor and flyback diode.
877:
I've wired it with pull down resistors as it seemed good practice, not sure if they are required though?
They are not required and it is not "good practice". It is important to use components where they are specifically required. Datasheet
If the button module makes the signal pin either HIGH or LOW you don't need a pulldown, it just wastes current when the pin is HIGH.
AVR INPUT read takes 1 microamp according to the datasheets, that's all the flow an INPUT gets despite the name. I've used that 1 uA in a very fast loop to count how many reads it took to drain a wire of charge filled from a transistor during an event. The more reads it took to take the INPUT LOW, the longer the actually very short event took.
Pulldowns are to prevent input wiring from holding such a charge to get 1 read per event regardless of length.
GoForSmoke:
If the button module makes the signal pin either HIGH or LOW you don't need a pulldown, it just wastes current when the pin is HIGH.
AVR INPUT read takes 1 microamp according to the datasheets, that's all the flow an INPUT gets despite the name. I've used that 1 uA in a very fast loop to count how many reads it took to drain a wire of charge filled from a transistor during an event. The more reads it took to take the INPUT LOW, the longer the actually very short event took.
Pulldowns are to prevent input wiring from holding such a charge to get 1 read per event regardless of length.
Thanks for the explanation, very useful
TomGeorge:
Redo your scope test with DC coupling, not AC.