Resolved: SD card shield affecting thermistor values

Hi all,

I’m working on a project that requires me to be able to read lots of thermistors (20 to be precise), so I’m having to use a multiplexer (specifically the Mayhew MUX II). The multiplexer shield sits on top of an adafruit data logger shield (SD card and RTC). These are both connected to an Arduino MEGA 2560.

So far I have been able to get the data logging shield to work fine (i.e. I can create a file and time stamp it). I have also been able to get the MUX II working (i.e. I can read one rail of 16 thermistor inputs and the results are seemingly stable and agree with a standalone thermometer).

Each thermistor is connected to a standard potential divider circuit (nothing fancy) with a 10k resistor. The code is written so that only one thermistor is read at a time (at least I hope that’s how it’s written!!).

The issue I have is that when I try to combine the two sets of code (so I can save the thermistor readings to a file), the data set goes completely wacky and registering mostly negative numbers. The readings are sometimes registering -273.15, but I know this is because the gauge or wire is too small for the connectors (yet to solder them up to a propper secure connector)- but this sorts itself out with a bit of wiggling of the sensors.

To try and problem solve this, I’ve combined both the RTC and SD card independently with the MUX code and determined that the issue arises as a result of the SD. I read that the 5V line on Arduino’s can be noisy as hell, so I have wired the supply for the thermistors to come from A ref too and I’m supplying it using 6xAA batteries (they are brand new too).

Below I’ve included the code for the SD card (includes RTC set up), the code that works for non-recording MUX code and the combined non-working code. If there’s anything else I can upload that may be helpful, let me know. Any suggestions or pointers as to where this is going wrong would be much appreciated as right now it seems my thermistor data logger would only be useful as a random number generator!!!

I had intended to include the working thermistor code, data logger code and combined failure code inline, but character limits has meant I have to include as an attachment.

Original sources for the code are:

MUX library (/ example)
Data logger
Thermistor

Any help is sincerely appreciated as I have no idea where to go from here and my Google-fu skills haven’t helped me so far.

combined_failure.ino (6.88 KB)

MuxShield_multi_therm_working_basic.ino (1.03 KB)

timer_datawrite_v1.ino (3.4 KB)

So it turns out that this was actually a hardware issue, not software. The MUX shield uses digital pins 2,4,6,7,8,10,11 & 12 which clashes with the adafruit logging shield on dig pins 10, 11 & 12.

To get around this, you need to cut some traces and solder some bridges (as shown in this link: http://mayhewlabs.com/media/Mux_Shield_II_User_Guide.pdf)

Hopefully this might help anyone in the future, and a useful lesson for me in the future to write down the pins being used by different components and spot conflicts ahead of time!