Switch LED on when load sensed

Hi Bob,

Did find an error, old eyes need better light ! Will rebuild & check.

Cheers. Jim

2 Likes

Know the feeling
Cheers Bob

1 Like

Hi Bob,
Ok rewired it with both R1 & R2 at 10k each. Still exhibited the result mention above.
So I put a 20k resistor between the non inverting pin and pin 1 out. It now is just on.

However when I removed Vcc the led remains on and from distant memories (like 45 years ago) a pull down resistor is needed as well. Am I on the right track there or most probably memory is failing me.

Cheers Jim

1 Like

Hi Jim
R1 and R2 cannot be the same as this puts the comparator in constant limbo. That is with no current the inverting and non inverting pins are the same voltage. Change R1 back to 9k1 and that puts the non inverting pin at a bit over 2,6V so the inverter is always off with no current.Remove the 20k resistor . It is far too low in value to be any use for hysteresis See how you go without hysteresis first and if you need it you may have to put a 10k resistor from VCC to pin 1 to make sure pin 1 has full VCC there when pin 1 is high (LED off) or the hysteresis won’t work properly. You can juggle R1 value to alter the switching point but it must always be lower than R2. Don’t get too close in value or any hysteresis we have to introduce may turn the LED on and never turn off.
Cheers Bob
Edit: forget any pull down resistors. Where would you put it anyway.

3 Likes

Bob,
Ok pulled the 20k resistor and put back the 9k1 resistor that goes to Vcc. Measured voltage and got a nice 2,6v and the led is off.

Switched a load on and I see I tiny flash from the led then it’s off. Load according to the meter is about 30mA. Increased the load to over 200 mA and nothing.

Jim

PS Appreciate your patience and help in getting this going.

2 Likes

Hi Jim
30mA would not be enough. What sort of a load are you expecting. Your earlier posts suggested amps.
What is the sensitivity of that board you are using. With the board suggested by James earlier which I think uses the ACS723 IC with the values shown it should switch at a little over 250mA load current. The ACS 712 IC I think has a sensitivity of 180mV per Amp which is less than half the ACS723 (400mV per Amp) so you would need something like 0.6 A to switch. At what point do you want to switch. Let me know and I can work out a resistor value for R1 but it won’t be a preferred value, you will have to make it up with 2 resistors. I just picked 9k1 because it is the first preferred value below 10k. Let me know the switching current and we will sort out something.
That little flash at switch on is probably the load inrush current or something.
Cheers Bob

2 Likes

Hi Bob,
In normal operation the current draw will be in the order of 2-4 amps.
The sensitivity of the 30A module I have is 66 mA/v.

If I get it to switch on around the 200mA point that would be great.

Cheers, Jim

2 Likes

Hi Jim
Do you mean 66mV/Amp ??? That would mean switching at a sensor output of 2.513V or a rise of 13mV. You could be struggling a bit. That sensor must be +/- 30A so you would only be using a small percentage of the range. You may need a resistor in series with a potentiometer for fine trim. Would be a bit easier with a more sensitive sensor or shift your switching point up a bit, even 1A.

Will do some sums and get back to you. Could be Thursday though, I have to go out to-morrow.
Cheers Bob

2 Likes

Hi Jim
Done some quick sums.
Sensor sensitivity 66mV/A.
Switching point, R1 =, Suggested combo.
200mA, 9k9475, 9k1 + 820Ω = 9k92
500mA, 9k87, 9k1+7k5 = 9k85
1000mA (1A), 9k743, 9k1 + 6k2 = 9k72
These are all preferred values 1% range. Recommend use 1% or better.

These values should switch a little above the nominated switching point but using a maximum of 2 preferred value components it is as close as you are going to get.

Hopefully you can live without hysteresis. With this low sensitivity and 200mA switching point the reference is only 13mV above VCC/2 (2.5V) which only gives very few mV to play with. If the hysteresis happened to force the reference to 2.5V or lower the LED would come on and never go off.

A sensor of + / - 10A would be more sensitive and still above your expected load current and the improved sensitivity would make it easier to set the switching point.

Nevertheless the values listed should be close and should work. You will probably have to go resistor shopping again but Jaycar have all of these if you have a store handy.
Cheers Bob

Edit above figures. In the clearer light of day
200mA, 9k8935,
500mA, 9k739,
1000mA, 9k486,
These are the revised numbers and as you can see are going to be difficult to get anywhere near using preferred value resistors.
At the end of the day you could use the 9k1 resistor in series with a 1k 10 turn trimpot for R1 then you would have a range of adjustment for the switching point.
I suggest a 10 or 20 turn trimpot as you would have some difficulty adjusting a single turn pot as a small change here would have a large effect on setting when you are aiming for 200mA switching point.
Jaycar have 25 turn 1k trimpots top or side adjustment which would do nicely.

2 Likes

Hi Jim
Add on to above.
If your 200mA is not too critical you could try 9k1 and 750r (total 9k85) in series for R1 which should switch ≈ 285mA.
I must have had a real brain snap on Tuesday night. Completely disregard the first set of numbers. I even got the decimal wrong, should have been 750Ω not 7k5 and 620Ω instead of 6k2. A small error, only a factor of 10, nothing serious (I don’t think).
Cheers Bob

2 Likes

Hi Bob,
Despite best efforts I couldn’t get the 30A module with its sensitivity to behave. So I have got some 5A versions which have 185mv/A .

Hoping therefore to be able to set a more realistic reference voltage to the inverting input.

Let you know how it goes.
Cheers, Jim

2 Likes

Hi Jim
I thought that one might be a bit touchy. The higher sensitivity one should behave a bit better.
According to my dubious calc to switch at 200mA R1 would need to be 9k7. Using the nearest preferred values for R1 9k1 and 560R in series (9k66) should switch at 232mA and R1 = 9k1 and 620R in series (9k72) should switch at 189mA give or take a little bit for component tolerances. If it still misbehaves we might need a bit of hysteresis (only a few millivolts). Let us know exactly what is happening and we can work out some values.
Cheers Bob

2 Likes

Well I did get it working and here is the circuit. It I think needs a hysteresis resistor but not sure of a value. It’s still a bit touchy but does work. Getting the values for the divider correct took a bit of time.

Bob, thanks again for your input. Greatly appreciated.

Jim

1 Like

Hi Jim
NO NO NO NO. That circuit has probably destroyed the 393.
Connect everything as I showed you earlier. The output of a LM393 is an open collector transistor. With the arrangement you have shown when the output transistor turns on you have it connected directly between V1 and ground with no current limiting at all. Should have been smoke but may have stayed inside the chip.
It is a wonder you got any result at all. I would no longer trust that LM393, bin it to get it out of circulation and start again. The component values shown should be OK but with my circuit the divider is the other way up, the 10k is in the ground side.
Where are the 5k6 series resistors in the LM393 inputs. You could get away without them but they are a bit of current insurance and if you happen to need a bit of hysteresis they will be required.

GO BACK AND CONNECT A CIRCUIT AS I SHOWED PREVIOUSLY. The one you finished up with is DEFINITELY not on.
Cheers Bob

2 Likes

Hi Bob,
I based the circuit on this one I saw on the net. It works fine. Maybe I drew the circuit wrong that I’m using. What do you think of the basic circuit I found.

I went searching again only because I couldn’t get you circuit going. That was probably me !

Cheers Jim.

Basically the same except the inputs are reversed and this circuit is shorting the LED when you want it off. The LED won’t be too bright as it is only getting about 6.5mA.

Until you get the comparator working I suggest you replace the sensor with a pot. That way you are not chasing your tail.

You are probably right.
Re my circuit. I have used this as a comparator many dozens of times, even as a variable PWM source by varying the DC offset of a triangular wave on one of the inputs. The circuit does work.

The last circuit you posted definitely would not work as you effectively put a short straight across the 5V supply and the only way that would not shut down would be because you reached the saturation limit on the LM393 and probably destroyed it. Anyway as I said I would not trust it and chuck it in the bin.

If you can’t get the circuit I posted to work (even using a pot instead of the sensor) I don’t know what you have done. Looking at the circuit you posted 10 days ago I don’t have much confidence. If you can build up this latest circuit to work then my circuit will work also as they are essentially the same.
Cheers Bob

1 Like