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.

Support Forum » ADC not returning anything from tempsensor

January 18, 2012
by travin
travin's Avatar

Hi,

I've verified my code by loading the provided complete tempsensor.c

In both attempts (mine and your .c file) the ADC is returning nothing from the sensor. I suspect a bad sensor?

I've verified that the sensor is connected properly as well.

Right to GND Middle to PC0 Left to AREF

Thoughts?

January 19, 2012
by hevans
(NerdKits Staff)

hevans's Avatar

Hi travin,

What do you mean when you say you get nothing from the the temperature sensor? Is it all 0, or is it constant at some ADC value?

If you could include a good close up picture of your setup, we would be happy to help you double check everything.

Humberto

January 19, 2012
by travin
travin's Avatar

The value is constant at 0.

I'll post a few images later tonight but I'm pretty certain the connections are proper.

In your experience, will the LM34 normally just produce nothing on failure or is it usually erratic values?

January 19, 2012
by Rick_S
Rick_S's Avatar

From my experience, the LM34 is very unlikely to fail. If you want to test your circuit and program, remove the LM34, then jumper a wire from ADC0 to GND. You should see zero for your ADC value. Then remove the jumper and connect ADC0 to VCC, you should see a value of 1023 (or very close to that). With no jumper and the ADC floating, you should see erratic numbers.

January 25, 2012
by travin
travin's Avatar

Sorry it has taken a bit to get back to you. I have just now attempted to jumper as you specify and the readout remains zero at all positions. Below are images showing the wiring:

Top Side 1 Side 2 Readout

January 26, 2012
by Rick_S
Rick_S's Avatar

I have to assume you had the temperature sensor removed when you jumpered ADC0 to VCC or GND correct?

Everything in your photo above looks good from what I can see. Can you post the code you were running?

One other thing you could try would be to use a different ADC input. To try this, you would need to make a few changes to the tempsensor program as outlined below.

1) Remove the Temperature sensor. 2) in adc_init() change the line that reads

ADMUX=0;

to

ADMUX=1;

Compile and load the program.

To test, do as before only with ADC1 (Pin 24)

Leave the wires at pins 20 Thru 22 as is.

Then Place a jumper from pin 24 (ADC1) to GND.

You should have a zero reading. Remove the jumper at pin 24 and replace it with a jumper from pin 24 to VCC. You should see a reading of 1023.

Rick

January 26, 2012
by hevans
(NerdKits Staff)

hevans's Avatar

Hi travin,

In addition to all of Ricks awesome suggestions, double check that you do in fact have an LM34 temperature sensor on your board. The 2n7000s MOSFETs and LM34s look really similar.

Humberto

January 27, 2012
by BobaMosfet
BobaMosfet's Avatar

Travin,

Make sure you have the right pins from the LM34, in the right rows on the breadboard.

uC  LM34
---------
21  1
23  2
22  3

BM

Post a Reply

Please log in to post a reply.

Did you know that you can connect a pushbutton to a microcontroller with only one wire? Learn more...