Okay /g/ help me out.
I have pic related hooked up with Raspberry pi to control lights in my room which is pretty cool but the problem is that my Pi will crash if I power on 3 or more channels, I guess this is because of Pi can't power them.
How do I fix this?
I have seen many guides how to do this but none of them seem to face the same problem.
tl;dr: how do I power this externally?
Directly wire the 5v and gnd to the psu or increase the current output of the psu supplying the pi. If that still does not work then have a separate psu to power the board and link the grounds from each psu. :)
Can you post the model or link to the relay?
Usually relays operate at 5V, depending on the model with or without external PSU, but if you can power it with your Pi, I guess it can be fed with 3V (the Pi is limited to 3V). Usually 3V relays need an external source.
But yea, try to power it externally as >>52364516 said.
As others have said, you really need to know what you are working with in terms of power/current.
The Pi has very low current tolerances on the GPIO pins (like 7mA) Generally this is not enough to get enough current (usually 20mA) to the LED inside the optocoupler.
This is one of those cases where an Arduino would serve you better.
You can make a separate board with a 5V supply where the juice to the optocouplers is controlled by a small FET or BJT like a 2N3904 which is in turn controlled by the Pi.
This is why I keep saying the Pi is more fun for EE folks like myself.
If you want, I can draw up a basic schematic if you can get me some more info on the relays you bought.
>posted from my raspberry pi 2
Each relay you turn on's using more and more current. Your pi can't give that out.
>I have seen many guides how to do this but none of them seem to face the same problem.
Every one faced the same problem, they just fixed it instantly.
He's powering the relay board from the Pi's 5V pin m8.
This is the relay
Yeah, I ended up just looking on amazon.
Either way, as I and >>52364689 said, you need an external power source. The Pi just can't source or sink enough.
Here's an example setup that describes using external transistors with an external power source.
You need some current limiting resistors in series with each line. Try 200 or 300 ohms. Also, wire it up so that you are sinking current instead of sourcing. (active when the GPIO is low).
The ebay diagram >>52364762
shows that OP's board has PNP (low=on) transistors (not optoisolaters) with built in base resistors.
OP simply needs to power the boards Vcc directly from the power supply, or use another power supply and connect the grounds as already been said.