Capacitive sensor

I'm a bit confused here. Pin 9 shouldn't be connected to 5v instead??

https://www.mathworks.com/examples/matlab/community/19805-control-capacitive-sensor

As far as I get that circuit, everything should work fine.
It's pretty clear pin 9 sends a siginal(Voltage) this is received by pin 2.
If you touch the capacitive plate this voltage change due to change in capacitance.

So, yeah I think everything is fine.
As long as you have the correct sketch to go with that setup.

hope this helps,
Anshu Raj

But why not conect pin 9 to 5v and save pin 9 for another application? As you said pin 9 just provide voltage.

Yes,
You can do that
But you'll have to tweak the codes.
The codes on that page seems to state something about sending siginals(Voltage) through pin 9.

So, if you want to connect the wire directly to 5V change the code.

Hi,


The diagram is for a capacitive type button sensor.
Pin 9 is not supplying a DC current,but its output pulses, Pin 2 senses the pulses from Pin 9 and signals a HIGH.

The action of touching the sensor foil is to provide a path for the pulse to go, Pin 2 then experiences a drop in the magnitude of the pulses.
The magnitude drops low enough to indicate a LOW on Pin 2.

You need to read the link provided on that page about how the Library it uses works and the Arduino code that they use.
Its a very bad matlab example as it does not provide ALL the necessary info and code.

https://playground.arduino.cc/Main/CapacitiveSensor?from=Main.CapSense

Tom… :slight_smile:

Thanks, Tom

But, jucasan dosen't want to use the PIN 9 or any other pin.
So, I think we should not use the CapacitiveSensor library.
Instead why not just use 5V. I mean the arduino will still be able to anticipate the change in voltage.
(As long as we are talking about voltage change due to change in capacitance of the foil)

I'm pretty sure that this setup will work fine.
Maybe not that efficient and accurate enough. But, will definitely work.

That's not how capacitive sensing works.
You need two pins: one to provide a changing signal, the other to sense the response to that signal.