I have few switches connected to Raspberry Pi inputs.
Internal pull up resistors are enabled.
When I connect pin to the ground Raspberry Pi behave fine - pin state is low.
However when I disconnect the pin from the ground it randomly change the state every few seconds.
I have tried to add external 10k pull up resistor but it haven't worked.
Pull up resistor is connected near Raspberry Pi.
Switch is connected by 7 meters UTP 5e cable.
I use pi4j library.

Asked
Active
Viewed 127 times
-1
mariusz2108
- 195
- 2
- 10
1 Answers
0
If you are actually using GPIO0 (pin 27) this is actually SDA.0 which is used to control HATs and is marked reserved on official documentation.
I believe on newer Pi models this I²C bus is also connected to on-board extenders so is used for other purposes, although this is not documented, expect the voltage on this pin to change unexpectedly.
Use any ot the other pins (and a low impedance circuit).
Milliways
- 62,573
- 32
- 113
- 225