While working with the Raspberry Pi the only thing I really didn’t like about it was that you could only power two relay boards from it, and if you needed more it seemed the only way to have more relay boards was to have more Raspberry Pi’s, and I guess since you power them with only 5v anyway adding more probably doesn’t waste a whole lot of electricity, but it still kind of made me uncomfortable.
While trying to use a old cell phone that I didn’t have a battery for anymore, I started to look on the internet for ways to power a phone without a battery. I remember my first smart phone an HTC Falcon would let me plug it in and use it without a battery and I always wondered why I couldn’t do that anymore. Well I found all kinds of You-Tube videos showing how you could cut the end off of a USB cord and hard wire it right into the phone and not even need a battery, and this made me think why couldn’t I do this with a relay board?
So I cut the end off a USB cable and connected the red wire to the vcc connection and the black wire to gnd and . . . NOTHING! WTF!
So I started searching the web, I found only one article mentioning using a USB cable to power a relay for the Raspberry Pi and it was VERY vague, but I remember them saying you had to ground to the Raspberry Pi board and that was about it. What about the ground for the relay? Just leave it wide open? That scared me completely so I just gave up. For a couple days.
There can’t be a reason why you can’t do this! So I searched again, and found one more mention, and luckily the person this time when another person gave the same vague answer, don’t forget to ground to the Raspberry Pi, this time the person replied, what about the ground for the relay board? Oh, you probably want to ground that too. Huh?
But it was time to sacrifice a Raspberry Pi if that was what it was going to take, but . . .
It WORKED! WOOHOO!
So now you should be able to at least hook up 5 relay boards to a Raspberry Pi 2 and 8 relay boards to a Raspberry Pi 3, maybe more, I just am not sure how many connections you could share one ground with.
Essentially all you have to do is make a Y wire for the ground and that’s it.
I think it describes it better if we act like we are taking a connection that already works that is connected to the Raspberry Pi and convert it.
First you would make the Y wire for the ground, then you would remove the ground wire connected to the Raspberry Pi and replace it with your Y wire. Then you would plug the ground wire to the relay board to one of the ends of the Y wire. Then you would connect the black wire from the cut end of the USB cable to the other end of the Y wire. Then remove the power wire for the relay board from the Raspberry Pi (freeing up a power connection) and connect it to the red wire on the cut USB cable. Then I plugged the USB cable into a powered USB hub (5v) and voila! when I sent a command to turn on the relay IT WORKED!
So there are 5 grounds on the Raspberry Pi 2 and 8 grounds on the Raspberry Pi 3, what I just told you more than doubled your stock connections!
Sorry, Raspberry Pi, didn’t mean to cut into your profit, honest.
Mobile users click on MENU above.