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 » Need help with tempsensor project

December 28, 2009
by xterm11
xterm11's Avatar

I first thought it was a problem with the code, because the temperature output on the LCD was 499.51. Then I displayed the output coming from the temp sensor, and it is at 1023 out of 1024. I don't know if it is the sensor, or me.

December 28, 2009
by xterm11
xterm11's Avatar

OK, it's the ADC that is 1023 of 1024

December 28, 2009
by xterm11
xterm11's Avatar

I played around with the temp sensor, and if I plugged it into a different position other than that of the instructions, the temp and ADC actually change, and are more reasonable. The odd thing is it only does this if the middle pin is not plugged in.

December 28, 2009
by Hewitt2
Hewitt2's Avatar

We had a similar situation Saturday. Our first night with the kit. the next day it was still giving a static reading. We rewired it again even though we were certain it was right.

It wasn't. It worked fine after that

December 28, 2009
by xterm11
xterm11's Avatar

It's odd. I can print to the screen, I've got it working off of USB power, and I got the blinking LED circuit working. But I get a static reading from the temp sensor, and when I plug it in different spots, I actually get a varying temp. Ive checked where everything is relative to the board, and the chip. I'm stumped.

December 28, 2009
by BobaMosfet
BobaMosfet's Avatar

xterm11--

Make sure your pins are correctly positioned. Your LM34 will pin as follows:

PIN 1 -- This is directly off your 5V rail.
PIN 2 -- This outputs between 0V and 5V based on temp to pin 23 on the MCU
PIN 3 -  This is Ground off of your Ground rail.

First, use a voltmeter (VM) and determine what voltage is coming off of your LM7805 regulator-- connect the positive VM lead to your 5V rail, and your negative lead to the Ground rail-- how much voltage is dropping across the meter? THIS is what your ADC will use as its reference for 100%. We will call this value 'ADCRef'. Because of how the LM34 is made, approximately every 10mV = 1 Degree above it's base threshold. We will call this 'DegRatio' (for Degree Ratio).

Next, see what the LM34 (temp sensor) is outputting. To do this, you can put your VM's positive lead against PIN 2, and your negative lead on your Ground rail, in order to see how much voltage is dropping across your meter, from that PIN 2. You can manually calculate what the ADC should be generating:

DegRatio = 1 / 10
ADCVal = ((ADCref/1024) * DegRatio) * VM

So whatever you are seeing from the ADC, should be very close to ADCVal, that you've manually calculated, above. If not, and the LM34 is generating nowhere near 5V on PIN 2, then I'd check your code. If PIN 2 is generating nearly 5V or equal to ADCRef all the time-- then LM34 is bad.

If operating correctly, the LM34 is sensitive. You should be able to place your finger near it and slowly watch the value rise.

Hope this helped. Boba

December 28, 2009
by BobaMosfet
BobaMosfet's Avatar

xterm11--

Ooops... ignore my formula above, please... I was thinking in two different directions at once.

If you use a voltmeter to measure the voltage off of PIN 2, like a described above-- that should tell you the temperature the device is reading, based on AVCRef. The LM34 datasheet lists output on PIN 2 in mV, as 10mV/degreeF.

So, 74.5F = .745V (or 745mV).

So if you see a value changing on PIN2, appropriately based on any household thermometer-- you know the LM34 is working properly. Note that it may not be exactly like the house thermometer, because AVCRef won't be exactly 5000 (5V aka)-- it will likely be less, like 4970 or 4860, and that will skew LM34's PIN 2 output one way or the other-- you should compensate for that in your calculations.

Sorry about the confusing 1st post-- it's after midnight, way past my sleep time.

Boba

Post a Reply

Please log in to post a reply.

Did you know that two resistors plus a transistor can be used to make a better voltage supply? Learn more...