Author Topic: Logic indication that current is flowing though a connector  (Read 5052 times)

0 Members and 1 Guest are viewing this topic.

Offline derGoldsteinTopic starter

  • Regular Contributor
  • *
  • Posts: 149
  • Country: il
    • RapidFlux
I'm trying to figure out how to set a logic pin high (or low) when something is plugged into a DC socket. The socket is the source of the power. I don't have a mechanical way of finding this out (like most barrel sockets), so I have to rely either on current flowing through the connection, or voltage changes. The only way I can think of is using a comparator and a current-sense resistor (along with, I think, 3 other resistors), but is there some simpler way of doing it?

If I place a sense resistor in series I know that I'll get a slight voltage drop on across it, as well as a tiny amount of current created by the very subtle bottleneck. I thought I'd be able to use that change to trigger a mosfet or a darlington, but I'm too dim to figure it out. Is there a way to do it without adding a comparator to the circuit?
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4694
  • Country: au
  • Question Everything... Except This Statement
Re: Logic indication that current is flowing though a connector
« Reply #1 on: July 24, 2016, 01:13:38 am »
Edit, sorry you just want to detect current flow, what voltage, and what is the maximum allowable current?, where does this voltage supply originate from?
« Last Edit: July 24, 2016, 01:16:51 am by Rerouter »
 

Offline derGoldsteinTopic starter

  • Regular Contributor
  • *
  • Posts: 149
  • Country: il
    • RapidFlux
Re: Logic indication that current is flowing though a connector
« Reply #2 on: July 24, 2016, 01:28:57 am »
The voltage would be between 5V and 18V, but if I only have a solution for a fixed voltage that's fine. Amperage can go up to 5A, but I'm trying to flip a logic pin if current goes over ~5mA (so I can only use a very low-value current-sense resistor if I want to keep it small). The power supply is "in" the circuit I'm working on, it's a battery pack.

I'm guessing that since the max possible current is 5A and I'm trying to sense a minimum of 5mA that I won't be able to do so accurately (without it becoming expensive), but it doesn't have to be -- if it trips on 20mA that's fine too, as long as it doesn't trip due to something like 0.005mA.
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: Logic indication that current is flowing though a connector
« Reply #3 on: July 24, 2016, 01:34:52 am »
I haven't designed anything using them - but does anyone have an opinion on a Hall effect device for this application?
 

Offline derGoldsteinTopic starter

  • Regular Contributor
  • *
  • Posts: 149
  • Country: il
    • RapidFlux
Re: Logic indication that current is flowing though a connector
« Reply #4 on: July 24, 2016, 01:47:18 am »
I've used them, and they're very difficult to get a proper reading from. For one thing if you're trying to detect milliamps they're almost useless, but even if you're in the amps range, you have to be *very* careful how you lay out the PCB. They'll pick up noise from anything. The chips that use this almost always have some nominal resistance, so you could just as well use a very low-value sense resistor and a sensitive op-amp (it'll be cheaper than a medium-quality hall-effect sensor and more accurate).

If you must keep the sensing circuit separate then they're useful, for example high-voltage stuff.
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4694
  • Country: au
  • Question Everything... Except This Statement
Re: Logic indication that current is flowing though a connector
« Reply #5 on: July 24, 2016, 01:55:31 am »
OK so looking at the conventional approach, for lets say a 0.1V drop at 5A, you would be using 0.02 ohms, at 5mA that would then be 100uV, so technically in the ball park of what an op amp can do, but very likely to be effected by noise at the lowest end,

 

Online Monkeh

  • Super Contributor
  • ***
  • Posts: 7992
  • Country: gb
Re: Logic indication that current is flowing though a connector
« Reply #6 on: July 24, 2016, 02:08:00 am »
Diode (or 'ideal diode', FET switch) between connector and circuit, voltage divider to sense voltage on the connector side of the diode?
 

Offline derGoldsteinTopic starter

  • Regular Contributor
  • *
  • Posts: 149
  • Country: il
    • RapidFlux
Re: Logic indication that current is flowing though a connector
« Reply #7 on: July 24, 2016, 02:23:07 am »
Diode (or 'ideal diode', FET switch) between connector and circuit, voltage divider to sense voltage on the connector side of the diode?

But I still need a comparator here... Also I need to add a large FET that can handle 5A in series. Or did I misunderstand?
 

Online Monkeh

  • Super Contributor
  • ***
  • Posts: 7992
  • Country: gb
Re: Logic indication that current is flowing though a connector
« Reply #8 on: July 24, 2016, 02:26:20 am »
Diode (or 'ideal diode', FET switch) between connector and circuit, voltage divider to sense voltage on the connector side of the diode?

But I still need a comparator here... Also I need to add a large FET that can handle 5A in series. Or did I misunderstand?

What do you need a comparator for? You either have 0V or your divided supply voltage. For a wide input range, use a transistor to invert the signal. And 5A does not need a particularly large FET, SOT-26 options exist for that sort of current. Bulky diode, though.

E: SOT-26 options exist in NFET.. checking for PFET.
E2: Yes, many choices in SOT-26, SOT-23, cute little DFNs (2x2mm small enough for you?)..
« Last Edit: July 24, 2016, 02:36:41 am by Monkeh »
 

Offline NMNeil

  • Contributor
  • Posts: 40
  • Country: us
Re: Logic indication that current is flowing though a connector
« Reply #9 on: July 24, 2016, 03:17:41 pm »
I'm trying to figure out how to set a logic pin high (or low) when something is plugged into a DC socket. The socket is the source of the power. I don't have a mechanical way of finding this out (like most barrel sockets)

Change the barrel socket?
Drill a small hole in the top of the socket and have an IR LED bounce light back from the outside (shiny bit) of the DC plug when it's put in.
A magnet on one side of the socket and a hall sensor on the other to detect a drop in Gauss as the DC plug is inserted.
Sorry, I'm a real beginner at electronics and have moved from the automotive field, so most of my thinking involves purely mechanical solutions first. :-/O
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: Logic indication that current is flowing though a connector
« Reply #10 on: July 24, 2016, 03:50:10 pm »
Interesting idea - but what if a plug is inserted and the power isn't on?
 

Offline derGoldsteinTopic starter

  • Regular Contributor
  • *
  • Posts: 149
  • Country: il
    • RapidFlux
Re: Logic indication that current is flowing though a connector
« Reply #11 on: July 24, 2016, 05:32:03 pm »
What do you need a comparator for? You either have 0V or your divided supply voltage. For a wide input range, use a transistor to invert the signal. And 5A does not need a particularly large FET, SOT-26 options exist for that sort of current. Bulky diode, though.

E: SOT-26 options exist in NFET.. checking for PFET.
E2: Yes, many choices in SOT-26, SOT-23, cute little DFNs (2x2mm small enough for you?)..

I really tried to understand how this works before I posted a reply, so I wired up some tests, but I don't understand how I can get an indication voltage that I can use...

The image I'm attaching is a MOSFET being used as a "diode" the way it would be used for reverse-polarity protection. I'm using an IRF540 here, but I also tried a couple of other mosfets and they work the same. I understand that they're not modern mosfets, however, and that there are specifically mosfets designed to be used this way.
Before I connect a load to this, the source of the mosfet is 0V, and when I connect a load it's around V0.001, so it's behaving like a very low-value resistor.

How would I directly use this behavior, without a comparator, to generate a voltage high enough to turn on a small signal mosfet? I assume that I'm misunderstanding what you meant, but I don't know how else I'd configure this...
 

Online Monkeh

  • Super Contributor
  • ***
  • Posts: 7992
  • Country: gb
Re: Logic indication that current is flowing though a connector
« Reply #12 on: July 24, 2016, 05:37:38 pm »
Now ponder how you would get a voltage by using a diode. You're on the wrong side of the supply.

You'll have to get a little creative to use a FET. A simple diode, however, is pretty easy. Whether it's workable or not depends greatly on just what you're powering, and we have no idea what that is.
 

Offline derGoldsteinTopic starter

  • Regular Contributor
  • *
  • Posts: 149
  • Country: il
    • RapidFlux
Re: Logic indication that current is flowing though a connector
« Reply #13 on: July 24, 2016, 06:22:07 pm »
Now ponder how you would get a voltage by using a diode. You're on the wrong side of the supply.

You'll have to get a little creative to use a FET. A simple diode, however, is pretty easy. Whether it's workable or not depends greatly on just what you're powering, and we have no idea what that is.

I'm powering a 50ohm resistive load using a 5V power supply.
Here's how I'd place a diode in series (attached). I'd get a voltage drop across the diode, on one side or the other, when the load is attached. What am I missing?
 

Online Monkeh

  • Super Contributor
  • ***
  • Posts: 7992
  • Country: gb
Re: Logic indication that current is flowing though a connector
« Reply #14 on: July 24, 2016, 06:24:21 pm »
Now ponder how you would get a voltage by using a diode. You're on the wrong side of the supply.

You'll have to get a little creative to use a FET. A simple diode, however, is pretty easy. Whether it's workable or not depends greatly on just what you're powering, and we have no idea what that is.

I'm powering a 50ohm resistive load using a 5V power supply.
Here's how I'd place a diode in series (attached). I'd get a voltage drop across the diode, on one side or the other, when the load is attached. What am I missing?

Basic diode operation.

When the supply is not present at this connector, the anode of your diode will be at 0V (when pulled down by, say, a voltage divider). When the supply is present, it will be at supply voltage (and a voltage divider can be used to get this down to a logic level...). Who cares what the cathode is at?

If you want to change the goalposts (backreading, you seem to be doing this every post), then you'll need a current shunt and an amplifier. If you just want to sense whether the supply is at that connector or not, as your original post indicated..
« Last Edit: July 24, 2016, 06:26:31 pm by Monkeh »
 

Offline pyroesp

  • Regular Contributor
  • *
  • Posts: 180
  • Country: be
    • Nicolas Electronics
Re: Logic indication that current is flowing though a connector
« Reply #15 on: July 24, 2016, 06:44:48 pm »
What's the minimum voltage you need to have a logic 1 on your input ?

Quick search on TTL (as example) voltage levels show a minimum 2V for a logic 1 to be read.


A simple voltage divider using a resistor + zener (3.3V ?) should do the trick, for voltage sensing.


Or even a transistor + zener and pull up on the basis of the BJT:
 

Offline derGoldsteinTopic starter

  • Regular Contributor
  • *
  • Posts: 149
  • Country: il
    • RapidFlux
Re: Logic indication that current is flowing though a connector
« Reply #16 on: July 24, 2016, 06:55:06 pm »
Basic diode operation.

When the supply is not present at this connector, the anode of your diode will be at 0V (when pulled down by, say, a voltage divider). When the supply is present, it will be at supply voltage (and a voltage divider can be used to get this down to a logic level...). Who cares what the cathode is at?

If you want to change the goalposts (backreading, you seem to be doing this every post), then you'll need a current shunt and an amplifier. If you just want to sense whether the supply is at that connector or not, as your original post indicated..

You mean when I first said that the maximum would be 5A at 5-18V and then I changed it to a resistive 50ohm load? I just did that so I could understand the operation using a very specific scenario, since you said you didn't know what I'm powering. The original goal(-post) is the same, to determine if something is connected to the supply.

I think you meant using a diode on the device being connected, but I need to know this on the supply circuit. That's why I keep mentioning a sense resistor, since that's the first thing I think of to determine if current is flowing.
 

Offline derGoldsteinTopic starter

  • Regular Contributor
  • *
  • Posts: 149
  • Country: il
    • RapidFlux
Re: Logic indication that current is flowing though a connector
« Reply #17 on: July 24, 2016, 07:47:26 pm »
What's the minimum voltage you need to have a logic 1 on your input ?

Quick search on TTL (as example) voltage levels show a minimum 2V for a logic 1 to be read.


A simple voltage divider using a resistor + zener (3.3V ?) should do the trick, for voltage sensing.


Zener voltage, that could work...
If I use a voltage divider after a sense resistor then I can select very specific voltage tripping point. It would mean 1 sense resistor, 2 resistors for the divider, and a zener, which is the same part count as using a comparator but it's smaller and cheaper. The only problem is that zeners are unreliable, which leads me to the most common alternative -- the TL431. It can be used as a comparator with an internal voltage reference.

Thanks, I think this could work!

(on logic 1 -- indication of 2V would be enough, yeah, though a 2.5V change would be safer.)
 

Online Monkeh

  • Super Contributor
  • ***
  • Posts: 7992
  • Country: gb
Re: Logic indication that current is flowing though a connector
« Reply #18 on: July 24, 2016, 07:57:26 pm »
Still can't quite figure out what on earth you're doing or what you require. Or why you're overcomplicating things.

If you simply want to determine if an external voltage is present at the connector: Place a series diode in the positive rail. Sense the voltage (via divider, transistor, optocoupler..) on the anode.

If that's not suitable (heat dissipation, diode drop, ...), then you'll have to tell us more so we know what is and isn't appropriate!
 

Offline derGoldsteinTopic starter

  • Regular Contributor
  • *
  • Posts: 149
  • Country: il
    • RapidFlux
Re: Logic indication that current is flowing though a connector
« Reply #19 on: July 24, 2016, 08:41:19 pm »
Still can't quite figure out what on earth you're doing or what you require. Or why you're overcomplicating things.

If you simply want to determine if an external voltage is present at the connector: Place a series diode in the positive rail. Sense the voltage (via divider, transistor, optocoupler..) on the anode.

If that's not suitable (heat dissipation, diode drop, ...), then you'll have to tell us more so we know what is and isn't appropriate!


It may have been a mistake to mention the particular problem, I shouldn't have mentioned a connector at all.
I'm trying to set a logic pin high if more than around 5mA is flowing though a conductor. That's it. The additional relevant information is that the maximum current going through this conductor is 5A, and that I'd like to not disrupt the flow of current as much as possible. The only other parameter which is relevant is that the voltage is relatively low (less than 18V).

I shouldn't have mentioned the connector or the power supply or the particulars of the load or any of that. I just need to know if more than 5mA is flowing from point A to point B.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf