incorrect TMP36 reading after connecting LDR to power rails

I have an attiny hooked up to a TMP36 sensor and a 315 MHz transmitter to remotely monitor temperature.

I changed the reference voltage to 1.1V to get better resolution from the TMP36.

From my spare parts box, I found a Light Dependent Resistor and measured the resistance in light 0.8 kOhm and dark 600 kOhm.

So I used this image and replaced R1 with my LDR and R2 with a fixed resistor. Using the formula to solve for a maximum Vout of 1.1V when Vin is 5.25V gives R2 as 220 Ohm.

I connected to the power rails but before connecting Vout to a pin on the attiny, I checked with a voltmeter and Vout varied from 0 to 1.1V. So far so good.

The problem is that the temp readings jumped from 20 C to 37C (the room was still 20C). After disconnecting then reconnecting power the temperature readings slowly came back down to 28C but another thermometer shows the room is actually 18C. The voltage on the TMP36 analog out pin is 690 mV (i.e. 19C) which is correct given the room temperature.

What happened to the attiny? What happened to the power rails to alter the ADC?


Assume that your LDR is in the light.
The voltage divider is 800 + 220 = about 1K Ohms.
Current through your divider will be 5.25/1020 = about 5mA.

Now assume that your LDR is in the dark.
We can ignore the small relative value of R2 and just use the 600k figure.
Current through your divider will be 5.25/600,000 = about 9 micro Amps.
Is that enough current to drive your sensor properly?

Hi, Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf? Can you please post a copy of your sketch, using code tags. A picture is worth a thousand words and can save tens of posts to get the correct advise. Have you tried it without the wireless unit connected and how are you powering everything? Have you got the power supply bypassed at the tiny with a 0.1uF Cap.

Tom...... :)

I have been working on getting the circuit imaged. While I was testing I found that the 47uF decoupling electrolytic was the problem. On the 29th, I first removed it with the power on and the temp reading fluctuated wildly. After a power on/off without the 47uF the signal shows the correct temp. My LDR testing was on the 26th in the evening.

Did I damage the 47uF capacitor with my LDR testing?

The Attiny is an 85 but fritzing only has an image for the Attiny13. The transistor is a 2N222 to turn on the transmitter when data is ready.


Hi, can you give us a picture of a hand drawn circuit, the fritz diagrams are pretty hopeless. It does show that you have a transistor across the power supply to the chip, why. Is your supply 5V, really 5V and you may need to make the 47uF cap larger.

Please please a picture of a hand drawn circuit, or a CAD drawing, fritzing is not CAD or any thing representing a circuit diagram program.

Tom..... :) PS took me 25mins to get out of fetal position this time.