1
\$\begingroup\$

Background

I have the following circuit built on a breadboard at this time.

I'm powering it off computer USB and a 5 V, 2 A wall wart (via USB) into the Nano Every (which is located on the breadboard -- making the ATMega4809 available).

schematic

simulate this circuit – Schematic created using CircuitLab

Reading temperature values

I'm reading temperature values from the TMP36 and writing them to an SD Card along with times and displaying them on the OLED screen.

Temperature values vary wildly

I'm using the following library to read temperatures ==> https://github.com/Isaacr100/TMP36

This is a good library and basically wraps up the simple functionality of converting voltage to temperature.

The getValues function is basically everything you need to know about.

void TMP36::getValues() {
  _value = analogRead(_pin);
  _voltage = (_value/1024.0) * _aref;
  _tempC = (_voltage - .5) * 100;  
  _tempF = (_tempC * 1.8) + 32; 
} 

Main question

Why do my temperature values vary so wildly from one reading to the next (70.4°F up to 74.44°F)?

What I have tried

1. I built an entire test board which has 2 TMP36 components and a regular Arduino Nano (uses ATMega328). This board reads from two components on different Nano pins and writes the values to SD card so I can see how much they change -- also displays on an OLED.

Results -- are different

On this separate board, I see values that are much more in line with the actual room temperature (69 - 70°F) and they do not vary much at all -- within 0.5 - 1 degree of each other, but much of the time they are the same value.

2. I read the TMP36 datasheet and added 22 μF caps on the VCC / GND pins of all the TMP36 as they suggested and thought that would get better (for noise). This didn't help in my circuit that is shown.

3. Because this calculates temperature from voltage I decided it was important to insure that my voltage was very precise. I installed a 3.3 V voltage regular and checked with multimeter.

3.3V voltage regulator

Notice that I'm insuring that my reference voltage is good also, by running a 3.3 V regulator into AREF on the Nano Every and using analogReference(EXTERNAL). This should insure that the temperature conversion is done in relation to a proper reference voltage.

I read the value off the regulator and I'm getting a solid 3.29 to 3.30 V.

I'm also passing thd proper voltage (3.29 V) into the TMP36 library (mentioned above).

Circuit shown varies -- other board doesn't

Since the test board has two TMP36 components on it, I've taken one out and swapped it with the one in the circuit shown but it varies wildy only in the circuit shown, but not the test board.

Why might this be?

What types of things should I look at now? Is this just because I have a lot of noise in this circuit?

NOTE: The two momentary buttons are wired properly for debounce but shown in the schematic as direct connect for simplicity.

\$\endgroup\$
12
  • 3
    \$\begingroup\$ 1) The datasheet seems to suggest only using a 0.1uF ceramic cap for C1. 2) Standard troubleshooting advice -- simplify your system. Determine the smallest circuit which doesn't work. \$\endgroup\$
    – ErikR
    Commented Jun 10, 2021 at 20:54
  • \$\begingroup\$ @ErikR Thanks for noticing the cap size and mentioning. I'll look at that again and will also look at simplifying until it works properly. 👍🏽 I updated the schematic. I have a 104 cap (.1uF) in the actual circuit - confirmed - had it wrong on schematic. \$\endgroup\$
    – raddevus
    Commented Jun 10, 2021 at 20:55
  • 1
    \$\begingroup\$ You shouldn't really have that much noise since you're not doing anything heavy, unless your bluetooth IC is taking a lot of current and your power supply cant source it. Are you seeing this variation on the screen? Or only noticing it on the SD card? \$\endgroup\$
    – BeB00
    Commented Jun 10, 2021 at 20:55
  • \$\begingroup\$ @BeB00 I'm seeing it in both places -- it seems the actual value I read varies and is higher both on the screen and written to the SD card. Thanks for your input. \$\endgroup\$
    – raddevus
    Commented Jun 10, 2021 at 20:57
  • 4
    \$\begingroup\$ Did you put a scope on the output of the TMP36? What does the waveform look like? \$\endgroup\$
    – Hilmar
    Commented Jun 10, 2021 at 22:01

1 Answer 1

-1
\$\begingroup\$

https://github.com/Joe0x7F/TMP36

The TMP36 is a terribly unstable device. Try a MCP9701A or a LMT87.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ How come my TMP236s read stable to roughly ~10 mK then ? This is nonsense.. The TMP236 and MCP9701 are obvious clones.. \$\endgroup\$
    – tobalt
    Commented Aug 4, 2022 at 8:57
  • \$\begingroup\$ > "How come my TMP236s read stable to roughly ~10 mK then ?" - TMP236 != TMP36. > "This is nonsense." - Nope. That's not what the data says. > "The TMP236 and MCP9701 are obvious clones.." - Obviously, the MCP9701A and the LMT87 are NOT clones of the TMP36. \$\endgroup\$ Commented Aug 4, 2022 at 16:13
  • \$\begingroup\$ Ok these parts differ in some gain/offset values internally. They all share the same topology. I don't believe that - if properly connected and not broken - any part of that bunch will be magically 100x noisier than any other one. \$\endgroup\$
    – tobalt
    Commented Aug 4, 2022 at 17:13
  • \$\begingroup\$ It was hard for me to accept the reality I was looking at too. \$\endgroup\$ Commented Aug 4, 2022 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.