Electronic – arduino – Using Analog Devices TMP36 temperature sensor with Arduino. Issue with Shutdown pin

arduinotemperature

I am using an arduino to measure ambient temperature by reading an analog voltage from an Analog Device TMP36 temperature sensor. http://www.analog.com/static/imported-files/data_sheets/TMP35_36_37.pdf

The TMP36 is powered by the regulated 5V pin from the arduino, TMP36 output goes to A0, and shutdown is tied to the 5V pin. There is a 100n cap on Vin. Everything works great in this setup.

However, if I tie shutdown to an arduino IO pin, such as 12, after configuring pin 12 as an output, and writing high, I get a temperature reading that is approximately 4 degrees C less than it should be.

AND if I tie the enable pin to an arduino pin that has been setup for input with internal pullups enabled, I get the correct temperature!

I tested the output voltage of the pin, and measured 5V.

I thought that the temperature might be affected by a colder wire, but this really doesn't make sense, since all my wires are at ambient air temp, and I can use the same wire to connect shutdown to the 5V regulated out, and a GPIO in quick succession, and see the temperature drop when connected to the GPIO, and rise immediately to ambient air temp when plugged directly into regulated 5V.

Does anyone know what the difference could be between tying "shutdown" to an output enabled pin VS regulated 5V?

Best Answer

I speculate wildly:

  • you haven't allowed the device turn-on time to elapse, try adding a delay,

  • the rise time of the SHUTDOWN pin relative to +Vs is somehow unusual, try controlling +Vs also from a GPIO.