dummy questions about LM339 and diodes

Discussion in 'General Electronics Chat' started by shortbus, Aug 15, 2010.

  1. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,015
    1,531
    I have read and reread but can't seem to answer my questions, so here goes :

    1. What is the amperage needed on a LM339 input? (data sheet)- http://www.national.com/ds/LM/LM139.pdf How much current does the inverting and non-inverting inputs need to change the output?

    2. why do all the texts say that the Forward Voltage Drop on a silicon diode is .7Volts, when the data sheets all give differing voltages of FVD?

    I need a diode drop of .6 - .7 Volts at the amperage of the LM339 input. Any ideas?

    Thank you, cary
     
    Last edited: Aug 15, 2010
  2. Potato Pudding

    Well-Known Member

    Jun 11, 2010
    684
    92
    Input? Almost no current on an input.

    A few nanoamps leakage at worst.

    If you want a biased diode in your input path then you need to start from Vplus Big value resistor signal input and diode then another big value resistor and the Comparator input then Vmin at the bottom of the 2nd resistor.

    Just build a voltage divider with a diode in the center, and input signal oin top of the diode and feed signal to the IC at the bottom of the diode.

    Silicon Diode drops are .6 to .8 Volts, not .06Volts.

    Not even a Schottky will give you .06 Volts.
     
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    A 1N4148/1N914 switching diode with 2mA current flowing through it will drop about 0.65v when the diode is at room temp (~25°C, or 77°F).

    Use a current limiting resistor (Rlimit) from Vcc to the diode's anode (end with no stripe), and tie the cathode to ground.

    Calculate: Rlimit = (Vcc - 0.65v) / 0.002A
    Use the closest standard value of resistance.

    For example, if your Vcc=12v:
    Rlimit = (12v-0.65v)/.002A
    Rlimit = 11.35/.002 = 5,675 Ohms. 5.6k is the closest standard value of resistance.

    From there, you can use a 10:1 resistive divider from the anode to ground to get your 0.065 reference voltage. 9.1k/1k will be close enough.

    For less noise on your comparator input, use a small cap (say, 10nF to 100nF, or 0.01uF to 0.1uF) from the junction of the 9.1k and 1k resistors to ground.

    See the attached. I've decreased the value of R1, as the default diode model did not have the same Vf of some typical 1N4148's that I've measured previously. Decreasing the value of R1 increases current thru D1, which increases the voltage drop.

    The Vf of a diode is basically dependent upon the current flowing through it, and the temperature of the diode's junction. However, since this site is primarily oriented to beginners, we try to keep things simple. It's much easier to remember 0.6v-0.7v than to try to memorize lots of charts and tables.

    If we tried to teach people all of the ins and outs of just diodes, they might get discouraged and confused with the huge amount of data they would have to sort through. For most purposes, the 0.6v-0.7v rule of thumb will work just fine.
     
    Last edited: Aug 15, 2010
  4. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,015
    1,531
    Thanks for the replies guy's. Yeah, I put the decimal point in the wrong place in the first post. I edited it to show what I really meant.

    Here is a schematic of what I'm trying to do. Should of added it to the first post but wasn't thinking.

    Will this work to do what I need?
     
  5. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    You are going to need a resistor from the diode cathode to ground, something in the 10MΩ area.
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, what is it that you're REALLY trying to do?

    If the voltage is <97.5v, increase it, if >102.5v, decrease it?
     
  7. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,015
    1,531

    It is the feedback system to drive the ram movement on a Electrical Discharge Machine (EDM). A metal working machine sort of like a milling machine, but instead of a cutter, it uses a shaped carbon electrode to "sink" a hole the shape of the electrode into a metal part.

    Here is the Wiki on the process; http://en.wikipedia.org/wiki/Electrical_discharge_machining

    Basically the voltage I showed as 100V is the open circuit voltage of a capacitor bank. the feed back circuit controls the electrode position (distance from the part being machined). The electrode and part are flooded with a special oil (dielectric fluid). The 100V ionizes the gap and causes the voltage to drop to the upper limit of the comparator. The lower comparator is to be around 5-6V lower than the upper, to keep the electrode sparking instead of shorting out. The comparator outputs control a stepper motor driver that moves the electrode. The gap/working voltage is adjustable between 50V to 20V.

    I've had the mechanical parts built for about 10 years. I have the stepper drive, and almost have the capacitor bank done. I just need to finish the feed back system. Now that I'm retired I have the time to work on it. I ran one of these machines at work for about 13 years.

    I'm attaching a not so good photo of the ram assembly.

    There are books with plans to build a home made EDM (Which I have bought) but none of them really work like a commercial machine. I have spent a long time trying to come up with one on my own that will be close to a commercial machine in operation.
     
  8. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,015
    1,531
    Bill, would you please expand on this? None of the window comparator circuits that I've found show this.

    My thinking is that the diode will just give a .7V lower input on the lower comparator than the upper.

    With the voltage divider from the 100V input - - -
    100V = 12V that makes .6V = 5V or .7V = 5.83V , close enough for my needs.
     
  9. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    Your circuit shows a diode in series with the input of the comparator, then the diode's current is nothing and its current and voltage are nothing because the input of the comparator has negative bias current for its PNP transistors. A resistor from the comparator's input to ground will cancel the tiny negative input bias current and provide some current for the diode.

    A diode is a thermometer, not a voltage reference.
     
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Nice work on the machine!

    OK, have a look at the attached. I think it's close to what you want.

    When V2 is less than 48v, StepUp is high, StepDn is low.

    When V2 is between ~48v and ~53v, both outputs are low.

    When V2 is greater than ~53v, StepDn is high, StepUp is low.

    Now if you wanted to make the ranges easily adjustable, you could use a 2-ganged 10k linear pot for R3 and R5, wired as rheostats, so that when one increased in resistance, the other decreased by the same amount. This would move the "window" from the minimum to the maximum.

    R4 could be replaced by a 100 Ohm resistor in series with a 500 Ohm linear pot; that would allow for a pretty good range for the window in the middle.

    Now, what is this dielectric oil that you're going to use? Is it commonly available?
     
  11. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Here's basically the same schematic, with the ganged pots and the single pot wired in. I changed VR2 to 1k, as that gives you a range of a 0v window to a ~12v window. However, if your window is too narrow, your stepper will be active constantly. Consider adding a fixed 200 Ohm resistor in series with VR2.

    Note that I also changed R7 to 10k. That utilizes more of the comparators' input range, helping to increase accuracy somewhat.

    Since your environment will be very noisy electrically, consider adding 1nF (0.001uF) to 10nF (0.01uF) bypass capacitors, metal poly film or ceramic, from the points labeled Vin, Rhi and Rlo to ground.

    The comparator MUST have a 100nF (0.1uF) bypass capacitor across it's power and ground pins. An LM2903 is an automotive version of an LM393 comparator; it has a much wider operating temp range. You could also use an LM339, but you will need to ground the unused inputs to keep them from causing strange problems.
     
    Last edited: Aug 16, 2010
  12. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,015
    1,531
    I would like to thank all of you for your help!!! This forum is the most helpful Electronics Forum on the net!!!!


    Sgt.- Yes, the oil is called EDM fluid, and there are several different brands and types available from places like Enco tools and MSC, plus local distributors. The DIY books recommend kerosene, and that is what the early machines used, but the oil companies came up with fluids with anti-burn additives that make EDM fluid safer and that is what I'm going to use when I get to that point.

    I'm going to study your schematics and see if I can figure them out. The DIY books use two different styles of comparator systems-

    1. They use two different voltage dividers at the 100V level. This gives a 5V difference at that level, the problem is that when it goes to the comparator the "window" has bot upper and lower on at the same time.

    2. The other is to use two separate pots for the reference voltages on the comparator. That makes it harder to maintain the 5V "off window. as you adjust the upper pot, you also mus adjust the lower one too.

    The real machines just had one pot that kept the 5V window but the working voltage was adjustable. This is what I'm shooting for. The more modern machines are all CNC and the computer figures it all out automatically/Magically. Way beyond my pay grade!

    The adjust ability is needed for roughing and finishing cuts. Did you by chance run a simulation on my circuit that I posted? I'd be interested on what it does.

    Again thank all of you for helping a dummy!
     
  13. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Kerosene? That's interesting - I wonder if diesel fuel would work; they are pretty closely related.

    OK, the last circuit I posted is basically an "adjustable window comparator".
    You can adjust the window "width" from anywhere between 0v and 12v inclusive, and move the window from anywhere between 0v (low side) and 105v (high side). The controls are independent. You could narrow down the width, then set the window position to wherever you wanted the voltage to stay, and then adjust the width so the stepper cycles to maintain the voltage within the hi/lo window thresholds.

    There's just one problem; I've checked with Mouser and Digikey, and they don't stock ganged linear 10k pots!!

    So, it's time to re-group. The change will require the addition of two or three operational amplifiers, and the opamps will be controlled by a single pot for the center of the range, and another for the width. As with the previous design, the controls will be independent.

    You're no dummy - I knew nothing about these machines before you told me about them. ;)

    No, I didn't simulate your circuit; it was missing a ground path for the diode. [eta] It had no chance of working properly without that. You needed a circuit like in my next post.

    I have to run, be back later.
     
    Last edited: Aug 17, 2010
  14. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, round #3.... ;)

    Couldn't find a 10k dual pot for under $25, but I found a mini dual 5K pot for $1.

    http://www.goldmine-elec-products.com/prodinfo.asp?number=G16158
    They have a $10 minimum order, so order 10 of 'em so that you will have plenty of spares. If you use your machine a lot, you will probably need at least a few of them over time. You may never find these again anywhere, as they are probably obsolete.

    Actually, you could get some other parts from E.G. also; like the LM2903:
    http://www.goldmine-elec-products.com/prodinfo.asp?number=G32154

    These 0.1uF (100nF) caps would make good bypass caps for IC's:
    http://www.goldmine-elec-products.com/prodinfo.asp?number=G17317
    You will need one for the LM2903 comparator.

    Pick up one of these cap 10-packs (1nF): http://www.goldmine-elec-products.com/prodinfo.asp?number=G4405
    Pick up one of these cap 10-packs (10nF): http://www.goldmine-elec-products.com/prodinfo.asp?number=G4406
    I don't know how noisy your environment will be. You will need to start out with three of the 1nF caps to bypass Vin, Rhi and Rlow to ground. If that is not enough, you will need the 10nF caps.

    Now if THAT isn't enough to keep things quiet, you may need to use toroidal ferrites to suppress the noise. You just wind your wires coming into your board a few times through the toroidal ferrite (one wire per toroid), and it removes the big spikes.
    Here's 5 for a buck: http://www.goldmine-elec-products.com/prodinfo.asp?number=G6683
    They have an Al value of around 10,000 - which is very high.

    Attached is an updated schematic using the dual 5k pots and a 1N4148 diode like you wanted to do in the beginning; it'll give you roughly a 6.5v fixed window. The network consisting of R3 (the 680 Ohm resistor on top), VR1a, D1, VR1b will have 2mA flowing through it when 12v is applied across it. A 1N4148 diode has a Vf of approximately 0.648v when 2mA is flowing through it at room temperature (25°C). If the temp increases, the Vf will decrease.

    [eta]Note: R1 and R2 should be connected to your logic level Vcc, NOT to 12v. If you need a 12v swing for StepUp and StepDn, then replace R1 and R2 with with 3.3k resistors.

    If you want to make certain that it stays a 5v window, then you can replace D1 with a fixed resistor. 5v/2mA = 2.5k; but since you have a 10:1 divider, you actually need 250 Ohms. They don't make 250 Ohm resistors, but you could use a 500 Ohm pot to get a variable window from 0v to 10v, or a 240 Ohm resistor to get roughly 4.8v window, or a 270 Ohm resistor to get roughly a 5.4v window.
     
    Last edited: Aug 16, 2010
  15. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Here's how to wire up the pots for the reference divider:

    [​IMG]

    Not shown is the shafts of the pots; VR1's pot shaft is on the top, VR2's pot shaft is on the right.

    I didn't show the bypass capacitors from Rhi and Rlo to ground in order to keep the drawing as simple as possible.

    You'll need to find a linear 500 Ohm pot somewhere. Digikey probably stocks them. I don't recommend using a trim pot, as they will have a very limited life span; perhaps 200 adjustments.

    The 100 Ohm resistor gives a minimum range (window) of ~2.1v.
    The 500 Ohm pot in series gives a maximum range (window) of ~11.6v.
    If you set the 500 Ohm pot to midrange, you'll get a ~7v window, which is just about what you want.
     
    Last edited: Aug 18, 2010
  16. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,015
    1,531
    Sgt. , you can't imagine how much I appreciate your help!

    The diesel fuel is too viscous for EDM use, some guys are using lamp oil though, smells better. But still a big fire hazard-- mixing oil/kero and sparks.

    I found 10k dual pots on Ebay.

    I knew about the cap between Vcc and ground, but not on the inputs, thank you.

    Now for some more dumb questions, when ever I think I'm getting the hang of this stuff I get thrown for a loop.

    You, Bill marsden and Audioguru all have said my original idea of the diode drop won't work because it was tied to the input of the comparator and not ground. Isn't the input tied internally to ground in the comparator?
    If the diode won't work, how does the inputs from the resistor/voltage dividers work with out going to ground.

    My reasoning for using the diode, was that it was tied to the Rhi and would give a constant .7 volt drop to Rlo. And as far as too much current flowing through it, the Rhi current would be the same (since thats where the diode is getting it's voltage).

    In your schematic, does the Rlo always stay at a constant voltage difference to Rhi? Or does VR2 need to be adjusted every time VR1 is adjusted?

    You changed the values of R6 and R7 so wouldn't that mean that the voltage difference between Rhi and Rlo would have to change also to keep the same 5V window gap?

    The change from LM393 or LM339 to a LM2903? Is the LM2903 a more noise resistant part?

    Sorry to be such a pain but I really do appreciate your help. cary
     
  17. Potato Pudding

    Well-Known Member

    Jun 11, 2010
    684
    92
    Your machine is very impressive.

    Sgt says the LM2903 is an Automotive Grade IC so it would be more noise resistant as part of making that grade. That is why he suggested you upgrade to that IC or at least one good reason to upgrade. Your spark cutter is going to be a very electrically noisy machine I expect.

    A diode needs bias current to develop it's forward voltage. The inputs of a many IC's and in particular any CMOS device don't have enough leakage current. ICs are mostly voltage coupled with some few devices still current coupled for special reasons or because they are older legacy devices.

    I wish I could help you with your other questions.
     
  18. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Well, I really appreciate the information you've supplied on EDM, which I found very interesting. Retaliating with a viable circuit seemed to be appropriate. ;)

    Yes, I can imagine. I suppose that maintaining a blanket of CO2 around the workpiece could alleviate much of that problem, but starting off with a flame-resistant or flame-retardant fluid would certainly be better.

    They are linear taper, right? You should buy several of them so you will have spares.

    If you are going to use 10k dual pots, then you will need to increase the 680 Ohm resistor to 1.4k, the 100 Ohm resistor to 200, and the 500 Ohm pot to 1k.
    If you opted to use a 1N4148 diode instead of the 200 Ohm fixed and 1k pot, you would have a fixed ~6v window. A 1N400x diode would give a ~5.7v window. However, if you use a diode, the window will change over temperature.

    Sure thing. The Vin from the voltage divider is going to have the most noise on it.

    OK. There IS a path to ground via the comparator inputs. However, it's a very high-impedance path, and the current would be on the order of perhaps 50uA (50 micro-amperes, or 0.05mA). With such a low current, a 1N4148 would have a Vf of only around 460mV, which would give a window of around 4.6v - but the bottom window would be "stuck" at 0v.

    Your Rhi would've been "stuck" at around 460mV, right up until your pot adjustment went to near zero.

    VR1 and VR2 are basically independent.
    VR1 sets the "center" of the window, which is (Rhi+Rlo)/2.
    VR2+series_R sets the window.

    I changed R6 and R7 so that it'll be roughly a 10:1 scale factor, which fits in very nicely with the 12v supply. You'll have practically the entire input rainge of the comparator available.

    The LM2903 is basically equivalent to the LM393, but is rated for automotive temperature range (-40°C to 85°C) rather than the commercial temp range (0°C - 70°C). An LM393 would work just fine, too. If you use an LM339, you will need to ground the inputs to the two unused comparators, or you will have problems.

    Not a pain; your questions are valid.

    If you have more, then ask away.
     
    Last edited: Aug 18, 2010
  19. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Unfortunately, this is not the case. The only difference is the operating temp range.

    Very true.
     
  20. shortbus

    Thread Starter AAC Fanatic!

    Sep 30, 2009
    4,015
    1,531
    Sgt., here is another good article on EDM. It contains content on both sinker(what I'm doing) and wire EDM. Wire EDM is like a spark band saw. It uses a moving wire as the electrode and the table is CNC to cut any shape. As long as the part is conductive wire will cut it.

    The machine will be electrically noisy, would it help any to put ferrite toroids on the leads that will connect to the electrode?

    What about using a module like on the supply wire on a computer, don't know what it's called but the plug from the wall out let goes to it. Would that help?

    Thanks again for the answers!
     
Loading...