First post. LM3914 questions

Discussion in 'General Electronics Chat' started by protomor, Dec 23, 2008.

  1. protomor

    Thread Starter Member

    Dec 23, 2008
    22
    0
    So I'm staring at this chip and forgotten all my ECE stuff from college.

    http://www.national.com/ds/LM/LM3914.pdf

    The basics of what I'm trying to do is to hook up a flex sensor to the signal input and have the led graph light up as the sensor is straightened. (sensor is 10k straight and max 30-40k completely bent). The power source will be a 12v car battery. I plan to attach the sensor to a gas pedal in a car and have the graph light up as you press on the pedal.

    Anyway, here are my questions:
    1) I know nothing of capacitors. What kind do I need for this application? It goes on the negative wire to the LEDs to keep the right amount of voltage correct? (LEDs are 3v max iirc).

    2) I know RLo is the low voltage (eg 0v-12v with RLo grounded and 3v-12v if RLo has a 3v feed). Why is RHi connected to ROut if it is higher than 5v?

    3) What IS Ref Adj?!

    4) any suggestions to help my n00b self out? I have a few books but they don't seem to be helping much.
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Welcome to the funny farm :)
    It's sort of like juggling. Once you stop, it's hard to get started again.
    OK, so basically what you need to do is construct a voltage divider.
    Your flex sensor can be on the low side of the divider, one end connected to ground, and a fixed resistor on the high side of the divider, connected to a regulated voltage.

    When your flex sensor is straight, it will have a relatively low resistance (to ground), so the center of the voltage divider will be at a lower voltage potential.
    When your flex sensor is bent, it's resistance increases, so the voltage at the center of the divider increases.

    Capacitors help filter out the "bumps", or transients. IIRC, they used a 2.2uF cap in the schematic if it's tantalum, or 10uF electrolytic. You could use an electrolytic cap, but the voltage rating should be 2x the expected voltage in the circuit.
    Rlo is the low side reference voltage, and Rhi is the high side reference voltage. There is a resistive divider inside the IC that basically consists of 10 1k Ohm resistors. If the voltage applied to SIG IN is between the two voltages, the appropriate number of LEDs will be lit.
    It's confusing! :)
    Basically, the LM3914 has a built-in adjustable positive regulator that's much like a low-power version of the LM317.
    The REF OUT terminal is roughly equivalent to the OUT terminal of an LM317.
    The REF ADJ terminal is roughly equivalent to the ADJ terminal of an LM317.
    The +V terminal is equivalent to the IN terminal of an LM317.
    An LM317 tries to keep a nominal 1.25V between the OUT terminal and the ADJ terminal by controlling the current flow via the OUT terminal, across the resistive divider made up of R1 and R2 to ground.
    You've chosen a very handy (but tough-to-understand) IC to start out with.

    We have online E-books that will help you "brush up" on the things you've forgotten. Click on the links at the top of the page. Best to start at the beginning, and at least skim-read it to refresh your memory.

    You might consider building a variable power supply using an LM317T voltage regulator after you've done some reading. A variable bench supply will come in very handy with various projects.
     
  3. protomor

    Thread Starter Member

    Dec 23, 2008
    22
    0
    haha thanks. I only took ECE 101 so I'm not great with this stuff. I just like to dabble.

    I'm fairly sure the voltage divider for the input shouldn't be a problem. I just need to get the RLo and RHigh to adjust to the min/max the give out correct? I was figuring the RLo would be static since the sensor reads an exact amount when completely straight. I also figured the RHigh would need to have one of those things... (blue box with a screw on top to mess with resistance?) so you can adjust to the max when the pedal is at rest.

    So if I feed RLo 4v and RHi 12V. My lights will light up between 4 and 12 right?

    I've also never used a LM317. I always had a fixed voltage in lab so I'm still knew to that terminology. Ref out on my LM3914 is always the same voltage as V+. Since I dunno how to use a LM317 I still have no clue what Ref out is.

    I don't get what ppl mean by "keep a nominal 1.25V between ref out and ref adj". Why 1.25v anyway?

    I'll get to some reading. Thanks again!
     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    There are plenty of dabblers on here ;)

    If you use the 0-5v schematic, that's just about it.
    However, you need a regulated reference for your external voltage divider, and since your "flex sensor" has a fairly high resistance even when straight, you'll probably wind up increasing the Rlo instead of dropping the Rhi - just off the top of my head without really working the numbers.

    That's still TBD - but you would be better off to adjust the high side of your external voltage divider (formed by your flex sensor on the low side and another resistor on the high side, plus a regulated voltage supply) than messing with Rhi on the LM3914. Fiddling with the REF OUT and REF ADJ is sort of like eating a plate of spaghetti - pull something on one side of the plate, and something on the other side moves. :eek: This is because those REF's not only control Rhi, but also the LED current.

    It's more complicated than that. You'll wind up moving Rlo higher instead of increasing Rhi. Increasing Rlo is easy by adding a trimmer pot (those little rectangular blue/grey/brown thingies with a screw on one side and three leads on the bottom)
    Datasheets are your friends. :) Go to National Semiconductor's website and download their datasheet for an LM117/LM317. Lots of reading and sample application circuits. It'll take several read-throughs to get a decent "handle" on it.

    Well, that's because the nominal voltage across a semiconductor PN junction is about 0.625v. There are a couple of PN junctions between the OUT and ADJ terminals on an LM317. So, what's 2x0.625? :)
    :)
     
  5. protomor

    Thread Starter Member

    Dec 23, 2008
    22
    0
    OK, lets see if I'm learning something here. (note, I did all calculations with 9v because I'm using a 9v battery to test)

    I figured out the ref adj thing. I thought it was a voltage divider or something. I finally understood by staring at: 1.2V(1+R2/R1). Basically if I mess with those numbers, I can set up what RHi I want.

    So I figured 1k for R1 and 5k for Rlo would give me 7.2v (hold that number in your mind)

    I did some voltage divider math and if I did the R2 resistor at 10k, I would get a low of 4.5v and a max (at 40k ohms) of 7.2v hooking up the flex resistor at R1.

    R1 R2 Vin Vout 10,000 10,000 9 4.5 20,000 10,000 9 6 30,000 10,000 9 6.75 40,000 10,000 9 7.2
    (I think) I attached a basic layout of what I'm talking about. Only difference is that I need RLo to get 4.5v?
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Better use nine alkaline AA, C, or D batteries in series instead, because your 9v "transistor" battery output even when new and no load on it is only 8.6v. Also, they have very limited current capacity; 150mAh. Even AA batteries have over 10x that capacity.

    Sort of. The internal regulator has a "dropout voltage"; you can't get a higher output than +V - 1.7v. Since you're starting off with a puny 8.6v battery, the highest you could possibly get is 6.9v - for a few moments.

    It ain't gonna get there with that 9v battery.

    You've combined apples and oranges for a very sour mash. :eek:

    You want Rhi and Rlo to be constant.

    Your flex sensor output from a voltage divider (as yet to be designed) goes to the SIG IN pin.
     
  7. protomor

    Thread Starter Member

    Dec 23, 2008
    22
    0
    Hmm... noted. So AA/C/D batteries are all 1v each?

    Noted. I shouldn't have to worry when I get to the car battery tho.

    Sorry, thats what I meant. RLo I make receive a 4.5v signal off the main power supply (what resistor combo would be good for that?). And the RHi is just like in the diagram I posted.

    The SIG In should use the flex sensor as it's R1 and 10k as the R2 resistor.

    Isn't it right in my diagram?
     
  8. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    No, alkaline batteries are 1.5v each. When your vehicle's engine is running, your electrical system will be around 13.8v-14.5v; sometimes as high as 15v. You might as well start off with voltages in the range of what your circuit will be operating under. Otherwise, you may have some unpleasant surprises. :eek:

    That's why you test using voltages similar to operating conditions.

    I didn't get as far as looking at your diagram; there were too many problems with just the text portion. ;) Also, I'm multitasking over here, so it may be a while before I can get back to you.
     
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, you have your flex sensor on the high side, and it's being fed from an unregulated source.

    You want your flex sensor on the low side (R1), a fixed resistor (or trim pot) on the high side (R2), and a regulated voltage feeding R2; the regulator must be external to the LM3914. Otherwise, your display will light up backwards.
     
  10. protomor

    Thread Starter Member

    Dec 23, 2008
    22
    0
    Crap. I had the voltage divider setup wrong in excel >_< screws up all my math!

    What do you mean by "The regulator must be external to the LM3914"? Lighting up backwards might not be a bad idea. But I don't get why it would be backwards.

    Also, I DO want to feed whatever the minimum voltage becomes into RLo right?

    Edit: I figured out why it would be backwards. I might actually want it that way. Make the sensor straight when you install it, then calibrate it to the max your pedal is pressed down.
     
    Last edited: Dec 23, 2008
  11. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Let's keep this simple :)

    Whip out your calculator.
    Use a fixed voltage supply of 10v.
    Use a fixed resistor on top of 40k.
    Use your flex sensor on bottom.
    What is the output voltage at the junction when your flex sensor is relaxed?
    What is the output voltage at the junction when your flex sensor is flexed?
     
  12. protomor

    Thread Starter Member

    Dec 23, 2008
    22
    0

    I fiddled around and precalculated a bunch of voltage dividers and got it to work. I wound up with a 2v-6v range using the 9V battery and a potentiometer to fiddle with the ref adj. Eventually, I got 1k ohms for R1 and 9k ohms for R2 on the ref adj section.

    The flex part i just used a 1.2k ohm resistor for R1 and the flex resistor for R2. Other than that, I took the 2v I was feeding the LEDs and used that as RLo.

    LEDs work perfectly. Theres a bunch of fine tuning to get it to work on the car but I hope this works.

    The other option I've been pondering for pedal imput is a potentiometer that rotates with the pedal. The only problem is that it would only rotate a fraction of it's total 300 degree capability. Is th ere a way to multiply resistance?

    PS THANK YOU SgtWookie! Couldn't have gotten this far this fast without you!
     
  13. protomor

    Thread Starter Member

    Dec 23, 2008
    22
    0
    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]

    [​IMG]
    [​IMG]
    Shes very support of me lol.
     
  14. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, if you'd used a regulated 10v supply with R1 being 10V, and your flex resistor being R2, you would have a voltage range of 2v-5v. This means that you could have used the 0v-5v meter schematic in the Applications Notes verbatim, with the addition of a resistor on Vlo to GND, depending upon the actual resistance of the internal network (which varies.) A 5k pot would be a likely candidate.

    I predict an ugly surprise when you connect it up to your vehicle.

    I've been trying to help you out here, without charging you any money.

    Perhaps if I were charging you $60/hr (standard rate) you would be more willing to listen. But if you wish to proceed with your experiments using a 9v battery, thinking that you can slap the resulting circuit in a vehicle and have it work, then best of luck to you. In that case, make sure you use a very small fuse (1/2A), so that your vehicle might survive when your electronics burn up.

    There are ways to amplify signals, but there is no point to try to explain it at this point, since you have chosen to ignore my advice and excercises.

    The only reason your circuit appears to be working at this point is that you are using a puny "9v transistor battery". Were it wired in to an automotive electrical system, it would be crispy-fried in very short order.
     
  15. protomor

    Thread Starter Member

    Dec 23, 2008
    22
    0
    I'm lost. I haven't had time to rig up 10v. I just got home and my existing rig was already there so I swapped a few things around to get something out of it. I'm currently trying to get something so I can simulate the voltage I'll see from a car battery. I could literally hook one up.I do not expect to just slap this in my car and go. I just wanted to apply the little bit I had learned today to make sure I understood everything. I'm quite certain this setup verbatim will fry quite quickly in my car.

    I'm not ignoring your advice, just doing what I can in limited time. It's only been a couple of hours.
     
    Last edited: Dec 23, 2008
  16. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    No, you're new. I've been trying to help you.

    It's not hard. Some cheap PVC pipe with judiciously-spaced holes, batteries, and wires. Besides, you want 14 to 15v, not 10v.

    I see.
    It's not just the voltage, but the current capability.

    9v batteries as I've already mentioned put out about 8.6v under no load conditions even when brand-new. If you put any significant load on them, their output voltage drops like a rock.
    Please do not do so at this point, unless you like frying your stuff.

    Not much harm in that I suppose, as long as you were using a 9v battery - there really isn't enough energy in those to fry much of anything.

    I'll guarantee it.

    I'm not ignoring your advice, just doing what I can in limited time. It's only been a couple of hours.[/QUOTE]

    I want you to know that I am NOT mad at you. I'm just trying to save you from frying your stuff.

    The LM3914 and it's sister IC's provide a lot of functionality, but they are difficult to understand and use properly, particularly for n00bs. I even have to think a good bit about them when I use them, and I've been in electronics for longer than I care to think about at the moment.

    On this site, we try to teach/coach/mentor instead of providing complete diagrams/schematics. This way, everyone winds up benefiting.

    The process is more drawn out, but more knowledge is gained, and fewer parts have the smoke let out of them. :eek:
     
  17. protomor

    Thread Starter Member

    Dec 23, 2008
    22
    0
    I'll have to find or buy some PVC pipe. I can literally get a car battery to try things out though. obviously the car battery will put out more amps. You're saying I should use the 10 AA batteries so I can test on around the right voltage but low amps as to not blow out stuff?

    One thing I don't understand is the difference between the car battery and 10 AA batteries in terms of how I prepare things. Is it just that I won't blow things up if I mess up with the AAs and I would kill the IC if hooked up wrong with a car battery?

    I feel like I understand how the LM3914 circuit works now. The next step is to apply it in my practical application.
     
  18. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    It's dirt cheap, about $2.50 for a 10-foot length.

    That's the basic idea. Batteries are somewhat self-limiting; they can't put out a lot of current. The fact that you've been working with a "9v" battery is what's been saving you up to this point.

    Look, none of this stuff we've talked about thus far has any chance of injuring you, unless you burn your fingers on it as it melts down.

    What you have to realize is that little batteries like your 9v test battery have very little energy to put out, while your vehicle's 12v lead-acid battery represents a very significant amount of stored power. If misused, significant damage may occur.

    Good luck with that.
     
  19. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    To keep this as simple as possible (maximizing your chances of success)
    go with the attached. Test it with your new supply once you build it.

    One schematic is almost identical to the circuit in the datasheet, with an addition of a 10k pot from Rlo to ground. This will enable you to adjust Rlo to 2v.

    The other schematic is a 10v regulator that supplies current to a resistive divider, your flex sensor being R4.

    After R3 is properly adjusted, you will get 2v out when the flex sensor is straight, and 5v out when it is fully flexed.
     
  20. protomor

    Thread Starter Member

    Dec 23, 2008
    22
    0
    ah thats what you meant by a regulated source. Too bad my local radio shack doesnt have an LM317. Thanks. I'll rig this up asap.
     
Loading...