SD-Card + temperature sensor don't like each-other?

Here is a pure mystery. I would like to have some explanation, if you have any!

On my Panda, I am reading temp sensor (TMP38) using analog input. It works well.
On my Panda, I have added a SD-Card reader, soldered by myself. It works well.
But as soon as I use both (for data-logging my temp), the temp sensor measures wrong temperatures like -40°C!

The temp sensor becomes wrong right after I call this in my code:
PersistentStorage ps = new PersistentStorage(“SD”);
I don’t even have to mount the file system to have the temperature getting wrong!

I thought it was due to a magnetic field generated by SD-Card / SD-card reader, but I checked my HMC6352 Compass and it works well with SD-card running… So I think it is not an issue a mag field.
I have verified :
=> input voltage at temp sensor input is OK. 5V
=> It is not a bug in AnalogIn reading. The output voltage of temp sensor is abnormally low.

Strange isn’t it?
Any idea?

Mathieu

Is this happening when powered over usb? Did you tried using an external power supply?

This is strange!

how are you measuring 5V and sensor output (what’s your ground lead hooked to)?

@ Erisan : I have tried with 9V battery. The result is different (and more vicious) : I get only 1° difference between with and without new PersistentStorage(“SD”);
Here is my log (fist number are seconds)
********** TEMP BEFORE MOUNTING = 20.5°C
19 18.182003°C
20 19.0359974°C
21 18.0519981°C
22 18.1980038°C
23 18.5499992°C
24 18.1040001°C
25 18.0480022°C
26 18.5460052°C
27 19.1420021°C
29 19.0240021°C
30 19.0680046°C
31 19.0420074°C

@ WhysItSmoking :
TMP38 has 3 pins : GND, 5V, out
To measure 5V : I check with my multimeter 5V & GND
To measure output : I check out & GND
TMP38’s GND & 5V are connected directly to Panda pins. “Out” is connected to An1

Note : I have tried to Dispose my PersistentStorage instance. No effect. Since it has been instancied, it’s too late (It shows that PersistentStorage’s Dispose does not dispose all its ressources)

I was thinking a little more about this.

If the TMP38 is an analog sensor (ie I don’t have one and a datasheet search didn’t really show a lot of easy-to-find info), then there’s a chance what you’re seeing is related to the issues we’ve seen discussed to some SD cards needing higher current filtering capacitors than you get by default. That may be enough to cause the general power on the board to be somewhat dirty, which could easily affect ADC readings. If you have a different brand of SD card, could you try inserting that as well?

Can you also do a more detailed before/after logging of temperatures, so do say groups of 10 samples averaged, and show say 5 of those; then intsantiate the PersistentStorage() and do another 5 groups of 10; see if that still shows a dramatic change in readings?

Are you sure the voltage going to fez from your sensor is less than 3.3V?

@ Brett : I will check this out tomorrow because I don’t have a 2nd SD-Card right now but it is definitly a good idea.

@ Gus : Yes I’m sure, I measured something like 0.3V with my multimeter. The measured voltage was in accordance with my Log.

Make sure you have a strong ground connection from both your sd card and temp sensor.