Simplest circuit in the world (1 wire) and its got me beat!

So I'm trying to recreate this

As far as I can see its just 1 wire taped to a piece of foil on the screen. The code is below.

void setup() {
digitalWrite(2,LOW);
}

void loop() {

pinMode(2, INPUT);
delay(500);

pinMode(2, OUTPUT);
delay(500);

}

For mine I used a crocodile clip to an old battery terminal. Losts of surface area. The thing works like a stylus. I can press it and it registers a digit on the screen. But it doesn't turn on and off to get the repeated clicks. Im beat as to why?

Any ideas?

This is for a capacitive touch screen. You're sure your screen is capacitive and not resisitive ?

LINK

Try increasing the delay to 1000 or reducing it to 250.

What are you trying todo? You are toggling the pin 2 from output to input, nothing more.
Good Luck & Have Fun!
Gil

Thanks all

The link is a YouTube vid. Taping a piece of copper to an iPhone (so yes it’s capacitive) and toggling between input and output to simulate a finger press. Thing is I can get it to switch between being on and off. I.e it’s just on all the time like a stylus.

I can’t figure out why his example works and mine doesnt

mearsy25:
. . .

I can’t figure out why his example works and mine doesnt

If you read his description through, it was not such a great success:

As you can see in the video it works, but in reality it was very fragile. I think some additional circuitry is needed to make this more reliable. Fortunately the other touches are still registered while this is connected. I also tried two pieces of foil for multitouch, but that wasn't reliable at all.

Hoestly I don't se what the application is.
Why put a capacitive key on a phone ?
What do you need it for ?

The phone is just for easy testing. I have a Tea maker which has capacitive buttons. I've had it apart as far as possible but the capacitive control panel and buttons are all part of the logic board which is very difficult to access. Hence I need to build a capacitive touch interface to trigger the buttons

It will go Alexa --> Sinric --Tea maker

I have all the other parts of the integration working which is why this is so frustrating. I cant understand why its not working.

And no. I get the same result with the tea maker buttons. I.e I can use the probe as a dabber and activate the buttons but I cant seem to use it as a switch controlled by the code

I'm not familiar with the Sinric and didn't have much luck with Google.
What is it ?

Sinric is pretty good www.sinric.com. It also works with google home although I haven’t tested it.

I only have an Alexa. The problem with other services like IFTTT is you need to use a phrase like Alexa Trigger then the IFTTT recipe name. Sinric is more tightly integrated so devices you build appear natively as devices in the Alexa app. It exposes what ever underlying functions you have created and works with Alexa routines.

So, what I want to do is trigger my none smart home enabled tea maker to make a cuppa. I create a new sinric device called tea maker as a switch. I download the sample code. Put in the details for my wifi, a sinric API key and then add my code into the switch on routine. I upload it to the node MCU and search for new devices in the Alexa app. Tea maker pops up and I can add it to a custom Alexa routine with a custom trigger phrase “Alexa make a cup of tea”. When she hears that she sends the on command to the tea maker. The tea maker only has capacitive buttons on it and getting to the board inside is a bugger. Ive had it apart but cant figure how to separate the two clamshell parts, hence the only viable option for me is to trigger the capacitive touch button as I’ve sen others do on youtube. Thats why I’m stuck with getting the worlds simples circuit to work. Ive built far more complex things in the past. Just for some reason this one eludes me.

As is often the case I am a little further in my understanding of the problem. Im using a simple single plastic coasted wire about 15cm long. I unplugged it so its just wire, flat metal. crocodile clip plugged into nothing and notice that although there is no electrical contact with my hand. i.e there should be no path to ground the thing still triggers a capacitive screen. I then tried holding the wire with a none conductive set of plastic tongs. Same thing it still triggers the touch screen. I then taped the plastic part of the crocodile clip to my wooden fire surround and dabbed the phone against it. Same thing. it still triggers the touch screen. finally I tried the touch screen with a flat plastic object. nothing. I don't understand why this is the case. The wire is not plugged into ground. not touching ground yet still it triggers. So my code may well be switching between input and output but it makes no difference because the wire is acting like its connected to ground all the time. Ive tried wrapping the plastic of the wire in aluminium foil. Still triggers the touchscreen. I could understand in a conventional circuit if this was RFI/EMI being picked up due to the wire length but the thing is induced current in the wire should have no affect on triggering a capacitive touch screen (Or so my understanding goes). It's meant to be activated when there is a path to ground. What am I missing?

Have you also looked at other possible solutions, like googling with this search phrase:
capacitive touchscreen tap push simulator

Well I changed my search terms as suggested and came up with a little more understanding from this video
capacitive touch with wire

It seems my concept of ground was getting in the way. I am (mistakingly) thinking I am grounded because I touch ground directly rather than ground as a concept. Batteries can operate in aircraft which don't touch the ground hence ground in terms of capacitive sensing is any conductive object large enough to interfere with the capacitance of the sensor. In. this case it seems the combined bulk of the wire/foil/ battery bracket alone is enough to count as ground even when its not electrically connected to the Arduino.

Because the wire/foil combo is ground enough on its own all the device is registering is a touch all the time whether its switched input to output or not. I did manage to get it working as in the video but his comments are correct. Its extremely flakey. If you have a good electrical connection it registers ground all the time. with a poor electrical connection I can get it to do the on off thing a 1 second intervals (it matches the serial output). This would account for the posters comments.

Would you credit it. The sheet of ITO which I wanted to use to cover the conductive buttons of the tea maker just turned up. Its lovely stuff but alas I still have the same issues with it. Its conductive enough to trigger buttons on the iPhone screen but not enough to do the ones on the tea maker. It looks like I am back to the drawing board.

Capacitive touch screens detect capacitance. A piece of wire has significant stray capacitance.