The RPi setup has input Pins 20 and 21. The program is checking if the inputs are high or low constantly. If so the assigned outputs switch to high.

The unexpected result is that when e.g. Pin 20 is high Output 19 and 26 switch to high at the same time. Both inputs are recognized seperately without interferences. How can i change this result? If one input is high, one output should be high, too. No more. In the picture is the setup with a breadboard, a RPi 3 and the I/O which are connected to an I/O terminal.

enter image description here

import RPi.GPIO as GPIO
from time import sleep

GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(20, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

GPIO.setup(19, GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(26, GPIO.OUT, initial=GPIO.LOW)

    while True:
        if GPIO.input(21):
            print("Sensor1 an")
            GPIO.output(19, 1)
            GPIO.output(19, 0)

        if GPIO.input(20):
            print("Sensor2 an")
            GPIO.output(26, 1)
            GPIO.output(26, 0)


The diagram shows my breadboard with pull up resistors. I use a Raspberry Pi 3. The input signals come from a I/O terminal. Normally the input and output are connected via the I/O terminal. I installed the RPi between. How can I solve the problem, that one high detected input signal changes all of my outputs?

enter image description here

The black wire in No.10 is my output wire connected GPIO Pin 19 and No. 11 connected to GPIO Pin 26. If a sensor is activated a light is turned on as shown at No. 15 and 17. Wires from the sensors are connected to GPIO Pin 20 and 21. In diagram: Input 1 -> Output 2 and Input 2-> Output 1.

Without the Resistors the RPi gets problem with Floating (here: pull up resistors which lead the unexpected signals to GND; Sensor signal on HIGH to input).

enter image description here

Same wire color represent connected input and output via Python. -> Is Orange input wire is HIGH? Yes-> orange output wire (other pin) HIGH

On the picture is a 7" Touchscreen connected to the RPi. There are six inputs and outputs on the picture setup. I tried to extend the previous setup to six sensors.

  • What is your question? Also the diagram and pins make no sense, add details of what Pi you have. – Milliways Nov 23 '17 at 9:55
  • The diagram shows outputs connected to GPIO 9 and 11. A photo of your setup may be useful. – joan Nov 23 '17 at 10:41
  • Add a photo of the connections to the Pi. Why have you got GND -> Resistor -> GPIO Pin ? – CoderMike Nov 23 '17 at 14:14
  • 1
    @Steven it would appear as though you have lost access to your original account. Please could you follow the information here to get the accounts merged – Darth Vader Nov 23 '17 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.