How to get an Atlas Scientific ENV-TMP Temperature Sensor to Work On An Arduino or Sodaq

I have been having a lot of unexpected issues with the Atlas Scientific ENV-TMP temperature sensors. After finally figuring it out, I now feel embarrassed about why. The problem is when you’re trying to diagnose problems you should immediately stop doing monkey-see-monkey-do, and copy paste programming.

As history I started using these sensors with an Arduino Uno and had no issues, but recently switch to an Arduino Yun and as of today a Sodaq. I had no problems with the Uno except for some weak connections at one point. (Weak connections can prevent you from receiving correct readings (duh) so its important to make sure connections are secure.)

The next issue was when I recently upgraded to the Arduino Yun and could never quite figure out why I was getting much warmer readings than usual. I thought it was the weak connections thing, however it definitely hasn’t been the case and it never made any sense to me until I spent the last hour or two digging deep (not very) into the Arduino code provided by Atlas Scientific.

It turns out their hardcoded values shouldn’t be copied and pasted blindly. After reading the raw value from analogRead, they then do this line “v_out*=.0048;”. This is the key line to pay attention to. This is a conversion from the analog signal to digital (ADC). Right here you are converting TO millivolts. The Arduino Yun and Sodaq, unlike the Uno, DO NOT USE 5 VOLTS. Ding ding ding ding. Using that 0.0048 conversion with a 3.3v device will kill the results every time. It turns out there is the explanation in the manual. (RTFM eh?) You take the volts and divide it by the resolution of the analog to digital converter, in this case with the Arduino its 8 bit or 1024. 5 / 1024 = 0.0048. In this case, I THINK you divide 3.3 / 1024 = 0.003222656. All of a sudden my 100-120 degree readings are down to 80 degrees.

Hopefully this helps some other noob out there to trouble shoot their device. I was caught out of left field with this one because I’m trying to get adjusted / understand the Sodaq (they don’t have the best documentation after all) so I was WAY preoccupied with that to even bother looking at the same arduino code I had used for a year.

Leave a Reply

Your email address will not be published. Required fields are marked *