TMP36 Spurious readings

Hi all

Although a similar subject to a current thread, this is a different issue, so I thought I’d start a new one.

I’ve currently got a TMP36 connected to an Imp, uploading data to Xively. It only took an hour to get going from scratch, such was the excellent guidance/tutorials by forum members here :wink:

My current regime is to take the temperature every minute. and store the last 10 minutes of readings, ie 10 readings stored in an array at any one time. New reading comes in and pushes the oldest one out. Every 5 minutes, the 10 current readings are averaged and sent to Xively. This helps with a bit of graph smoothing. It’s not a super-accurate sensor, so you lose nothing there.

I’ve been seeing some spurious readings, eg…

Note the drop at 2pm.

I added code to the functions so that if the Imp is reporting a drop of 2 degrees or more in a 5 minute period, the raw values are logged to my own server. This is what we see for the 2pm reading…

[2013-12-05 13:57:39] log.INFO: a:1:{s:9:"logstring";s:86:",9.067677,9.067677,9.067677,9.067677,9.067677,9.14824,8.98711,-49.9987,9.14824,8.98711";} [] []

Now, clearly the -49 degree reading is completely wrong! Has anyone noticed such issues with the TMP36 module, or, perhaps more pertinently, any issues with the ADC on the Imp producing random readings like this?

Any thoughts/speculation would be appreciated!

Cheers

It’s a bit odd -40c might make sense as it’s the bottom of the range of the sensor but -49c. What reading do you get if you disconnect Vout from Imp? Wondering if it’s a dry contact and therefore was open circuit for that reading.

Yeah, a dry contact was my thought too. It hanging from the ceiling in my garage, I guess I need to get it down :expressionless:

Reference voltage fluctuation? Is it in an April?

It’s the sparkfun version of the April. With TMP36 being 10mv per degree C, a drop of 60 deg equates to 0.6v. Not sure whether that would be a decrease or increase in the ARef.

What is your power supply and voltage? VREF is tied to VCC on the April, and it has a buck regulator, and not boost, so if the input voltage dropped for some reason, I think you could see some odd readings, and still have the Imp up and running… but thats just a guess. You could log hardware.voltage() at the same to be sure.

Power supply is an iphone charger with mini usb cable plugged in. This could actually be happening frequently, but as I’m polling once per minute I don’t see it very often. Will try some testing code to log hardware voltage.

Thanks!

An iPhone charger seems like a pretty solid source. Is anything in the garage intermittently creating a heavy load on that AC circuit?

Are you on 27.9 yet? There were some conditions where the ADC could get reset incorrectly. I’m not sure if that would explain this, but would be interesting to see if you can get it to happen again with the latest version.

Been on 27.9 for a while. I was thinking about A/C load, then realised I’m actually using the Imp to do pulse counting on my electricity meter too, which I’m logging to Xively as well. Maybe if the temperature read coincides with a pulse count it does something?

Will do some testing!

opb how are you doing the pulse counting. Do you have a meter SO output or you using IR? Am I right your in the UK?

yep, UK here.

I bought the Optical sensiing kit for an OpenEnergyMon project that never got of the ground (RFM12B is really sucky) - http://shop.openenergymonitor.com/tsl257-optical-pulse-sensing-kit/

This is held in front of the red LED on my electricity meter using electrical tape. Device code has debounce in it:

`
pending <- false;
pulses <- 0;
cpin <- hardware.pin8;

function whenChanged()
{
if(!pending)
{
pending = true;
imp.wakeup(0.010, countPulse);
}
}

function countPulse()
{
if(cpin.read() == 1)
{
pulses++;
}
pending = false;
}
cpin.configure(DIGITAL_IN_PULLDOWN, whenChanged);
`

Convert pulses into kWh as per your meter - mine is 1000 pulses per kWh.

I’m uploading this to Xively and getting some pretty nice results. Also POSTing to emoncms.org.

Thanks for this, I’ve got an old mechanical meter so going to have to use a Current Transformer.

@controlCloud
Whell, I do have such an old meter as well, but I manged to use a little laser and a photodiode sensor to detect the black marker on the turning wheel

Dolf do you a list of hardware?

@controlCloud
http://dx.com/p/2-5mw-dot-laser-module-3v-46391
http://dx.com/p/arduino-650nm-laser-sensor-module-black-137473
http://dx.com/p/smart-car-photodiode-brightness-sensor-module-w-4-dupont-lines-blue-152006

for my gasmeter I use this one:

http://dx.com/p/tcrt5000-infrared-reflectance-2-channel-tracking-sensor-module-for-arduino-blue-151608

Dolf thanks for this lot’s googies on dx.com. With your gas meter are the sensors in some form of epoxy? of just taped on?

In the UK most “Human” meter readers just pull off home brew readers :). And for gas it needs to be intrinsically safe so that means adding a device called a chatter box. A project for the new year as I’ve just insulated the walls in two big rooms,

the sensors has been put in a little enclosure, which is hot-glued on the meter

Back to the original issue, I’m 99% sure this occurs when the Imp randomly goes offline and comes back online again:

2013-12-08 17:33:35 UTC+0: [Power State] Power state: online=>offline 2013-12-08 17:33:36 UTC+0: [Power State] Power state: offline=>online

Is there any more information available as to the reason it went offline? Also when it comes back online, what state is the program in? It doesn’t reboot, as I would see additional logging. My main program runs like this:

function doSomething() { //do stuff imp.wakeup(60, doSomething); } imp.wakeup(30, doSomething);

So on boot it effectively waits 30 seconds and then does its “do stuff” thing every minute. When coming back online from one of its random offline/online events, it waits 60 seconds and then the “do stuff” bit occurs. So where is it jumping back in on the offline->online event?

Hope this makes sense!

Thanks

Though this seems to be a lot less relevant to reading an analog voltage; I put code in my thermocouple monitor program so that the Imp would go offline while I was taking a reading, and then go back online to send the data. I was occasionally seeing strange readings, but I was also using SPI, which I would think would be a lot more susceptible to RF interference, if that is what it was. I have no strange readings now. I’ve been using my probe to log the temp in my wood stove recently… its pretty interesting to see how the draft affects the temperature.
In any case, maybe do a server.disconnect() before the temperature read?

Note: Your Imp will flash its LEDs when it reconnects. That freaked me out the first time I saw it… thought something was going wrong until I remembered that it would be normal behavior.