Long distance wire GPIO input

hi
first of all sorry for my bad English, i am using oh2 with rpi3 B+ for automating my home, for living room iam using touch panel and for rooms using “CJMCU-0201-Double-Key-Button” and wire it up directly to GPIO as input contact, i use 3.3v and GND pins for powering up the sensor and input GPIO for receving the status of the sensor. my home has 3 rooms which they are 5,8,12 meters far from rpi, i have used CAT6 for wiring up sensors to rpi. the problem is when i connect three of them toghether, in oh log i get false open and closed, it seems floating. i have disconnected one of them and the two rooms works perfectly. i have used 10k pull up, external 3.3v power, 5v 6amp for rpi… they did not help, the interesting thing is that this is working perfectly in my brothers home which has exactly the same wiring and stracture… i am not an electrician so I appreciate if anyone answers the question.
thank you

Have you linked the grounds together for both the 3V3 and the 5V supplies? You need to do so if you haven’t.

And, Hello!

hello
first of all thank you for your reply and yes i have connected GND from 3.3v power to GND pin of rpi but not directly to 5v. is there any differnce?

No, that should be fine.

Could you put each button on a separate GPIO pin and link them with an openHAB rule?
It would get around your problem in a roundabout way.

1 Like

i am using touch botton for controlling lights with Openhab rules. when they change from closed to open one relay which connected to gpío turns on and off. each bottun connected to different gpio. when i connect touch two room touch keys its ok but when i power up the other room lights randomlly get on and off and in log i get random closed and open fast.

That’s probably too big for a long line. Try 1K
Presuming the power also goes over long lines, you might add a small capacitor at the button end.

thank you for you’r reply. i should use 0.1uF or 0.01uF between GND and output of sensor am i right?

I don’t think that would hurt, as well.

I actually meant something like a 0.1uF across the power supply at the switch/sensor end.

is this true?
sensor Vcc — capacitor ---------------+3.3v
sensor GND—capacitor ----------------GND
sensor Output ------------------------------gpio
thank you for your time

Maybe more like

Sensor Vcc —-------------------------------+3.3v
          |                               |
        capacitor 0.1                   pull up 1k
          |                               |
sensor GND—------------------------GND    |
                                  |       |
                         capacitor 0.1    |
                                  |       |
sensor Output ------------------------------gpio

Trying to suppress any noise pick up at both ends.

1 Like

Thank you very much my friend :wink: I will try that tomorrow and let you know the result.

Your solution worked. Now my touch sensors works perfectly thank you very much.

1 Like