Hi, everyone!
I would be grateful for a solution for a phantom button presses issue I am facing.
Background
I have used following video to construct a scheme attached to the post
https://www.youtube.com/watch?v=NAl-ULEattw
It works fine with one exception:
one of the Pies is having constant phantom presses.
I have reduced length of the "orange" part of wires from 4 to 0,5 to factor out EMR - no luck.
Since one of the Pies is working fine, I suspect it might be something in the scheme I botched up.
Thanks for the feedback!
P.S. If there are any other solutions to trigger a script with a button press on multiple Pies, I am open for suggestions
Control multiple Raspberry Pi with one button (GPIO)
- Attachments
-
- connections
- scheme_800.jpg (159.82 KiB) Viewed 602 times
- Burngate
- Posts: 6401
- Joined: Thu Sep 29, 2011 4:34 pm
- Location: Berkshire UK Tralfamadore
- Contact: Website
Re: Control multiple Raspberry Pi with one button (GPIO)
You haven't connected the grounds of the two Pis together.
The top Pi, supplying the 3v3, "knows" whether its GPIOs are at 3v3 or at ground.
The bottom one just sees a floating GPIO, which could be anywhere between its ground and 3v3 (hopefully not outside that range, but you can't be sure)
You could achieve the same result by joining the 3v3 of the two Pis together instead, but not at the same time as the grounds - the two supplies would fight, and one could lose.
Depending on what else is going on, it might be better to have the switch pulling the GPIOs to ground instead of to 3v3
The top Pi, supplying the 3v3, "knows" whether its GPIOs are at 3v3 or at ground.
The bottom one just sees a floating GPIO, which could be anywhere between its ground and 3v3 (hopefully not outside that range, but you can't be sure)
You could achieve the same result by joining the 3v3 of the two Pis together instead, but not at the same time as the grounds - the two supplies would fight, and one could lose.
Depending on what else is going on, it might be better to have the switch pulling the GPIOs to ground instead of to 3v3
Re: Control multiple Raspberry Pi with one button (GPIO)
Thanks do much for your input!
I am completely new to this - this has been driving me nuts.
Out of the button
Pi1 pin 16 GPIO
Pi1 pin 20 GND
Pi2 pin 16 GPIO
Pi2 pin 20 GND
one one side of the button I connect:
Pi1 pin 20 GND
Pi2 pin 20 GND
one the other side:
Pi1 pin 16 GPIO
Pi1 pin 1 3,3v
Pi2 pin 16 GPIO
This way I can connect as many Pis as I like (I need up to 30) and the system will do what it has to:
simultaneously start a script on every Pi?
I am completely new to this - this has been driving me nuts.
following 5 wires are connected together:Burngate wrote: You haven't connected the grounds of the two Pis together.
Out of the button
Pi1 pin 16 GPIO
Pi1 pin 20 GND
Pi2 pin 16 GPIO
Pi2 pin 20 GND
Do I understand you right - GPIOs are like 3v3 - have something going on in them?Burngate wrote: The top Pi, supplying the 3v3, "knows" whether its GPIOs are at 3v3 or at ground.
The bottom one just sees a floating GPIO, which could be anywhere between its ground and 3v3 (hopefully not outside that range, but you can't be sure)
You could achieve the same result by joining the 3v3 of the two Pis together instead, but not at the same time as the grounds - the two supplies would fight, and one could lose.
So, in the code I change PULL UP to PULL DOWN and switch the wires around - i.e.:Burngate wrote: Depending on what else is going on, it might be better to have the switch pulling the GPIOs to ground instead of to 3v3
one one side of the button I connect:
Pi1 pin 20 GND
Pi2 pin 20 GND
one the other side:
Pi1 pin 16 GPIO
Pi1 pin 1 3,3v
Pi2 pin 16 GPIO
This way I can connect as many Pis as I like (I need up to 30) and the system will do what it has to:
simultaneously start a script on every Pi?
- davidcoton
- Posts: 5663
- Joined: Mon Sep 01, 2014 2:37 pm
- Location: Cambridge, UK
- Contact: Website
Re: Control multiple Raspberry Pi with one button (GPIO)
NO!
Connect a GND form each Pi to one side,
Connect a GPIO input through a 1K resistor to the other, also a 10K resistor to ONE 3V3 supply.
Do not select any PULL-UP or PULL-DOWN on the GPIOs.
The 1K resistors will prevent any damage if you accidentally make any of the connected GPIOs an output, and will help in the event of any wiring faults.
3V3 through 10K will hold all the inputs high until the button is pushed.
This will work as long as the Pis are close together, tidily wired with short cable runs. Longer runs of cable are prone to RF interference, and will need further measures -- but get the simple system working first.
That will just short out Pi1's 3V3 supply, instantly crashing it and possibly destroying the 3V3 regulator.on one side of the button I connect:
Pi1 pin 20 GND
on the other side:
Pi1 pin 1 3,3v
Connect a GND form each Pi to one side,
Connect a GPIO input through a 1K resistor to the other, also a 10K resistor to ONE 3V3 supply.
Do not select any PULL-UP or PULL-DOWN on the GPIOs.
The 1K resistors will prevent any damage if you accidentally make any of the connected GPIOs an output, and will help in the event of any wiring faults.
3V3 through 10K will hold all the inputs high until the button is pushed.
This will work as long as the Pis are close together, tidily wired with short cable runs. Longer runs of cable are prone to RF interference, and will need further measures -- but get the simple system working first.
Location: 345th cell on the right of the 210th row of L2 cache
Re: Control multiple Raspberry Pi with one button (GPIO)
Roger that!davidcoton wrote: ↑Wed Jan 29, 2020 10:38 pm3V3 through 10K will hold all the inputs high until the button is pushed.
This will work as long as the Pis are close together, tidily wired with short cable runs. Longer runs of cable are prone to RF interference, and will need further measures -- but get the simple system working first.
Will test it
Could you kindly clarify one part:
Does this mean I have to alter the 7th line of my code "GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_UP)":
import subprocess
from subprocess import PIPE
import RPi.GPIO as GPIO
import datetime
from time import sleep
GPIO.setmode(GPIO.BOARD)
GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_UP)
isRecord=False
try:
while True:
sleep(0.3)
input_state = GPIO.input(16)
if input_state == 1 and isRecord==False:
- davidcoton
- Posts: 5663
- Joined: Mon Sep 01, 2014 2:37 pm
- Location: Cambridge, UK
- Contact: Website
Re: Control multiple Raspberry Pi with one button (GPIO)
Yes.
Location: 345th cell on the right of the 210th row of L2 cache