0

I currently have 4 Pi's, soon to have 40. I have them setup to take a picture when a signal is detected via GPIO. Individually they work.

I connected the pins on all 4 to one wire, and the grounds on all 4 to another wire. Then connected the wires and only one took a picture. I then broke it down and added one Pi at a time. Up to 3 worked, but the forth one threw it off again.

The weirdest thing is, I took the pin from the 4th Pi off the chain, and tried to get the first 3 to work again, and only the 4th Pi took a picture... Even though its ground was the only thing connected Where am I going wrong here? How can I trigger them all with one button?

current wiring

  • No reason why this shouldn't work. Could you edit your post and include a diagram showing how the button is connected to the Pis? – joan Jun 6 '16 at 21:56
  • I've added a basic diagram. It's a very basic setup. – Michael Williams Jun 6 '16 at 22:09
  • You need to show the button. Does it just connect GPIO21 to ground when pressed? Are there any pull-ups to hold GPIO21 high when the button isn't pressed? – joan Jun 6 '16 at 22:13
  • I see, There is no physical "button" I physically connect the wires, then disconnect them. – Michael Williams Jun 6 '16 at 22:20
1

If it isn't time sensitive on the snapshots, maybe have one pi create the dir if not exist then add check if exists and a sleep to the rest to allow the directory to be created.

I would also add a diode to all the positive lines on each pi to prevent each pi from backfeeding a false trigger.

  • I changed it so one creates the directory if it doesn't exist. The others save it to the sd then move it to the directory after its created. – Michael Williams Jun 7 '16 at 22:40
  • Hope that works out for ya. If it does could I get the honor of the accepted answer? – Dan V Jun 8 '16 at 0:03
0

Joining the pins to one button doesn't appear to be the issue. The issue is in my script that was creating a directory if it did exist. The problem was all 4 trying to make a directory if it didn't already exist, and one would see that the directory didn't exist, and try to create the directory, but another pi beat him to the punch.

  • Does this mean the question has been resolved? – joan Jun 7 '16 at 8:00
  • Yes, it was a coding error that became more likely to happen with each additional pi. – Michael Williams Jun 7 '16 at 22:41
0

I highly suggest adding a pullup/pulldown resistor or some other pullup/pulldown mechanism. I suspect having different power supplies for each Pi has something to do with this. Also, I don't see any pullup/down resistors in your diagram.

A quick search would result in a simple pullup/down circuit (i.e. just add a resistor between GPIO and ground for each Pi).

An alternative would be to do it programatically since the Pi's GPIO pins can be pulled high or low in-software. This would be the most practical option.

Take note that you may or may not have to change your trigger logic. For example, for a pullup setup, detecting a low would mean the button was pressed. For a pulldown setup, detecting a high would mean a button press. I'm sure you get what I mean.

I also suggest getting an actual switch/button since manually connecting wires can almost always cause issues with bouncing, unless proper debouncing logic is implemented (in software and/or hardware).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.