Need some help creating a circuit to detect when a USB device is charging and illuminating a status LED.

crutschow

Joined Mar 14, 2008
34,432
Below is the LTspice simulation of an op amp circuit, that keeps the LED turned on down to about 50mA.
It detects the voltage drop through a 0.2Ω resistor in the return line (R3) and turns the LED when that drop exceeds the 10mV generated by divider R1 and R2.

1660889096848.png
 
Last edited:

Thread Starter

RussellReal

Joined Aug 18, 2022
16
1660889399721.png

do these arrows mean something? Like to ground? I'm assuming it means to attach it to the low side. but what is the BOTTOM LEFT one? isn't that already on the low side? I've never seen diagrams made this way is why I'm asking.

Thank you for your time and help everyone.
 

crutschow

Joined Mar 14, 2008
34,432
do these arrows mean something?
Yes, they are a standard ground (common) symbol to indicate that all those indicated points are connected together as common.
Using the symbol eliminates a lot of wires, and makes the schematic look cleaner and easier to read.
isn't that already on the low side?
Not necessarily.
Ground can be any point as arbitrarily designated by the circuit designer, not just the "low side".
I've never seen diagrams made this way
Then you haven't looked at many schematics.
Most proper electronic schematic diagrams have some point indicated as ground/common.
All circuit voltages are referenced to that point.
Newbies may leave it out of their schematics, but that's not good practice.
 
Last edited:

Thread Starter

RussellReal

Joined Aug 18, 2022
16
Yes, they are a standard ground (common) symbol to indicate that all those indicated points are connected together as common.
Using the symbol eliminates a lot of wires, and makes the schematic look cleaner and easier to read.
Not necessarily.
Ground can be any point as arbitrarily designated by the circuit designer, not just the "low side".
Then you haven't looked at many schematics.
Most proper electronic schematic diagrams have some point indicated as ground/common.
All circuit voltages are referenced to that point.
Newbies may leave it out of their schematics, but that's not good practice.
Thank you! R1 and R2 is a voltage splitter, right? For the reference voltage on the OpAmp, 100k and 200 are arbitrarily picked? just to give a very low voltage for the reference voltage? Can I use the TL072CP that I already have or should I purchase the OpAmp in this schematic?

Another probably newbie question but how do you guys know which OpAmp to use? Is it in the naming convention? Or you guys search a database based on the specs you want/need?
 

WBahn

Joined Mar 31, 2012
30,058
For that circuit, the opamp that you choose needs to have a common-mode input range that includes the negative supply rail. The recommended operating conditions for the TL072 do not meet this. Instead, it wants the lowest voltage input signal to not go below 2 V above the negative rail.
 

Thread Starter

RussellReal

Joined Aug 18, 2022
16
Okay I'm putting together the shopping list, however, I'm finding it hard to get 0.2 Ohm resistors, I found "0.1 ohm cement resistor 5w", are resistors special in any way or could I just put two of those together in series and have 0.2 ohms?
 

crutschow

Joined Mar 14, 2008
34,432
100k and 200 are arbitrarily picked? just to give a very low voltage for the reference voltage?
The values were picked to give about a 10mV reference voltage.
So the values can be considered arbitrary as long as their ratio gives 10mV (for example 50kΩ and 100Ω).
I found "0.1 ohm cement resistor 5w", are resistors special in any way or could I just put two of those together in series and have 0.2 ohms?
Yes, putting resistors in series or parallel (for example five 1Ω resistors in parallel will also give 0.2Ω) to get a desired resistance is perfectly acceptable (but it doesn't need to be a large 5W type).
 

Thread Starter

RussellReal

Joined Aug 18, 2022
16
Thank you all so much, I will update you all when the circuit is complete probably a few days :) Maybe even some pictures! I really appreciate all the help I've received here, a very warm welcome!

Hope one day I'll be helpful to newbies, just like you guys were to me :)

- Russell
 

Thread Starter

RussellReal

Joined Aug 18, 2022
16
1661033361539.png

okay, question.... I'm building this circuit, are the red arrows correct? or are the purple arrows correct? Is the bottom line the same as the 'positive' rail? Where would R3 be placed in an actual physical build? because R2 and the LM358 look to be connected to the negative side of the circuit in certain areas, but then R3 is between R2 and LM358? Sorry I ask so many questions. How my brain is looking at this circuit is probably not how its actually done...

Here is how my mind is interpreting this...

1661033793852.png


sorry if my depiction doesn't make any sense lol. Basically R3 is separate from the negative rail. and bridges between the + detection whateermabobber in the LM358 and the voltage splitter resistor R2. also before R2 the negative rail begins again?

I'm so sorry to keep bothering you guys!
 

LowQCab

Joined Nov 6, 2012
4,072
Any "Ground-Symbol" connects to all other "Ground-Symbols",
it is NOT an "Arrow".

On a "Single-Ended" Power-Supply Circuit,
there is normally only "Ground-Symbols" and a "Positive-Rail",
but there may be a complete Ground-"Rail" also,
sometimes with only 1, or no, Ground-Symbol shown.

This Schematic uses both multiple Ground-Symbols, and a partial "Ground-Rail",
( a full Ground-Rail would run from left to right all the way across the whole Schematic, un-interrupted ),
the Resistor, ( R3 ), is where the "Ground-Rail" stops,
and becomes something other than Ground, or, not-Ground.
This normally means that the Voltage on the other side of the Resistor is "above-Ground",
or some Positive, and possibly fluctuating, Voltage,
but under certain circumstances,
it is possible to have some signals temporarily drop "below-Ground" potential,
but this is usually an undesirable condition.

Resistors R1 & R2 make-up what is called a Voltage-Divider.
They will create a particular Voltage that has a value, or potential,
that is somewhere between the Positive-Rail and Ground.
Other outside influences can make this Voltage deviate from it's intended value,
but in this case, the only other thing connected to it is one of the Input-Pins of
an Op-Amp, which are normally extremely high Impedance,
so this connection will generally not cause very much deviation in the created Voltage,
but the Voltage will have a definite influence on the behavior of the Op-Amp.

The Power-Supply Wires for the Op-Amp, ( or other devices), are quite often not shown,
as they are assumed to be there, otherwise the Op-Amp would not function.
There are also "Bypass-Capacitors" that MUST be installed close to
the Op-Amp-Chip for stable operation, but they are almost never shown.

Operation of the Circuit ............
The Ground path of the Load is interrupted by R3, before it can return back to Ground,
this causes the Voltage at the Resistor to be "above-Ground" by a precise amount,
which is dependent on the amount of Current flowing through the Resistor,
and the value of the Resistor in Ohms.
This "slightly-above-Ground-Voltage" is connected to one of the inputs of the Op-Amp,
the other Op-Amp input has a fixed-Voltage created by the "Voltage-Divider",
which in this case, equals 200 / 100,000 = .002 X 5-Volts = 0.01-Volts.

So, if the "slightly-above-Ground-Voltage" created by the Current being draw by the Load,
and then passed through R3,
exceeds 0.01-Volts above-Ground,
the Op-Amp will flip it's Output-State, and turn on the LED.
.
.
.
 

crutschow

Joined Mar 14, 2008
34,432
I'm building this circuit, are the red arrows correct?
Is the bottom line the same as the 'positive' rail?
No, No, No.
The purple arrows are correct.
All the ground symbols represent the same point.
Why would you think you can connect them to a different node?

You connect the components exactly as shown in my schematic.
The load current must go through R3 so the connection to the right of R3 is not ground.
 

Thread Starter

RussellReal

Joined Aug 18, 2022
16
SO what you're saying, is I should have capacitors on there? I have no idea about them! Thanks for that! Also!!!!! You're saying all of the ground symbols connect to eachother and go to the negative symbol on the power supply? not to the partial ground rail?
 

LowQCab

Joined Nov 6, 2012
4,072
There needs to be a 100nf, ( 0.1uf ), Ceramic-Capacitor connected across the
Power-Pins on the Op-Amp to prevent potential self-oscillation, or instability, or ringing.

I don't know how to explain the Grounds and Symbols any better,
please read again.
.
.
.
 

crutschow

Joined Mar 14, 2008
34,432
You're saying all of the ground symbols connect to eachother and go to the negative symbol on the power supply? not to the partial ground rail?
Yes.
There is no such thing as a "partial ground rail", there is only one ground/common.

You seem to have a rather fuzzy idea of how to interpret circuit connections. :rolleyes:
 

Thread Starter

RussellReal

Joined Aug 18, 2022
16
I have one more question, at the risk of making you guys mad at me lol.

Could I use the voltage divider to send an input reference voltage to both the A and B side of the OpAmp? Would that count as "parallel" or would that break this circuit? The reason I ask is because I'd like to use 3 opamps to work for the 6 LEDs, there is two independant sides on the OpAmp so I was wondering if I had to make 2 separate voltage dividers for each opamp or if I could simply run two leads from the voltage divider to each of the A and B sides?
 

crutschow

Joined Mar 14, 2008
34,432
if I had to make 2 separate voltage dividers for each opamp or if I could simply run two leads from the voltage divider to each of the A and B sides?
You can use one divider for all the op amp reference voltages.

You can also use an LM324 which has 4 op amps per package.
 
Top