i want to read all temperature range of the LM34(-50 to +300) but i only can program single ended like this one, and i only can read from 0 to 50 F enter image description here

but i can't program one like this(can't read two pins and get the temperature from them),

enter image description here

i can't deal with two pins of ADC, i only can deal with one pin. so could any one teach me how this circuit work?, how to program these two pins ?and what happens inside the ports when i deal with two pins instead of one?, and how to measure the value of the sensor?. BTW, i'm studying from a book but the book didn't say any thing about this, i searched a lot but i need direct help. thank you.

  • \$\begingroup\$ You use two ADC inputs (the ATmega32 has several inputs), sample both right after another and then subtract the results. As temperatures are not going to change super-fast, this should give you accurate results. \$\endgroup\$ – Janka Jun 14 '17 at 2:05
  • \$\begingroup\$ i know that i should do that, but how? should i do a conversion for the first one then start the conversion again for the second one? \$\endgroup\$ – Ahmed Rifaat Jun 14 '17 at 2:31
  • \$\begingroup\$ the problem, is that i don't know how to do it.i can't write the code the book i'm studying from didn't talk about using more than one pin \$\endgroup\$ – Ahmed Rifaat Jun 14 '17 at 2:36
  • \$\begingroup\$ From your other question, you have a line of code that says: ADMUX |= 0xE6; // [...] select ADC6 [...] After you run your first conversion, you may want to consider changing ADMUX to another ADC input, and re-running the conversion. That's how you'd read from two different pins. \$\endgroup\$ – Jay Carlson Jun 14 '17 at 5:42
  • \$\begingroup\$ i'll try to write it's code. \$\endgroup\$ – Ahmed Rifaat Jun 14 '17 at 20:19

The second circuit that you are referencing is only necessary if you need the minus degrees F range of the sensor. For an application where you do not need negative temperature sensing, eliminate the two diodes and directly ground that pin. The single output of the LM34 can then directly go to the input of your ADC. The voltage will be 10 mV per degree F.

If you do require negative temperature sensing, you will need to either power the LM34 from a source with an independent ground or you will need to use an op amp or equivalent to offset the output voltage. If the former, use the second diagram and connect pin 3 to the independent ground of your uP supply.

  • \$\begingroup\$ all that i want is a written example without any libraries to know what happened, all the examples use libraries. \$\endgroup\$ – Ahmed Rifaat Jun 14 '17 at 2:51
  • \$\begingroup\$ You seem to be responding to your other question regarding programming. This question deals with the electrical connections. \$\endgroup\$ – Glenn W9IQ Jun 14 '17 at 2:53
  • \$\begingroup\$ sorry for that. \$\endgroup\$ – Ahmed Rifaat Jun 14 '17 at 3:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.