declanmalone
Posts: 9
Joined: Fri Nov 23, 2012 5:25 pm

Need circuit help: get Pi to turn on/off PC PSU and disks

Fri Aug 02, 2013 10:00 pm

Hi there,
I'm using the Pi to help me learn some electronic circuit skills. I have an ATX power supply unit (PSU) from an old PC and I want to use the 12V from it to power up four external USB drives, using the Pi to turn the PSU on, and also to switch power to each of the four drives on/off individually. Each disk is connected to a different Pi, so I want to be able to have that Pi turn on the power to the disk when it's needed, and turn it off again after it's unmounted.
I haven't got very far with my project, since I'm only learning how to go about building circuits like this. I have a fairly long web page describing what I'm doing here: http://declanmalone.com/pi_psu_project/. It is a bit long, so all you have to know is that it's supposed to turn on/off the power supply and then turn on/off a switch connecting the +12V lines from the PSU to the disks.
Where I'm stuck at the moment (besides waiting for components!) is designing the circuit correctly. Here's what I have come up with:
Image Enlarge: http://declanmalone.com/pi_psu_project/ ... uts_bb.png
(Fritzing: http://declanmalone.com/pi_psu_project/ ... inputs.fzz)
From left to right, what I have is
* I take four GPIO inputs from the Pi (later, from four different Pis), put pull-down resistors on the lines and then OR all the values in the IC shown. Thus the output (pink wire) should be 1 if at least one Pi has set its GPIO outputting a 1 value. The GPIO input from the Pi(s) is supposed to indicate that we should turn the power supply on.
* The pink wire comes into the base of the first transistor and it's supposed to turn on the orange LED and also supply base current to second transistor which short-circuits the grey wire from my PSU, telling it to turn on (legs on each transistor are collector, base and emitter from left to right)
* The red LED takes +5V standby power (purple wire) from the PSU to indicate that it's plugged in
* The green LED takes the +5V "Power Good" (orange wire) from the PSU to indicate that it's powered on and providing stable voltage for driving devices
* The brown wire from the Pi is supposed to turn on/off a logic-level (meaning 3V3 should be enough to switch it on) MOSFET which in turn provides power to a device connected through a fuse to the PSU's 12V supply wire (yellow)
I'm happy enough with most of this, but I'm not sure about the way my transistors are wired up. Here's the schematic detail:
Image (Full size: http://declanmalone.com/pi_psu_project/ ... detail.png)
This is the third circuit I came up with, and is as yet untested. Both of the other circuits just had one transistor, but had some issue:
1. pink wire comes in and turns on a path from +5V PS_ON through an LED and resistor, into the collector and down to GND. This failed to turn on the PSU, although the LED lit up (I guess the voltage drop across the LED/resistor was too big so the PSU didn't detect PS_ON as being "low")
2. pink wire goes through LED and resistor before entering base, short-circuiting PS_ON to GND (this works, turning on the PSU, but the LED is dim)
So the goal for the above circuit was to have the LED at full brightness and to turn on the PSU (have it detect PS_ON as actually shorted). Which brings me to my main question: Will my circuit work? Also, if it does, do I need to put in a limiting resistor between the emitter of the first transistor and base of the second? If not, how do I wire things so that I get the LED and a proper short on PS_ON?
I've also got a second question. In the above schematic, all four of the purple wires going into the OR gate are coming from the same Pi. Later, I want to have GPIO, +3v3 (to power the OR gate and the LED showing that a Pi wants to power up the PSU) and ground wires coming from four different Pis. Is it OK if I simply wire all the +3v3 lines together and all the GND wires together? I think that should be safe, but I'd like to be sure before doing it!
I'm sure this is some pretty simple stuff for someone who knows electronics, but as I said, I'm just learning right now. If anyone could help me with this it would really be appreciated!

pifab
Posts: 70
Joined: Wed Mar 27, 2013 7:44 pm

Re: Need circuit help: get Pi to turn on/off PC PSU and disk

Fri Oct 18, 2013 5:18 pm

Hey, sorry I cannot help you out, but would like to know where you are right now with your circuit. Is it working already? Cheers.

GauVeldt
Posts: 24
Joined: Thu Mar 14, 2013 4:46 pm
Contact: Website

Re: Need circuit help: get Pi to turn on/off PC PSU and disk

Tue Sep 08, 2015 6:00 am

Linking the Pi and PSU grounds might not be such a great idea since they may vary in potential causing ground loop interference and possibly damage. The best approach is probably an optocoupler whose input is driven by the Pi and whose output drives the PSU's 5V line.

User avatar
rpdom
Posts: 16746
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Need circuit help: get Pi to turn on/off PC PSU and disk

Tue Sep 08, 2015 6:12 am

GauVeldt wrote:Linking the Pi and PSU grounds might not be such a great idea since they may vary in potential causing ground loop interference and possibly damage. The best approach is probably an optocoupler whose input is driven by the Pi and whose output drives the PSU's 5V line.
However the plan was to use the PSU to power hard drives which will be connected to the Pis (via USB), so the grounds will be connected together anyway.

Connecting the 3.3V supplies from the Pis together is a bad idea as the 3.3V lines will all be at slightly different levels and the PI regulators could end up fighting each other to death. In this sort of situation I'd look at a passive "OR" circuit involving diodes and resistors so no power is required.

GauVeldt
Posts: 24
Joined: Thu Mar 14, 2013 4:46 pm
Contact: Website

Re: Need circuit help: get Pi to turn on/off PC PSU and disk

Tue Sep 08, 2015 5:10 pm

rpdom wrote: However the plan was to use the PSU to power hard drives which will be connected to the Pis (via USB), so the grounds will be connected together anyway.

Connecting the 3.3V supplies from the Pis together is a bad idea as the 3.3V lines will all be at slightly different levels and the PI regulators could end up fighting each other to death. In this sort of situation I'd look at a passive "OR" circuit involving diodes and resistors so no power is required.
Agreed on 3.3V lines. Optocouple each 3.3V signal (trivially routed via resistor to its own Pi's GND) with the PSU 5V standby power, each optocoupled output powering an LED and then four lines are tied together at the gate of the transistor controlling PS_ON. The 5V output from each optocoupler is likely more than enough to fully illuminate its LED. Simple transistors could replace the optocouplers but no guarantee of line safety on those 3.3V lines in that case. Any Pi can activate its signal, driving the optocoupler and delivering power to the gate of the transistor. Multiple pi's may be on and this setup just functions as an OR with fully isolated inputs.

GauVeldt
Posts: 24
Joined: Thu Mar 14, 2013 4:46 pm
Contact: Website

Re: Need circuit help: get Pi to turn on/off PC PSU and disk

Tue Sep 08, 2015 5:15 pm

Are there optocouplers around that can drive 12V output signals with 3.3V level inputs while not releasing factory smoke? If so, there's an alternative solution for that brown wire.

User avatar
rpdom
Posts: 16746
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Need circuit help: get Pi to turn on/off PC PSU and disk

Tue Sep 08, 2015 5:21 pm

GauVeldt wrote:Are there optocouplers around that can drive 12V output signals with 3.3V level inputs while not releasing factory smoke? If so, there's an alternative solution for that brown wire.
The point about opto-couplers is that the input voltages are completely isolated from the ouput stage voltage. You can get opto-couplers that will switch hundreds of volts with a 2V input. All they are is an LED and a photo-transistor (or triac) in one package.

The standard ones will switch up to about 30V at 50mA with no problems.

Return to “Interfacing (DSI, CSI, I2C, etc.)”