Electronics LM35 and op-amp Please Help urgent

Discussion in 'Modding' started by Halo, 28 Apr 2006.

  1. Halo

    Halo What's a Dremel?

    Joined:
    11 Feb 2006
    Posts:
    17
    Likes Received:
    0
    I have spent so much time on this little circuit and yet it still doesnt work :wallbash: . Ok I have a LM35 (temperature sensor) . Its output needs to be amplified by 5. This then connects to a ADC (ADC0804). This value is then read by an 8031.

    The 8031 divides this value by 2.5 and outputs to the LCD. :)

    Ok so i know the LM35 outputs 10mv/C and thats why i need to amp it up a bit.
    so 1v = 100C (10mv * 100 = 1).
    Thats good enough for me as this device is not gonna go any where near 100C and will not go below 0.

    so 1v * 5 = 5v. So i need a gain of 5.

    Max needs to be 5v because I am using ADC0804 with a VREF of 5 or VREF/2 = 2.5

    5/255 = 0.0196v per devision (255 = 2^8)

    ie
    temp of room = 21c
    LM35 ouput = 0.21V
    Amp output = 1.05V (= 0.21 * 5)
    ADC ouput = 53.57 (= 1.05 / 0.0196)
    8031 ouput = 21.4 (= 53.57 / 2.5)


    temp of room = 30c
    LM35 ouput = 0.30V
    Amp output = 1.5V (= 0.30 * 5)
    ADC ouput = 76.5 (= 1.5 / 0.0196)
    8031 ouput = 30.6 (= 76.5 / 2.5)

    :thumb:

    Ok so thats the theory behind all of that yet it doesnt work. I know the fault is not with the 8031 or with the LM35 :confused:

    or with the ADC. The problem lies with the amp. I am using to a 741 to try * 5 but no matter what i do it just

    doesnt work. I have searched a bit on this form to try to find info on the 741 but just running into ppl saying dont

    use a 741 and i have come to the conclusion the 741 will not work for this.
    I only have 5v and ground to work with.

    If any 1 can help me please 2 things
    1. What op-amp / IC must i use to achive this * 5?
    2. What should my circuit look like?

    This is what i have been taught yet it doesnt work. By using this circuit i get a constant output voltage no matter

    what the LM35 changes too, the ouput of the 741 stays constant. It does change if i change the feedback var.

    Considering if i change the FeedBack var the lcd reflects the changes so i know the problem lies not with the ADC or

    8031. If i stick the LM35 by itself and measure the voltage out it is correct and does change. I connect this all to

    the 741 and then nothing works like it should. Please if you can provide any help.

    [​IMG]
     
  2. SteveyG

    SteveyG Electromodder

    Joined:
    23 Nov 2002
    Posts:
    3,049
    Likes Received:
    8
    Narrow down the source of your problem. Apply a controlled voltage to the input of your amplifier and measure the output. Apply a controlled voltage to your A/D converter and check the result. Apply a known bit pattern to the register you are using to store your A/D result and check you get the correct output.

    http://ourworld.compuserve.com/homepages/Bill_Bowden/opamp.htm

    Shows how to connect an op-amp as a non-inverting amplifier.
     
  3. Halo

    Halo What's a Dremel?

    Joined:
    11 Feb 2006
    Posts:
    17
    Likes Received:
    0
    I know its its the opamp that is the problem ... can this be done with a 741 ? from what i have seen it cant be. can any 1 provide the name of an opamp / compartator that will allow me to do this.

    From that link i will try that configuration for the non-inverting amplifier.
     
  4. cpemma

    cpemma Ecky thump

    Joined:
    27 Nov 2001
    Posts:
    12,328
    Likes Received:
    55
    I think your problem is the 741 on a single-rail 5V supply. Most op-amp outputs can't swing any nearer than about 1.5V from either supply rail, so until your ingoing signal goes above about 0.3V it will give the same 1.5V output.

    An LM358 or LM324 is aimed at single-rail use, they will swing down to ground and do a better job in this situation.

    Your feedback resistors are wrong too, Rf should be 5k if Ri=1k
     
  5. Halo

    Halo What's a Dremel?

    Joined:
    11 Feb 2006
    Posts:
    17
    Likes Received:
    0
    ok i built that circuit using a 741

    if i measure the volatge out at the LM35 i get 0.250 wich is about 25C +-
    the after the amp i get 1.167 at the input of the adc wich is displayed as about 25 on the lcd.

    now if i put my fingers on the LM35 for a little while and re-measure
    the LM35 is now at 0.3v wich is about 30C
    the input to the adc is still about 1.167 or there about but no where near 1.5v that it should be

    Pin configs for 741
    1 Offset null 1
    2 Inverting input
    3 Non-inverting input
    4 VCC-
    5 Offset null 2
    6 Output
    7 VCC+
    8 NC

    i have the 741 connected like this
    1 NC
    2 Connected as in the diagram below
    3 5v
    4 gnd
    5 NC
    6 Connected as in the diagram below
    7 5v
    8 NC

    sorry about the criss/crossed lines but i did it in paint and quickly

    [​IMG]

    Any suggestions ? i dont know what i am doing wrong

    ok cpemma in this try i used as u can see in the pic 100ohm and a 1kVAR and just ajusted it until i got what i wanted. I will keep those resistor values in mind.

    Ok i will try buy a LM358 or LM324 tomorrow and retry. But as i understand is the circuit above correct ? Gonna go hunt down datasheets for those 2 IC now and see what they say.

    Edit
    found the 2 datasheets gonna see if i can get hold of a LM358 seems like the best choice ... dont need 4 :) .. just hope i can find a store that sells them
    /Edit
     
    Last edited: 28 Apr 2006
  6. whypick1

    whypick1 The über-Pick

    Joined:
    17 Oct 2002
    Posts:
    2,014
    Likes Received:
    2
    Well, I just went through the math on the circuit you just posted, and it's definitely not correct (assuming I did it right). When I wound up with a quadratic equation to find the right value for the pot to get a gain of 5, I thought "this isn't good". Then I did the quadratic formula and found two imaginary roots, which definitely isn't good.

    The other is also wrong, as you'll get a negative gain. This should be the correct way to get a gain of 5:

    [​IMG]

    The resistor values don't matter, just as long as the ratio R2/R1 ~ 4.
     
  7. cpemma

    cpemma Ecky thump

    Joined:
    27 Nov 2001
    Posts:
    12,328
    Likes Received:
    55
    You don't want the RHS earthed connection. It has to be a non-inverting amp, otherwise 0.2V in --> -1V out, the op-amp can't go negative with +5V & 0V rails.

    1.167V = "about 1.5V"

    I see whypick1 has the same thing. :thumb:

    quadratic equations? Non-Inv, gain N, resistor ratio = N-1:1
     
  8. Halo

    Halo What's a Dremel?

    Joined:
    11 Feb 2006
    Posts:
    17
    Likes Received:
    0
    Thanks guys i will grab a pack of 4k's tomorrow as well as the LM358. I am sure i have a 1k lying around here.
    I am going to connect the circuit as whypick1's circuit and hope for the best.
    12:14am atm so shops open in a few hours. Hopefully in a few hours i can post success.

    ooh some thing i dont get

    whypick1, cpemma say resistor ratio = N-1:1
    but in the begining cpemma you said Rf should be 5k if Ri=1k
    :confused:

    is that because of the two diffrent configurations ?
    There seem to be a lot of diffrent configurations for a non-inverting amplifier ... so which one should i follow ? I take it for every configuration the resistor values will be diffrent to achive the same again?

    or have i missed the plot completely

    Thank you, once again
     
  9. whypick1

    whypick1 The über-Pick

    Joined:
    17 Oct 2002
    Posts:
    2,014
    Likes Received:
    2
    Bah, I probably did the equations wrong when I did it for Halo's second circuit (even though I know it's a bad idea, I find myself doing equations in notepad quite often).

    Halo, cpemma was referring to the gain on your circuit, not mine. Here's how mine works:

    For all of these calculations, we're going to assume that the op-amp is ideal, so the inputs draw no current, no current is lost in the output, and the potential of the inputs are the same.

    With those conditions set, we can find out what the gain is. For now, let's just deal with this symbolically:

    Vp = Op-Amp Non-inverting input
    Vn = Op-Amp Inverting input
    Vout = Op-amp Output
    Gain = Vout/Vin
    Resistors R1 and R2 corresponding to the one's in my diagram.

    Since our op-amp is ideal, Vp = Vn, which, as Vin is tied directly to Vp, both equal Vin. Now we only have one equation to solve for the gain, which we find using Kirchoff's Current Law:

    Vin/R1 = (Vout-Vin)/R2
    Multiply each side of the equation by the other's numerator to get rid of the fractions:

    R2*Vin = R1*Vout - R1*Vin
    Add R1*Vin to both sides:

    (R1+R2)Vin = R1*Vout
    Divide both sides by (Vin*R1):

    (R1+R2)/R1 = Vout/Vin = Gain
    Now, to get the desired gain of 5, simply put that into the equation:

    (R1+R2)/R1 = 5
    Multiply both sides by R1, then subtract R1 from each side:

    R2 = 4R1

    Voila.
     
  10. cpemma

    cpemma Ecky thump

    Joined:
    27 Nov 2001
    Posts:
    12,328
    Likes Received:
    55
     
  11. Halo

    Halo What's a Dremel?

    Joined:
    11 Feb 2006
    Posts:
    17
    Likes Received:
    0
    Thank you guys, you are a great help.
    My electronics is rather bad, but my digits side and programming is the much better side :)
    2:07 am got 2 be up at 8 to go buy that opamp better get some sleep will repost in a few hours as to how things go :)
     
  12. g0th

    g0th What's a Dremel?

    Joined:
    12 Apr 2005
    Posts:
    319
    Likes Received:
    1
    I don't think 4k is a standard resistance value.

    Assuming you've only got E12 values available, try 1.2k and 4k7.
     
  13. Halo

    Halo What's a Dremel?

    Joined:
    11 Feb 2006
    Posts:
    17
    Likes Received:
    0
    I actually didnt think about that...
    I will try 1.2k and the 4k7 combination and if i need to try 1.2k and (4k7 series with 100)
    to get a more = 4.

    There shouldnt be a problem sticking that resisor in series ?
     
  14. whypick1

    whypick1 The über-Pick

    Joined:
    17 Oct 2002
    Posts:
    2,014
    Likes Received:
    2
    There shouldn't be a problem putting resistors in series to get a tighter ratio. I just used 1k and 4k to make the math simpler. The important part is that the ratio be 4:1 between R2 and R1.
     
  15. Halo

    Halo What's a Dremel?

    Joined:
    11 Feb 2006
    Posts:
    17
    Likes Received:
    0
    I eneded up buying
    2x LM358 :thumb:
    2x LM324
    1x IR diode
    1x IR Reciver

    I built the circuit above and at least now i dont get a constant voltage out when i touch the LM35! :baby: It now varies when i touch it the temp goes up and when i stop it cools down. Hurray. :D That 741 is useless just brings about problems :waah: . I will take the circuit into an airconditioned room later and see how close it is to the actuall room temperature and then decided if i should add extra resistors.

    As for the IR diode and IR reciver that has to go into another project that has to do with a beam break. Which i will try later 2 day to get working.

    Thank you guys so much for helping me with this opamp stuff, you have saved me a great deal. :clap:
     
  16. agent420

    agent420 What's a Dremel?

    Joined:
    18 Apr 2006
    Posts:
    227
    Likes Received:
    0
    I know this doesn't really help your current situation, but another option is to use a serial protocol device like the DS1620 or equivalent that do not require analog scaling.
     
  17. Spoon

    Spoon What's a Dremel?

    Joined:
    1 May 2006
    Posts:
    3
    Likes Received:
    0
    In defense of the legendary 741, I think simply you don't have a high enough operating voltage.
    It is designed to operate with ±5V bi-polar supply (VCC- = -5V, VCC+ = +5V), I.e. 10V accross the device. A good way is to power it with a single 9V PP6 battery, that always works. Also remeber the output can only go to within 1.4V of VCC+.
    If you've only got access to a 5V supply you will have to look at modern low-voltage OpAmps. :search:

    PS: I think your circuit design is fine, off the top of my head!
     
  18. muhammad shoaib

    muhammad shoaib What's a Dremel?

    Joined:
    22 Nov 2011
    Posts:
    1
    Likes Received:
    0
    LM35 WITH LM358P

    WHYPICK1 WHYPICK1 WHYPICK1
    :wallbash: :wallbash: :wallbash: :wallbash: :wallbash:

    I am stuck in exactly the same problem. WHYPICK1 Circuitory is not visible helppppppppp
     

Share This Page