NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Project Help and Ideas » Temperature sensor project

April 25, 2010
by akeller74
akeller74's Avatar

I am having difficulty getting the temperature sensor project to read negative values on the LCD. Any suggestions would be very helpful.

April 25, 2010
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi akeller74,

Welcome to the forums!

The microcontroller's analog-to-digital converter (ADC) is only capable of measuring voltages between AGND and AREF, or in this case, 0.0 and 5.0 volts. It assigns these voltages to the ADC readings 0 through 1023. No negative readings are possible in this configuration. The ADC results are an "unsigned" 16-bit integer, where "unsigned" means they do not even contain information about plus/minus. So, if you're trying to measure <0 degrees Fahrenheit, you're out of luck with this setup.

(There do exist "signed" ADCs which can provide you a conversion through 0. If you bought one of those chips, plus modified the LM34 configuration a bit to be able to go negative, you could make it work.)

If instead you're trying to do something like convert degrees Fahrenheit to Celcius and then display values 0 to 32 deg F as their negative Celcius quantities, that should be doable with just some code changes.

Hope that helps -- let us know!

Mike

April 25, 2010
by akeller74
akeller74's Avatar

Mike, Thank you for the quick response. Your response makes sense, the MCU I used last semester in class was able to do both signed and unsigned. I guess I didn't realize I needed to look for that when I purchased this setup. Thank You again. I will make do with what I have. I may come back for help with modifying the code to go to Celsius.

Post a Reply

Please log in to post a reply.

Did you know that the sparks present in motors can be dangerous for your microcontroller and other electronics? Learn more...