Power Supply LED indicator

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
Multiphase
 
Posts: 5
Joined: Thu Mar 13, 2014 3:06 pm

Power Supply LED indicator

Post by Multiphase »

Hello,

I want to use an old PC power supply to power my electronic projects. These things output 12V, 5, and 3.3V which is perfect.
So I build a nice casing and wired the outputs to jacks where I can plug in cables to connect my circuits.

To make the whole thing even prettier I want to add status LED next to each Voltage output jack that turns the LED on, when a load is connected (my experimental circuits).
I cant connect the LED in line with the load since it would destroy the led if to much current is taken by the load - so I am looking for a solution to detect a load between the output jacks and the Ground jack and switch on the respective LED which ideally runs on a separate 5V circuit.

I was messing around with a small transistor after I found this example
http://www.edaboard.com/thread82448.html
on the net, but it turned out to not work for my problem.

Any simple solutions are welcome! Will post pictures of this project when it is done :)

This is basically the setup:

+ 12V----( o )-------------+-------= O = LED1
+ 5V-----( o )-------------|----------o LED2
+ 3.3V---( o )----------[LOAD]-------o LED3
---------------------------|
-GND----( o )--------------+

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Power Supply LED indicator

Post by adafruit_support_mike »

What you need is a current sensor. The basic idea is that you put a small resistor in series with the load and measure the voltage across that.

We have a couple of current sensors in the shop:

http://www.adafruit.com/products/1164
http://www.adafruit.com/products/904

but honestly, those are overkill for what you want to do. For your purposes, an LM339 comparator would be good enough:
sensor.jpg
sensor.jpg (22.01 KiB) Viewed 517 times
It looks kind of complicated, but really isn't that bad. The actual current sensor is just the part along the bottom. The diode and resistors at the top are a low-level voltage reference.

The 10k resistor tied to the 5v rail sends about half a milliamp of current through the diode. For current in that general range, the voltage across the diode will be somewhere near 650mV. The exact numbers don't matter much because doubling the current only changes the diode voltage by about 18mV. "Somewhere around 650mV" is accurate enough for this job.

The 10k-100 voltage divider in parallel with the diode takes about 1% of the diode voltage and sends it to the LM339 as a reference value. As long as the voltage across the 0.1 ohm sense resistor is less than the reference voltage, the LED will remain off. If the voltage across the sense resistor rises higher than about 6mV, the LED will come on.

In theory you could connect the LM339's positive input to GND. Then the LED would come on as soon as there's any voltage across the sense resistor at all. Unfortunately the LM339 isn't perfect. It has an offset voltage of up to 5mV, meaning the input voltages can differ by as much as 5mV when the comparator says they're equal. That's pretty good for most applications, but can cause trouble when both inputs are close to GND.

You can trim the reference voltage to get the level of sensitivity you want, and can use different sizes of sense resistors for various current loads.

The LM339 is a quad comparator, so you get four of them on the same chip, and they cost about 40c in small batches. You can use the same 10-diode voltage reference for several comparators, but might want to use different scaling voltage dividers for each comparator.

Multiphase
 
Posts: 5
Joined: Thu Mar 13, 2014 3:06 pm

Re: Power Supply LED indicator

Post by Multiphase »

Hey,

thank you very much for your detailed explanation!

I got 2 LM339's but I forgot to buy the 0,1 ohm sense resistor. The smallest resistor I got is 10 ohm, I'll try to change the ratings of the other resistors to compensate this. I actually bought 2 LM339 so I can burn one up :D

Resistors <1 ohm seem quite hard to get in general, my local online electronics shop suggests resistance wire.

Anyway, thanks again for your help, I cant wait to power my adafruit stepper motor with this thing, I'll keep you updated on my progress!

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Power Supply LED indicator

Post by adafruit_support_mike »

You can make a 0.1 ohm by putting a bundle of ten 1-ohm resistors in parallel. That's a common technique.

It distributes power equally through all the resistors so they don't heat up too much.

Multiphase
 
Posts: 5
Joined: Thu Mar 13, 2014 3:06 pm

Re: Power Supply LED indicator

Post by Multiphase »

Mike,

I wired everything together like below:
Image

I connected V+ directly to 5V, did I short circuit the IC? Because the LED was always turned on no matter what voltages have been applied to the inputs. Are there any current limiting resistors on V+ and the inputs necessary?

I did a test with a rotary pot on the negative input where I can regulate the voltage from about 4.8 V to 5.2V. I used the 5V rail as reference Voltage (positive input). As I write this I recall that the 5V rail did not exactly output 5V but a little bit more so I have to check this. I connected an LED with a 220 ohm resistor from the output to 5V (Do I need the 1k resistor there?).
This basically should work, right?

This is the data sheet of the LM339A:
https://dl.dropboxusercontent.com/u/208 ... LM339N.pdf

Edit: Image and link fix

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Power Supply LED indicator

Post by adafruit_support_mike »

That should work, yeah.

I like your diagrams BTW - that's a valuable skill to cultivate! ;-)

Multiphase
 
Posts: 5
Joined: Thu Mar 13, 2014 3:06 pm

Re: Power Supply LED indicator

Post by Multiphase »

Good news, the IC's are still working :D

I followed the build on this site http://www.embeddedhacks.in/p/basic-ele ... cs_13.html (Scroll down to 1. Basic Comparator Circuit)
and it did work. LED turns on at 2,5V.

Dunno though why MY circuit didn't work, I will have a closer look tomorrow.

Thanks!

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Power Supply LED indicator

Post by adafruit_support_mike »

Double-check your datasheet to make sure you have the positive and negative inputs going to the right places. It's *really* easy to swap them.

Multiphase
 
Posts: 5
Joined: Thu Mar 13, 2014 3:06 pm

Re: Power Supply LED indicator

Post by Multiphase »

I got your original circuit now working, nice stuff :D

Unfortunately I bought 1 ohm instead of 0.1 ohm resistors for the voltage probes. But these babys can take 5W power so I think it should work out.
I thought I share some pics of my project for anyone interested.

Image
First the circuit on the breadboard. The yellow led is my load. The fat resistor is the 1 ohm one. The rest of the circuit is pretty much like Mike's layout some posts above. The blue/black jumper at the load coming from gnd is only for confusion and actually not connected to anything (definitely confused me when I looked on the photo, lol). Sorry for the bad quality.

Image
And this is the housing for the power supply. Its made of 3mm hard foam plastic plates I got at an local hardware store. Its pretty light and nice to work with but I had to glue some rips on the inside of the front plate to prevent bending and stiffen the whole thing out. The PSU is some Taiwanese brand with a 300W rating. I got it for free so no complaining. The output ratings are 28A on the 3.3V rail, 30A on the 5V rail and 15A on the 12V rail. Should be more than enough I guess (definitely to much for the 5W resistor^^). The 15A fuses I added to each rail definitely need to be adjusted.

Image
The front side has 3 4mm jack plugs for the rails with the famous LEDs next to them. The single hole below is for ground. I plan to add another jack for voltage measuring with the volt meter. Below the meter will be a rotary switch where you can switch through the voltage on the rails (pretty redundant actually) and to measure mode that will be connected to the soon to be there measuring jack. Since the fan of the PSU is always running I might use the 2 temperature sensors I got in spare and a an Attiny µC to do some regulation.

BTW: Is there a way to embed thumbnail image previews?


EDIT:

Just realized that the circuit will not work for my application since all rails share one common ground. I will just connect the LED in parallel on each rails so you at least see that the fuses on the rail are not blown.

User avatar
Renate
 
Posts: 291
Joined: Tue Nov 13, 2012 3:21 pm

Re: Power Supply LED indicator

Post by Renate »

Multiphase wrote:Just realized that the circuit will not work for my application since all rails share one common ground.
Yes, that's why we like to use "high side" monitoring.
You use the teensiest resistor possible on the hot wire of the supply.
That way all your grounds are all the same.

I have a little 0-12V 2A supply that I use with a TI INA219 high-side current/voltage monitor with I²C interface.
The sense resistor is 0.050 ohms and is also inside the voltage regulation loop so there is no "drop".
It connects to an ATMega32u4 which allows you to send the measurements over USB to monitor and graph.

The screenshot is of the old version of my monitoring program on Windows.
Attachments
Windows
Windows
powermon.png (29.72 KiB) Viewed 364 times

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”