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

Thread Starter

RussellReal

Joined Aug 18, 2022
16
I want to start off by saying I'm a complete noob, I know how to solder, I kinda understand the basics of components.

I have a USB Charged radio for work, all of my co-workers have radios. There is no charging dock for the radios and I've 3d printed a charging dock. I understand parallel circuits so I have no problem charging 6 radios at a time. thats working fine. The problem is that I want to have a status LED for each dock. When a radio is charging I want the LED to illuminate.

My understanding of circuits is that if I have a 5v source, and the radio takes like 4.8v that would be a 4.8v drop across the radio, the remaining .2v isn't enough to power an LED. So I know that the LED would have to be in parallel not in series, however, how can I take the remaining .2v and open a transistor for the LED, I tried a comparator, however, either thats not a good solution or I'm stupid and can't figure it out. I've done many many google searches before coming here.... There isn't much help, and the search terms used is cluttered with silly DIY videos on youtube that are 98% unrelated.

Any help would be greatly appreciated.

I'm very interested in learning circuitry better, and would love to stick around on this forum if you guys would have me. :)

Many thanks,
Russell
 

LowQCab

Joined Nov 6, 2012
2,315
This is more complex than You might imagine ............
It certainly can be done,
but the problem is, is that each of these odd and assorted devices may
draw a different amount of "Quiescent-Current", even after they are completely charged.
So the question is, where do You "draw-the-line" and say definitely that
"at XXX-milliamps" all devices will be considered fully Charged ?

If all the devices were the same make and model,
you could come up with a fixed number,
but with a bunch of random devices it's impossible to know for sure.

The LED, (or other Charge indicator),
needs to be inside each individual device,
not in a bank of USB-Outlets.
.
.
.
 

Thread Starter

RussellReal

Joined Aug 18, 2022
16
I don't really want a charge indicator, I want the LED to turn on when the radio is plugged in, and when nothing is plugged in, no LED, is that still complex? I don't need something that changes color or changes brightness, I just need either on or off for plugged or unplugged.

I appreciate your reply! Thank you!
 

LowQCab

Joined Nov 6, 2012
2,315
I must be missing something here ..........
The device that's being Charged has a Charging-Cable that is plugged-in,
and it is quite obvious that there's a Cable plugged-in,
but You also want an LED to turn-On next to the Socket, that indicates that something is plugged-in,
but doesn't actually indicate any other condition.

For the amount of complexity that this would add to the Project, this seems hard to justify.
.
.
.
 

MrChips

Joined Oct 2, 2009
26,789
Welcome to AAC!
If the USB charger puts out 5V then your radio is taking 5V, not 4.8V.

What you need to measure is the current at 5V that the radio requires.
Here is a current sensing circuit using a transistor. You do not have to use BU406 transistor. For a silicon transistor when the voltage across R1 excess 0.6V the LED will turn on. A germanium transistor will turn on at a lower voltage.


1660846398156.png
 

Thread Starter

RussellReal

Joined Aug 18, 2022
16
Welcome to AAC!
If the USB charger puts out 5V then your radio is taking 5V, not 4.8V.

What you need to measure is the current at 5V that the radio requires.
Here is a current sensing circuit using a transistor. You do not have to use BU406 transistor. For a silicon transistor when the voltage across R1 excess 0.6V the LED will turn on. A germanium transistor will turn on at a lower voltage.


View attachment 274159
The 1 ohm resistor (R1) Can I ask what that accomplishes? Does that add a load so that it doesn't short out? Why is it between the emitter and base? I'm really new but this is interesting to me! I'll try this circuit out right now, just asking questions.

But doesn't that circuit require that whatever is plugged into the USB port be content with 4.3 V or so?
I think, and I could very well be mistaken, but it'd run very very close to 5v because the only resistance in series is 1 ohm, the USB and the transistor/led are in parallel so all that changes is the amperage drawn, so it'd get super close to 5v, and anyway the 5v power supply I'm using actually puts out like 5.2v so its not super precise anyway.

If I'm wrong please elaborate I've been super interested in learning about all of this I'm just a lil dumber than the average individual lol.
 

MrChips

Joined Oct 2, 2009
26,789
R1 is a current sense resistor.
If the voltage across R1 is 0.6V then the current I = V / R = 600mA.
The load will see 4.4V.

To improve on this simple circuit you could lower the value of R1 and replace the transistor with an op-amp.
 

WBahn

Joined Mar 31, 2012
26,841
The 1 ohm resistor (R1) Can I ask what that accomplishes? Does that add a load so that it doesn't short out? Why is it between the emitter and base? I'm really new but this is interesting to me! I'll try this circuit out right now, just asking questions.



I think, and I could very well be mistaken, but it'd run very very close to 5v because the only resistance in series is 1 ohm, the USB and the transistor/led are in parallel so all that changes is the amperage drawn, so it'd get super close to 5v, and anyway the 5v power supply I'm using actually puts out like 5.2v so its not super precise anyway.

If I'm wrong please elaborate I've been super interested in learning about all of this I'm just a lil dumber than the average individual lol.
As current flows through the load and returns through the 1 Ω resistor, a voltage develops across it. In order to turn on the LED, the voltage across the resistor, which IS the voltage across the transistor's base-emitter junction, must rise to somewhere in the 0.6 V to 0.7 V range. The value of the resistor would be chosen to make this happen close to some target threshold load current.

One of the issues is that the loads are not all the same -- different radios with difference charge rates. Some might charge at a current too low to turn on the LED while others want to draw more, which would result in even more drop across the resistor.

A better way would be to replace the resistor with a diode. It would take very little current to raise the voltage across the diode to enough to turn on the transistor but it would also allow a lot more current to flow without further increasing the voltage drop much. The one issue that would need to be considered is that you need the voltage drop across the diode to be sufficient to get the Vbe of the transistor high enough to turn on the LED. One thing working in your favor is that the base current in the transistor doesn't need to be much at all -- likely something in the 0.1 mA range -- while the current in the diode when a radio is charging is likely to be at least a thousand times that, which should give enough overhead voltage. Devices can be chosen with this in mind and, if all else fails, a much smaller valued resistor can be put in series with the diode to kick the voltage up a bit, Something in the 100 mΩ to 200 mΩ would probably be a good starting point.

If the goal, however, is truly just to determine if a radio is plugged in, then there is another issue in that if the radio stopped pulling current once it is charged (or the current falls to a very low value), then this basic approach won't detect the device.

The TS indicated that they 3D printed the hub, so perhaps they can incorporate into the hub design something that allows an optical signal to be toggled depending on if something is plugged in. That shouldn't be too difficult, particularly if you work under the assumption that there is no motivation for someone to intentionally trick the system.
 

Thread Starter

RussellReal

Joined Aug 18, 2022
16
As current flows through the load and returns through the 1 Ω resistor, a voltage develops across it. In order to turn on the LED, the voltage across the resistor, which IS the voltage across the transistor's base-emitter junction, must rise to somewhere in the 0.6 V to 0.7 V range. The value of the resistor would be chosen to make this happen close to some target threshold load current.

One of the issues is that the loads are not all the same -- different radios with difference charge rates. Some might charge at a current too low to turn on the LED while others want to draw more, which would result in even more drop across the resistor.

A better way would be to replace the resistor with a diode. It would take very little current to raise the voltage across the diode to enough to turn on the transistor but it would also allow a lot more current to flow without further increasing the voltage drop much. The one issue that would need to be considered is that you need the voltage drop across the diode to be sufficient to get the Vbe of the transistor high enough to turn on the LED. One thing working in your favor is that the base current in the transistor doesn't need to be much at all -- likely something in the 0.1 mA range -- while the current in the diode when a radio is charging is likely to be at least a thousand times that, which should give enough overhead voltage. Devices can be chosen with this in mind and, if all else fails, a much smaller valued resistor can be put in series with the diode to kick the voltage up a bit, Something in the 100 mΩ to 200 mΩ would probably be a good starting point.

If the goal, however, is truly just to determine if a radio is plugged in, then there is another issue in that if the radio stopped pulling current once it is charged (or the current falls to a very low value), then this basic approach won't detect the device.

The TS indicated that they 3D printed the hub, so perhaps they can incorporate into the hub design something that allows an optical signal to be toggled depending on if something is plugged in. That shouldn't be too difficult, particularly if you work under the assumption that there is no motivation for someone to intentionally trick the system.
What does "Vbe" stand for? Also, whilst plugged in the radio's LCD display is powered on indefinitely, showing a charging icon, when fully charged the LCD is still powered and it pulls 10 mA or .1A. Same would assumably be said for all other radios. Same make/model. The optical sensor is actually kinda cool! MrChips said something about an OpAmp, that was my first attempt, but I may have wired it up incorrectly.

OpAmp used was the TL072CP.

For your recommendation above, you stated that it did not have to be a BU406, its an NPN transistor can ANY NPN transistor work or am I looking for any specific values? Datasheets are like another language to me, maybe is there a course or youtube series I could watch to learn some basics?

1660854054463.png
this was my attempt.
 

WBahn

Joined Mar 31, 2012
26,841
So what is V2 and what is causing it to pulse?

Why is the radio connected to the USB being modelled as a pulsing current source?
 

Danko

Joined Nov 22, 2017
1,392
So what is V2 and what is causing it to pulse?

Why is the radio connected to the USB being modelled as a pulsing current source?
V2 is continuously working pulse autogenerator.
Current source models current, consumed by radio.
Sensitivity adjusted by R4. Now it is about 0.5mA.
 

WBahn

Joined Mar 31, 2012
26,841
So where is the TS supposed to obtain this "continuously working pulse autogenerator"? Can you provide a DigiKey part number?
 

Danko

Joined Nov 22, 2017
1,392
Especially for you, because TS do not interested yet
in this idea, it may be NE555 timer.

ADDED:
Something like this:
1660877671268.png
 

Attachments

Last edited:

Thread Starter

RussellReal

Joined Aug 18, 2022
16
that diagram is crazy confusing lol I appreciate all your time though, I think the transistor solution is my best bet since I have 2n2222 NPN transistors at the ready
 
Top