I have a circuit with a Schmitt trigger connected to GPIO 23 (on a Raspberry Pi Zero W).
It should give a high (3.3V) signal when there is an AC current on the other side of the circuit.
If there is no or a very low current, the Schmitt trigger
gives low as an output (the output of the circuit is pulled down to ground with a 10kOhm resistor).
The AC current has a frequency in the range of 1-20 kHz.
This circuit is working as it should as far as i can determine by testing it with a function generator and oscilloscope.
It is also working if there are no other wires attached to the Raspberry Pi. There is a wire which is about 2 meters long and ends on a WS2812 led strip. If this wire is connected to GPIO 18, the state of GPIO 23 changes somehow to high even if there is no AC current on the Schmitt trigger circuit. Does anyone know what causes this behavior and if there is maybe a workaround for this?
A code to reproduce the error is as simple as this:
import RPi.GPIO as gpio gpio.setmode(gpio.BCM) gpio.setup(23, gpio.IN) gpio.input(23)
If the LED strip is not attached on GPIO 18 and to ground then the last line will give 0 when there is no input signal to the circuit connected to GPIO 23. But with the exactly same setup and with the LED strip attached to GPIO 18 and ground it will give 1. I also measured the exact voltage value and it gives 3.3V on GPIO 23 in this case. This is the value which the Schmitt trigger gives when it is in high output mode.
When the 2 meters twisted cable is connected to the Raspberry PI but not to the LED strip the error does not appear. So i dont think the problem is due to interference with other electrical devices.
It is also unlikely that it is caused by a malfunction of the Raspberry Pi Zero W itself; i tried it with another new Pi Zero and another original Raspberry Pi power supply and the behavior stays the same.
If i only connect one wire (the ground or the data wire) to the LED strip the error also appears in both cases.
So i am pretty sure it has something to do with the interaction of the Raspberry Pi with the external 5V power supply of the LED strip.
But what can that be?
When i measure the Voltage between ground of the Raspberry Pi and +5V of the power supply (if unconnected) i don't get 5V as expected but some millivolts instead.
The voltage between the - of the power supply and ground also gives some millivolt.
The strange thing is that the power supply works as expected and it delivers 5V to the LED strip.
Controlling the LED strip with the Raspberry also works as it should. How can that be?