# 2-State Load Sensor using Comparator

Discussion in 'The Projects Forum' started by KMPryor, Feb 11, 2013.

1. ### KMPryor Thread Starter New Member

Feb 11, 2013
3
0
I need a simple and cheap circuit that will detect when a load is attached to a USB charging port. I do not need a measurement, only if it is above 50mA or not. Vout to the load will be 5vdc, current draw will be between 50mA and 1000mA or 0mA. A MCU needs to know when a load is attached. I plan on using a comparator, such as a LM393 or MCP6542-I/P-3, but had problems implementing. Am I on the right track with a comparator, if so which one do you all recommend? Thanks!
Here is my circuit:

2. ### wayneh Expert

Sep 9, 2010
14,970
5,439
Your approach is OK but that circuit as drawn will always be in one state since one input is always higher than the other.

You need to establish a separate "reference" voltage that corresponds to the voltage across your shunt, and one end of the shunt should be at ground. This way, once the volume across the shunt exceeds the reference, the comparator triggers. If your power supply is a regulated voltage, you can just use a resistor voltage divider to create your reference.

You may want to add some hysteresis to the comparator, to reduce chatter at the switching point.

3. ### KMPryor Thread Starter New Member

Feb 11, 2013
3
0
I was thinking that when the load was disconnected the voltage in both inputs would be equal (V+= V- = 5v). I was using 5v as my reference voltage. My thought being anytime the a voltage divider was created by a connected load, the voltage difference would trigger the comparator. How would you calculate the correct reference voltage if not 5 v? I am also a bit confused by why we connect one end of shunt resistor to ground, are you recommending low-side sensing? Thanks!

4. ### tinamishra New Member

Dec 1, 2012
39
1
I have an information though which not exact in the way of conversation but it is about Load Sensor that is A Load Sensor is defined as a transducer that converts an input mechanical force into an electrical output signal. Load Sensors are also commonly known as Load Transducers or Load Cells. Load sensor is the same one found in digital bathroom scales.Load Sensors manufactured in US by FUTEK Advanced Sensor Technology. Here utilizing one of the most advanced technologies in the Sensor Industry which is known as Metal foil strain gauge technology.

5. ### crutschow Expert

Mar 14, 2008
20,225
5,719
The OP is taking about a current (load) sensor, not a mechanical force sensor.

6. ### crutschow Expert

Mar 14, 2008
20,225
5,719
The LM393 has an input common-mode range of Vcc-1.5V so it cannot operate with the input at the supply voltage. Thus you either need to get a rail-rail type comparator or move the shunt resistor to ground.

For a 50mA trip point you would connect the minus (-) comparator input to 10mV and use a 200mΩ shunt resistor (connected to ground). A 20mΩ shunt would have only a 1mV drop and that would be swamped by the typical offset of the comparator.

The 10mV can be generated by a two resistor voltage divider from the 5V power.

KMPryor likes this.
7. ### KMPryor Thread Starter New Member

Feb 11, 2013
3
0
That gave me a ton of insight, Thanks! I am thinking of using a TLV3704 comparator (rail-to-rail/push-pull output). I added hysteresis as suggested with a 4.958v (.209A load) turn-on and 4.978 (.110A) turn-off. Here is what I worked out:

Is it looking okay? Also, can I put my output right into the ATMega Microcontroller input as shown or do I need to "clean up" the output?
Thanks!

8. ### crutschow Expert

Mar 14, 2008
20,225
5,719
The circuit looks ok.

You can run the output directly to the μC input if the two supply voltages are the same.