Capacitive sensor causes interference, as soon as it is connected to the Arduino

I have two sensors connected to the digital pins on my arduino uno. A capacitive sensor that has two states, LOW and HIGH, is connected to digital pin 5. A wire sensor is connected to digital pin 2. The capacitive sensor goes to HIGH, as soon as an object is in front of it. When the capacitive sensor goes to HIGH, the wire sensor on pin 3 also sends out a voltage of 4 volts, even though there is no movement and thus it should stay LOW. This problem only occurs, if the capacitive sensor is connected to the arduino. If the capacitive sensor is not connected, there is no interference between the sensors. The sensors are connected to the same supply (12 volts and max. current 0,4 amps) and have a common ground. The capacitive sensor is used to calibrate a test bench. A metal plate moves backward until it reaches the capacitive sensor. The sensor then goes to HIGH and everything stops until a user input is given. The problem here is, that as soon as the test bench is calibrated, meaning that the metal plate is directly in front of the capacitive sensor, the wire sensor gets the output of 4 volts. This leads to a HIGH on the digital pin, simulating a forward movement, even though the plate is standing still. In my understanding the wire sensor should only give out a signal, if the wire is moving. These are the different outcomes summarized:

  1. Cap. sensor is not connected to digital pin: cap. sensor sends out HIGH (12 volts) and no output voltage from wire sensor.

  2. Cap. sensor is connected to digital pin 5: cap. sensor has output voltage of 7.5 volts when object is in front of it and wire sensor has output of 4 volts. If I measure the voltage on the supply connection, the 7.5 volts of the cap. sensor add up to the 12 volts of the supply.

I tried moving the connection to different pins, as I thought that they were too close and that being somehow the reason for the interference. I read about ground loops, but as I connected everything on a common ground, this should not be the problem. I don't really know what the problem here could be, so I would really appreciate your help.

Components:

Capacitive Sensor

Wire sensor WPS-1250-MK46-E

Schematics please. Words don't give any large picture, no overwiew.

You should not be connecting a sensor that gives a 12V output directly to an Arduino input.

The input voltage should be less than 5V. You are likely to damage your Uno.

See the following from the ATmega328P datasheet:

1 Like

That is totally right and I excuse myself for it. I will have to upload the schematics tomorrow, as I will not be able to do one today.

That is absolutely right... thank you.

Pen and paper usually work well enough for schematics. No fancy CAD needed.

I just did not have the time yesterday, but here is the schematic. I hope everything is readable. The supply voltage and ground are from the same power supply. As I understood, the wire sensor sensor has two cables, that need to be connected to ground (according to the data sheet on page 59. In this case I have the pin assignment E, E830). There is also a stepper motor connected to the Arduino, but that does not matter. I tested several times without the motor connected and the problem still occurred, so for easier reading I did not include it in the schematic.

This is the assignment for the cables of the wire sensor from the data sheet:
image

So I have the white and gray cable connected to ground, brown to the supply and green is connected to the arduino via digital pin 2.

Hi, @lernaeis
Look at the spec for the cap sensor.


You will notice it has PNP output.
Google;

what is pnp output sensor

You need to add a resistor between signal output and gnd.

You need to read the output spec of the cap sensor.

Tom.. :smiley: :+1: :coffee: :australia:

1 Like

You are connecting the wire sensor incorrectly as well.

The encoder has three outputs: A, B and O.

They give out the following signals:
image

(The inverted signals are not available, and the one labeled zero pulse is 'O').

You have got 'A' connected to digital pin2.
You have ignored 'B'.
You have short circuited 'O' to GND.

1 Like

@TomGeorge This is groundbreaking, thank you so much. I did not know about PNP/NPN outputs, so this is was a major help! I will look into it and connect a resistor

@JohnLincoln

I am sorry if my schematic led to confusion, as I did not include 'B'. I have connected 'B' to digital Pin 3. But to be honest, I do not know what the zero pulse does. It get that it is used for referencing, but I could not find anything on how to do that or how it really works. Maybe I googled the wrong thing, but I would be more than grateful for an explanation (a link to an explanation of course works too)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.