Pages: [1]   Go Down
Author Topic: TMP36 Sensor outputs change when ATtiny is plugged in  (Read 953 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all, I hopefully have a very simple problem, but I have been hunting for weeks for a solution and don't seem to be making much headway.

I am using an ATtiny45 with a 1 MHz clock and an Arduino Uno to program it. I am attempting to use a TMP36 temperature sensor with it. The temperature sensor seems to work fine when it is the only thing plugged in to the power supply, but once I plug in the ATtiny microcontroller the output from the temperature sensor drops dramatically to some random value. The sensor should output around 0.76 V at room temperature (which it does when the microcontroller is not connected to power) but once the microcontroller is connected the values seem to drop to some value between 0.2 and 0.5 V.

It does not seem to make a difference which power supply I use. I used my bench supply, a 5V wall wart, and the 5V rail from the Arduino and all give the same result. It also doesn't seem to matter which code is running on the ATtiny. To that end, it ALSO doesn't matter if the output from the sensor is even hooked up to the analog input on the ATtiny. I have tried two different microcontrollers and three different temperature sensors as well.

I know I'm new to all of this so any help would be awesome!
Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 181
So, you want to make something, huh?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't know much but my guess is that you're using the Arduino to power the attiny and the Voltage regulator of arduino isn't able to supply that much current. Use an external power supply to power the attiny.

You can also try connecting the 5v pin of the Arduino top the Aref pin.
Logged

If you want to meet a beautiful nurse you must be patient.

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can program the ATtiny, remove the Arduino from the circuit, and power the ATtiny and temperature sensor from my bench supply, but I still have the same problem as before. The ATtiny doesn't have an Aref pin, does it?
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The ATtiny doesn't have an Aref pin, does it?

My ATtiny84 has one, which one are you using?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ATtiny45. If there are different ones, this one is an 8-pin DIP that I can use on a breadboard. I still feel like this should be a simple solution though, I see tutorials everywhere with this same hardware and it seems like no one else has had this problem.
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you post a picture of the cabling?

Does the supply voltage change when you you plug the ATtiny45 in?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset



As you can see, very simple: just the +5V rail connected to pin 8 on the ATtiny and to the "left" pin on the TMP36, and the ground rail connected to pin 4 on the ATtiny and the "right" pin on the TMP36.

I measure the +5V rail at 5.116 using a Fluke 115 multimeter. Again, as soon as I hook up the ATtiny the output of the TMP36 drops to about 0.1 V. I hooked my oscilloscope up to the output just for kicks and it looks pretty normal too. There's a slight bit of noise when I plug in the ATtiny but it's just an extremely small ripple, the TMP36 should have no trouble with this setup.

Also FYI the ATtiny is just running the "blink" program just so I know it's not doing anything weird.


* Photo.jpg (2413.81 KB, 2592x1936 - viewed 40 times.)
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You don't have a decoupling capacitors, neither on the tiny nor on the TMP36. Try a 100nF directly at the chips and one 47µF on the power rails.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This seems to have fixed the problem! For something so simple it seems to be absent from a lot of the simpler tutorials (I'm no electronics expert). Perhaps it is because they are geared towards using a full-blown Arduino instead of the smaller ATtinies, and the Arduino does a better job of power regulation. Either way, I appreciate the help! If the problem crops back up I'll let everyone know.
Logged

Switzerland
Offline Offline
Faraday Member
**
Karma: 108
Posts: 5144
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Perhaps it is because they are geared towards using a full-blown Arduino instead of the smaller ATtinies, and the Arduino does a better job of power regulation.

No, it (the ATmega of it) doesn't, it's even worse. The decoupling capacitor should be in place on every chip if you read analog values. The Arduino board contains the decoupling capacitors, so if you use the complete board, that changes the situation.
Logged

Pages: [1]   Go Up
Jump to: