Hello,
In the most recent project of mine I'm trying to employ a 555 timer based capacitance (single contact) touch switch, schematics of which can be found here. It works fine as expected when tested with an LED, the issue arises when trying to digitalRead the output (#3 in schematic) instead by connecting it to Arduino digital pin. I'm powering the timer circuit with 9V converted via standard 7809 circuit from 12V which is received from a mains adapter (I need 9v in this setup for the project).
When the pin is set to INPUT and the output pin of 555 is connected directly via resistor, I get floating values when not touching the wire used as switch, which is understandable, but the values float when I hold the wire as well for a while (might be 555 related?), however me touching the wire causes the state of pin to change if it was low previously, so something clearly is detected. How do I use a pullup/pulldown resistor to avoid floating values with a 555 circuit like this, if that's possible at all?
I have also tried setting an arduino pin to both output and input and grounding it through a NPN and a resistor with the base connected to 555 output. I expected that this setup would give me a low reading of the output pin on arduino, when the cap sensitive wire is touched, but that didn't happen, I always got a high reading on that (pin was set to high).
When I tried to see what's going on by connecting the 555 output to arduino analog pin via resistor of course, the values alternating between 0 and 1023 constantly, without any reaction to me touching the cap sensitive wire.
When powered by the 5V from an arduino board the 555 circuit worked, but it was somewhat vague, the response was slow and not constant. The output was somewhat accurate however.
I also tried implementing both of the capacitive sensing libraries arduino has without luck before, but 555 circuit kind of suits my needs better here since I'm going to use a fairly large metallic area for one of the switches. The idea is to get it latching in code (after I get it to give me proper input on arduino).
The code I used for the first variation measuring input is simple and I doubt there's even a need to post it, but I'm just putting it here:
int incoming = 8;
void setup() {
Serial.begin(9600);
pinMode(incoming, INPUT);
}
void loop() {
int whatsup = digitalRead(incoming);
if (whatsup == 1) {
Serial.println("ON");
delay(200);
}
else if (whatsup == 0) {
Serial.println("OFF");
delay(200);
}
}
And this is the one I used with transistor, with a base hooked to the 555 output:
int sui = 8;
void setup() {
Serial.begin(9600);
pinMode (sui, INPUT);
digitalWrite (sui, HIGH);
}
void loop() {
int whatsup = digitalRead(sui);
if (whatsup == 0) {
Serial.println("ON");
delay(200);
}
else if (whatsup == 1) {
Serial.println("OFF");
delay(200);
}
}
I have also tested the circuit voltages and what caught my attention is that the output of 555 has around 0.05V voltage even when it should be off. Otherwise, with the LED on output it is as expected: around 7.5V ahead of the 1K0 resistor I have on output and around 1.8V ahead of LED, after the resistor on output.
Any ideas where I went wrong with all of this and how to get it working properly? Just please, keep it relatively simple (at least in terms I can google properly) since I'm not very experienced with arduino or electronics/programming in general. Thanks!
