koskit
Posts: 3
Joined: Sat Oct 06, 2018 11:52 am

Central power supply for Paspberry pi and relay

Sat Oct 06, 2018 12:42 pm

Hardware
I am planning on building a box with these components: End Result
What I basically want to do, is remotely manage 4 power outlets that will have some electronics hooked up to them. As for software, I've written my own code for this (I coded a web server that basically has an authenication page and after successful login, navigates to the "control" page that lets you "ON/OFF" each relay).

More Information
All of these parts will be inside a 2U rackmount chassis. The system will be provided with power from 220VAC (I live in Greece so if you have other questions about what will power the system, search for the local power standars, don't really know what other info to provide).

The Problem
I want to know what kind of power supply I should use to power this system. I don't want to completely rely on the RPI to power everything because I had some bad experience with 8 module relays (not enough power to even boot the pi). This time I have 4 channel relay, but I plan on adding the display as well, and to cover future scenarios of adding some wifi dongle etc, I want everything that can be powered by the power supply to do so, and avoid straining the RPI.

Below, I've added an attachment of how I plan to connect each relay from the wall outlet (220VAC), and how to control it from the RPI. I've found a power supply that can convert 220VAC to 5VDC but I don't know what amperage to use. From my understanding, each device will take what it needs, but is that really so? I mean, can I just put a |220VAC to 5VDC, 40A, 200W| power supply?

I was thinking of using THIS ONE, a "5V 18A 90W MeanWell"
  • Power: 90Watt
  • Output Voltage: 5V DC
  • Output Current: 18Amp
  • Supply Voltage: 120...373V DC, 88...264V AC
  • Protection: overload, short-circuit, voltage growth
  • Number of Outputs: 1
  • Mounting: for building in
  • Efficiency: 86%
  • Output connector: Screw Terminals
There are even smaller power supply units in the shop that I'm browsing (e.g. 5V, 3A, 15W or 5V, 7A, 15W), but maybe going overkill with 18A should cover the needs of anything I put in there? USB Hubs etc.

What I'm basically asking is: Is my poorly drawn system correct (image below)? Is the power supply connected correctly to the PI? Can I connect the relay to the 5V power supply directly? Can I connect the display to the power supply too (is not shown in the image)?

And if so, what Amperage should I use for the power supply? Should I ground everything together to the supply or the RPI?
Attachments
123.png
123.png (8.33 KiB) Viewed 646 times

LTolledo
Posts: 3585
Joined: Sat Mar 17, 2018 7:29 am
Location: Anime Heartland

Re: Central power supply for Paspberry pi and relay

Sat Oct 06, 2018 2:31 pm

Nice thing you're planning there!

From the power supply 5V, split it to go to RPi and relay board. Make sure the ground lines are connected.
This way the relay board gets power directly from the PSU and not from the RPi.
The 7A PSU seems suitable enough, though you might get away with the 3A one as well, specially if this project will run "headless"

Another thing is that the RPi may not be able to "activate" the relays due to the low voltage of the GPIO pins, compared to the activating voltage required for the relays. The (usual) relays for that kind of relay board are rated 5V, the GPIOs are 3.3v.
Its is recommended to insert a (for your project) a 7 or 8-channel transistor array, like the ULN2803A. search the forums on how to properly apply the transistor array. You may definitely need to modify your code a bit....

something like this
Attachments
1234.jpg
edited
1234.jpg (46.92 KiB) Viewed 613 times
Last edited by LTolledo on Sat Oct 06, 2018 3:32 pm, edited 1 time in total.
"Don't come to me with 'issues' for I don't know how to deal with those
Come to me with 'problems' and I'll help you find solutions"

Some people be like:
"Help me! Am drowning! But dont you dare touch me nor come near me!"

koskit
Posts: 3
Joined: Sat Oct 06, 2018 11:52 am

Re: Central power supply for Paspberry pi and relay

Sat Oct 06, 2018 2:59 pm

Thank you for your kind words and for taking the time to reply :)

If I may take a bit of your time to clarify:
  • Was my assumption that each device will take as much amperage as they need? (I am basically trying to pick up facts from posts that I see, but I'm not that good at connecting the dots when it comes to electronics, so I do need some validation :D)
  • Am I in danger of frying stuff up if I choose to use a high amperage power supply? (e.g. 5VDC 15A)
  • I have tested direct connection of a 4Channel relay to the PI, and it seems to work. Will it behave differently if I provide a power supply? I mean, I don't know if the different grounding or some "stuff" is what makes the use transistor array mandatory. So, the change "Directly connected to the PI" -> "Connected to the PSU" makes the transistor array needed?
ps. I found the transistor on the shop that I'm currently making a list from things to buy (these guys have legit everything), so I will order 1-2 (or more because I'm bad with these stuff and boarderline certain that I will destroy one).
ps2. Once again, thank you for the reply, I will make sure to post the full project once it's done to help other members :)

Brandon92
Posts: 871
Joined: Wed Jul 25, 2018 9:29 pm
Location: The Netherlands

Re: Central power supply for Paspberry pi and relay

Sun Oct 07, 2018 1:51 pm

koskit wrote:
Sat Oct 06, 2018 2:59 pm
If I may take a bit of your time to clarify:
  • Was my assumption that each device will take as much amperage as they need? (I am basically trying to pick up facts from posts that I see, but I'm not that good at connecting the dots when it comes to electronics, so I do need some validation :D)
  • Am I in danger of frying stuff up if I choose to use a high amperage power supply? (e.g. 5VDC 15A)
  • I have tested direct connection of a 4Channel relay to the PI, and it seems to work. Will it behave differently if I provide a power supply? I mean, I don't know if the different grounding or some "stuff" is what makes the use transistor array mandatory. So, the change "Directly connected to the PI" -> "Connected to the PSU" makes the transistor array needed?
  1. Yes, that is true. Its the same principle as your home installation. A small led lamp will take his small power from you outlet. And when you place a heater to the same outlet, both still work as they should. As long as the installation can deliver the total combined power, or the fuse will blow.
    This is because all the parts are parallel to each other. And not is serie.
  2. No, you are not in danger if your are using a power supply that can deliver more power. If you want, you can use a supply that deliver 100A. But, if you make a mistake in connection the part correctly. It could get quite interesting (flames, ect). So, it's also important that your wires are up to the task. And that you are using fuses, that are placed close the the power supply.
    However, the power supply needs to delivering a constand and stable 5v. So, you need to check the datasheet of your power supply that you are above the minimum current requirement of that supply. Otherwise the output voltage can rise significant.
  3. To drive the relay boards I would also advice a external transistor. Or a array like LTolledo mention. Because, with those (depants on the type and connection) relais board it is possible that a higher voltage is present at the input of your Rpi. And they don't like that.

koskit
Posts: 3
Joined: Sat Oct 06, 2018 11:52 am

Re: Central power supply for Paspberry pi and relay

Sun Oct 07, 2018 1:57 pm

Thank you for the clarifications and for taking the time to reply Brandon. Best of luck to you both!

Return to “Advanced users”