Pages: 1 [2]   Go Down
Author Topic: Having temperature spikes with TMP36  (Read 2558 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I much prefer the form:
Code:
Temp += 0.05 * (Reading-Temp) ;

You don't have to remember to change both constants each time and its provable stable when Reading == Temp even with floating point rounding issues.  both 0.95 and 0.05 are inaccurately represented in floating point and in particular 0.95+0.05 may not equal 1.0
- and it performs faster too (replacing 1 floating multiply by 1 floating subtraction)
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 46
Posts: 2865
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The TMP36 is an accurate and easy to use with an ADC and oversampling is certainly the way to measure temperature.
(I would take 50 or so readings every hundred milliseconds and average) but what I don't understand here is why it is
necessary to use any temp data that came during the command to the 'relay' or for that matter any other command
sequence or event, unless the device is in a PID loop. Although the long thermal inertia of the '36 would eliminate even
that concern... IMHO

Doc
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

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

I did a similar project recently, and had similar issues using a TMP36.  I only had a single relay and an LCD shield.  Everytime I would energize the relay or turn on the backlight on the LCD shield, my temperature would jump up be several degrees (°C).

I tried taking several raw values and averaging them before converting to a temperature and it helped but still had issues.  I noticed that the reference voltage would drop ever so slightly as I turned on the outputs and determined this is what was making the temperature jump.  Then I tried using a precision voltage reference (REF5040) but still saw some jumps in temperature.  My final solution was to replace the TMP36 with a DS18B20 and all of my issues went away.  I did not even have to modify my wiring too much as I switched the analog input I was using to be a digital input and carried on.

This was my first arduino project and I used a clone that I bought off of eBay.  I'm not sure if this clone is inferior quality and maybe the TMP36 would work better with a real arduino or not but I was unable to successfully use a TMP36 in a way that would work for me.

Chris
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I only had a single relay and an LCD shield
Did you have a separate powersupply for the relay? that is often advised to prevent power drops.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

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

For the relay, I used the 5v from the Arduino Uno board which I assumed is not being sourced by the Ardiuno itself, but the voltage regulator and just drove a transistor using the Arduino output.  I will admit that I never looked at the schematic to verify the 5v source though.  The relay module I used was also from eBay.

Since the Arduino analog inputs are only 10-bit, a raw value change of two jumps almost an entire degree (°C).  Filtering helped this obviously but I still saw the temperature going up when the power dropped and because a small raw change caused such a large temperature increase, I ended up moving to a digital device.


* small_relay.jpg (41.46 KB, 369x369 - viewed 7 times.)
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Since the Arduino analog inputs are only 10-bit, a raw value change of two jumps almost an entire degree (°C).
If you know that the temperature stays within a certain range, you can use a voltage divider on th AREF pin to increase the sensitivity of the analogRead().

e.g. if for 5V the range of the tmp36 stays between 300 (~1.6V) and 600(~3.2V), one could supply 3.3V to AREF

the measurements range would become ~450 - 900 effectively increasing the # bits per degree.
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Pages: 1 [2]   Go Up
Jump to: