I want to turn on an LED if my wire has 1 ohm or less resistance

Discussion in 'The Projects Forum' started by jdavies, Oct 7, 2009.

  1. jdavies

    Thread Starter New Member

    Oct 7, 2009
    15
    0
    Hi all,
    I'm extremely new to electronics, so this may be a very basic question. I'm working on a tester for electric body cords for fencing competitions. There are 3 leads/wires on a body cord and each wire must register with 1 ohm of resistance or less to qualify in competitions.

    I can create a simple continutity tester that tells me whether or not the cord is good ( power, resistor, LED and then close the circuit with the wire being tested), but I have no idea how to turn on the LED if the wire I'm testing has less than 1 ohm of resistance in it. Ideally, I would want a gree LED to light at <= 1 ohm, and a red LED to light at > 1 ohm.

    Can someone point me in the right direction for this circuit? Many thanks in advance!

    - Jeff
     
  2. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Actually there are several ways to do this, it's not too hard. I'm about to go to work, but if no one else has any ideas I'll come up with something tomorrow.
     
  3. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Basically, you need to build an Ohmmeter. The way most work is that they use a constant-current source to force a predetermined current, and then read the resulting voltage drop across your unknown circuit.

    If you forced 20mA, then if your unknown was 1 Ohm or less, the voltage across it would be <= 20mV. If it was more than 1 Ohm, the voltage across it would be >20mV.

    An LM317 data sheet shows how to configure it as a constant-current source. An LM339 comparitor is capable of comparing the voltage across your unknown resistance to a 20mV reference voltage, and lighting an LED to show if the unknown is less or more than 1 Ohm.

    If battery life is a concern, you might want to pulse the current source so you only draw 20mA with a low duty cycle. For that matter, you could use a much higher test current (like 100mA), and that will make the comparator circuit slightly less critical...
     
  4. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    "Better is the Enemy of Good", is the way I heard it...
     
  5. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Here's a circuit idea for you:

    [​IMG]

    R1 thru R3 should be precision metal film resistors. Digikey.com is a good place for hobbyists to buy small quantities of parts; they'll ship USPS 1st Class which will save money.

    S1 is just a SPST toggle switch. When the LED is illuminated, the circuit current draw is nearly 40mA, so it will drain a 9v battery in about 3 hours. There isn't really a need to show a "higher than 1 Ohm" condition, as that would just run the battery down faster, as well as making the circuit more complicated. If you want to see if it's working, just short the test probes together.

    R1 and R2 make up a voltage divider. With a fresh battery, you'll get about 8.99mV on the inverting (-) input of the comparator.

    R3 sources current to your fencing wires/body cords, represented by Rload. Rload is the lower half of a voltage divider for the noninverting (+) input of the comparator. R5 provides a small amount of hysteresis to keep the LED from flashing/flickering if Rload is borderline 1 Ohm.

    R4 is actually not necessary for the circuit to function properly. I originally put it in to take care of the case of green/red LEDs, but the >1 Ohm display function is not implemented.

    R7 limits the current through Q1 and the LED, D1. R6 limits the current through the base of Q1. As shown, a green LED will get around 16mA current.
     
  6. jdavies

    Thread Starter New Member

    Oct 7, 2009
    15
    0
    Wow, what great responses! Thank you all so much!

    Just out of curiosity SgtWookie, what diagramming software do you use? You are able to generate these diagrams for alot of your posts, so I imagine its a pretty good piece of software.

    - Jeff
     
  7. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Jeff, I've been using an obsolete program called "Circuitmaker Student".
    It was freeware, but is no longer supported by the company.

    Schematics drawn in Circuitmaker Student are limited to 50 components, and you cannot add new components to the library, nor create/edit library macros.

    Linear Technology's LTSpice is freeware, a very good product, and is supported by Linear Technology. It comes with library models for all of their products, plus a few ancillary components. You can add more components to the library; as many as you wish.

    I simply use Circuitmaker Student on here because it has most of the components that a typical hobbyist would use in the supplied library, and I find the user interface a bit more friendly than LTSpice; as I started using Circuitmaker a few years before LTSpice.

    Circuitmaker has been superseded by Altium Designer, which is certainly not freeware; more like $10,000 per installation as of 2007. No, I don't have it.
     
  8. jdavies

    Thread Starter New Member

    Oct 7, 2009
    15
    0
    Just double checking here: R2 is a 1 ohm resistor and not a 1K resistor?

    - Jeff
     
  9. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Wookie's bridge circuit (with some improvements, simplified, lower power consumption) simulated in LTSpice.
    X-axis is the unknown resistance. Red, Blue, Green, LtBlue traces show Led current vs unknown resistance at battery voltages of 8, 8.5, 9, and 9.5, respectively. Shows what LTSpice can do to optimize a circuit before building it...
     
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    That is correct.
     
  11. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Mike,
    Is the comparator in your schematic actually an LM339 model, or is it a re-labeled LT1017/LT1018? The LT1017/LT1018 can sink considerably more current than the LM339.

    I used the 2N3906 as the LED driver to minimize the sink current necessary from the LM339; at 13mA current, the output is close to coming out of saturation. The driver transistor also helps the hysteresis, as the '339 output will swing from perhaps 100mV to Vcc-300mV.

    You increased R1 and R2 by a factor of 22, but increased the hysteresis feedback by only 4.7. That increases the tolerance significantly; from 1% to around 5%. It would be better to increase all three by a factor of 9.1 to keep things in balance.

    Your R5 should be connected to the output of U1 rather than the junction of D1/R6.
     
  12. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Actually, I used a generic opamp as the comparitor. You are right, the 339 has an anemic current sink rating.

    I did the hysteresis the way I did it on purpose. First note that when the comparator's output is off, the feedback current is sourced from the positive rail, with no current in the LED, i.e. it is ratiometric to the Vcc rail. When the Comparator's output is low, the feed back is reduced by the forward drop of the LED, so the feedback resistor R5 is a lower value than the way you did it. I didn't plot the voltage on non-inverting input, but I remember it was about the right amount of hysterisis
     
  13. jdavies

    Thread Starter New Member

    Oct 7, 2009
    15
    0
    Mike,
    I just want to sanity check my neophyte assumptions here. Using your diagram, the lead marked "inv" should connect to pin 4 on the LM339. I'm using the Jim-Pak LM339NJP, which is a quad comparator, so basically I need to decide which of the 4 comparators I want to use (#1 in this case). The positive lead from the battery then feeds directly into pin 3 (Vcc+) and the ground is attached to pin 12 (Vcc-). Pin 2 (output 1) then connect to the LED.

    Sorry to be so detailed, but this is the most involved circuit I've put together and I'm still reading feverishly through Electronics for Dummies (I love the Dummies books). I'm learning how to read the circuit you've provided, but most of it is still magic to me.

    Thanks again for all of the help from you and SgtWookie. Your back-and-forth discussions help to show me how much I have yet to learn. I love reading it.
     
  14. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Doesn't seem like Mike's on, but you have your pin assignments correct.
     
  15. jdavies

    Thread Starter New Member

    Oct 7, 2009
    15
    0
    Ok, I have the circuit in place and working, though not exactly as I had hoped. The LED is on and remains on as long as the R3 is not connected (i.e. I dont have my body-cord connected to the circuit). If I just short out the leads to R3, then the LED goes out.

    This is pretty close to what I was looking for, just in reverse. Is this how the circuit is supposed to work or did I cross a wire somewhere? I know the following image is not really clear enough to see, but it shows that the leads to R3 are shorted out using the red aligator clips in the foreground, and the LED is unlit. If I remove the aligator clips, the LED shines.

    [​IMG]
     
  16. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Seems like you've managed to reverse your pin 4 and pin 5 connections to the LM339. Double-check them.
     
  17. jdavies

    Thread Starter New Member

    Oct 7, 2009
    15
    0
    Hmm, I have double checked them a number of times now. As you can see from the new photo, I have changed the colors of a few wires to help identify them in the circuit a bit better (though the iPhone picture at that distance is not very sharp). Here is a rundown of the connections:

    The green wire in the photo connects Pin 4 with R1 and R3 (currently missing) as per Mike's diagram. The white wire connect pin 5 with R4, R5 and R2.

    See the attachment for the photo. It is quire possible that I've dome something screwy with how I connect things to the breadboard, but it seems like a fairly straight-forward process. Here are a couple of interesting behaviors:

    1) If I remove the white wire (connecting Pin 5 with R2m R4 and R5) the LED remains lit

    2) If I remove the green wire (connecting pin 4 with R1 and the lead that will go to R3) the LED stays on.

    Is it possible that I might have fried the IC comparator chip somehow? Would that give this behavior also?

    As always, thanks in advance!

    - Jeff
     
  18. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Per the first circuit simulation, the LED lights when the resistance of the unk is > 1 OHM (open circuit would qualify as > 1 OHM. Do you want it the other way? i.e. LED is off when the resistance is > 1 OHm? If so, here is a revised circuit that does that instead. Note the tricky use of a voltage variable resistance used to determine the resistance of R3 which causes the LED to turn On/Off. R3 is made to vary as a function of the voltage at node C. I did this to show a neat feature of LTSpice.

    The upper plot pane shows what is going on at the two inputs to the comparator. Note the hysteresis (bumps in the the blue trace) induced by the feedback through R5. The lower pane shows v(c); remember that R3=V(c), so that when V(c)=1V, R3=1Ohm. Finally, the LED is on when current is flowing through it, so note that it now lights when R3 < 1Ohm.

    Duh, I just went and read the original title of this thread :p
     
    Last edited: Oct 10, 2009
  19. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Nope.
    One side of R1 goes to +9v.
    The other side of R1 gets connected to pin 5, one end of R5, and is the high-side "probe" for the connection to R3 (the wiring harness on the jacket).
    The other end of R5 connects to the junction of R6 and the anode of the LED (longer lead).

    The white wire should connect pin 4 to the junction of R2 and R4. The other end of R2 goes to +9v. The other end of R4 goes to ground.
     
  20. jdavies

    Thread Starter New Member

    Oct 7, 2009
    15
    0
    I just wired it up according to Mike's revised diagrams and its working beautifully! I didn't have a 680 Ohm resistor in hand, so I combined a 560 and a 220. I know that from a safety standpoint that is ok but will it affect the overall measurement of the 1 Ohm through R3?

    My next steps are to:
    1) Try to undrstand what is going on in this circuit. The Dummies book should help with that.
    2) Replicate it using 2 more of the comparators in the IC so I can test all 3 wires of a body cord at once.

    This is really exciting stuff. As a software guy, electronics has always been a mystery to me. It still is because I'm so low on the learning curve, but I think I might see a man behind the curtain! :). We are definitely not in Kansas anymore.
     
    Last edited: Oct 10, 2009
Loading...