# Comparator for use with NPN type voltage switch

I’m currently working on a project whereby a DC voltage signal is taken from the earth clamp of my welding machine. The voltages range from 60-200 mV. I'm thinking of using a comparator to give a solid 0 or 1 V DC voltage depending on the earth voltage reading being over 60 mV. This can then be added to the NPN circuit ensuring that when a voltage reading of over 60 mV is taken from the earth clamp it activates the NPN switch allowing the 12 V feedback signal to flow back to the secondary device activating it using a 12 V relay. Any help or advice on the comparator circuit or other possible solutions would be appreciated.

• Welcome! Please use a comparator instead. Jun 27, 2023 at 7:50
• What high-level function is this circuit intended to perform? Jun 27, 2023 at 8:06
• essentially i need a switch that activates on voltages ranging from 60-150 mv from the earth clamp when welder is activated this then allows a 12v signal from a secondary device to be passed feeding back into the secondary device activating it when the welder is on.
– AJ D
Jun 27, 2023 at 8:54
• What do you mean by "voltage taken from the clamp"? 60mV to 200mV with respect to the welder's own internal ground, the work-piece or something else? Jun 27, 2023 at 12:15
• literally the dc voltage reading taken from the ground clamp connected to a welding bench. at varying currents on the welding settings the voltage range is 60-200mv
– AJ D
Jun 27, 2023 at 12:51

## 2 Answers

You can try circuit below.
When the V1 is higher than 120mV the relay is ON.
R10 serves for fine tuning the comparator voltage.
Use transistors with Beta 200-300 (check with multimeter).

simulate this circuit – Schematic created using CircuitLab

Simulation results: (Upper chart is V1, lower chart is Relay coil voltage)

• thanks but i tried to use the circuit on lt spice and i wont work. the input signal V1 is DC and for some reason it wouldnt work on the simulation
– AJ D
Jun 27, 2023 at 14:50
• Did you set the potentiometer R10 to some middle value, or you did let the viper at the end? Try to make 100ohm with two 50+50ohm resistors and the middle is viper. Jun 27, 2023 at 15:05
• @AJD Or did you wait until C2 (10uF) is charged after power on? It should take a few milliseconds. Before this time the circuit is not working correctly. Jun 27, 2023 at 17:52

You need three things, a comparator, a stable reference voltage, and a relay driver.

To detect such a small voltage you'll want to use a reference that's temperature stable rather than relying on a zener or the $$\V_{BE}\$$ of a transistor, so something like a TL431 or better.

For a comparator you could use something like an LM339, or if you wanted to build something with transistors you could use the same basic circuit the '339 uses.

The relay driver would depend on what you use for a comparator, the specific relay and whether or not you need to invert the comparator output.

Here's an example of a discrete transistor comparator that turns on a relay when the input is 60 mV or higher. Or you could use an LM339 or similar comparator with the voltage reference and just add the PNP relay driver to the output of the '339 to get enough current for a relay (or use a relay the '339 can drive directly).

Note: R4 should be 4.7k not 47k. (thanks Michal)

• Nice higher-gain version than mine :) . You did the whole op-amp in 358 era. Minimum TL431 current is 1mA, btw. Jun 27, 2023 at 17:34
• @MichalPodmanický Good catch, R4 is supposed to be 4.7k, simulation doesn't seem to care. Could also use a micro-power reference which would take a lot less current, you just need something with a good stable voltage. Jun 27, 2023 at 18:29
• @Godjihyo hi this is great just trying to model it on spice I've got the circuit built but I cant find the relay, is it an inductor from the library? apologies i havent used spice in a while
– AJ D
Jun 28, 2023 at 6:22
• @AJD I usually just use an inductor for a relay and set it’s series resistance to whatever the coil resistance would be. If you have a specific relay you’re going to use and know the coil resistance set it to that. Usually they don’t specify an inductance, I just make something up, it’s mainly the resistance that matters so the current in draws is correct. Jun 28, 2023 at 9:06
• @GodJihyo ah ok thanks I've built the circuit however I'm not getting the cut off point. I see a reading of around 62ma from the relay but its consistent from 0mv to 60mv.
– AJ D
Jun 28, 2023 at 11:16