Reading multiple thermocouples from a micro - Page 1
Forum section: electronics / beginners

author: mindcrime
author_rank: Unknown
timestamp: May 11, 2021, 03:03:49 am
content: Folks:As part of myreflow oven projectI've started working with reading thermocouples from an Arduino, using the Adafruit max31856 board. This works a treat, and if I only wanted to read one thermocouple I wouldn't really have any question. But two possibilities occur to me:1. I might want to put multiple thermocouples in the cooking compartment, to help me detect thermal imbalances.2. I might want to put one outside of the cooking compartment, in the case area where the electronics live, to detect excessively high temperatures and shut down (or sound an alarm).It seems self evident that I could buynof the max31856 boards and use them withnthermocouples, wired up just like the existing one. But this has some problems - not the least of which is running out of digital pins for interfacing with all those boards.So I'm pondering a couple of questions:1. Could I use multiple max31856's with some multiplexing logic between them and the Arduino. I can't see any obvious reason at first blush why this couldn't work. The one disadvantage I see is the cost of multiple amplifier boards, but that's not necessarily a huge deal.2. Could I use one max31856 board, and implement some switching/multiplexing logic between the thermocouples and the amplifier board? I've found some references online to other people doing this, so it seems to be possible in principle. My main concern here is any possible effect on the temperature readings, caused by adding more resistance between the thermocouple and the amplifier. Still, if such an effect is small enough I can just ignore it, or if it's larger but is at least a constant factor, I can just compensate in software. The only way this becomes an issue, I think, is if the effect is both large (more than a couple of degrees, probably) and non-linear or otherwise hard to model.Given those thoughts, I'd appreciate any input from you all, regarding with solution makes the most sense, if either. Or if there's another way altogether that I've missed. I doubt I'd ever want to read more than say, 4 or 5 thermocouples, and I don't need incredible accuracy here. A deviation of even a whole degree or two is probably acceptable, especially if it's easy to fix in software.Thoughts?

author: David Hess
author_rank: Super Contributor
timestamp: May 11, 2021, 03:54:40 am
content: Quote from: mindcrime on May 11, 2021, 03:03:49 amThermocouples can be multiplexed with the usual precautions of adding additional junctions. The problem is not resistance so much as each junction of dissimilar metals creating another thermocouple junction, so it is important to keep everything symmetrical and isothermal for best accuracy. Either relays or analog multiplexers work fine for this.

author: rstofer
author_rank: Super Contributor
timestamp: May 11, 2021, 03:57:48 am
content: How about something like this:https://www.adafruit.com/product/4101The serial bus is I2C instead of SPI so only a two wire interface is required and 16 boards can be on the same bus.

author: ledtester
author_rank: Super Contributor
timestamp: May 11, 2021, 04:01:50 am
content: QuoteThe Adafruit board uses SPI with a CS (chip select) signal. To use multiple modules just assign the CS line from each module to a different GPIO pin on your microcontroller as the other SPI lines can be shared.This article show how this "multi-slave" configuation works:https://www.analog.com/en/analog-dialogue/articles/introduction-to-spi-interface.html

author: mindcrime
author_rank: Unknown
timestamp: May 11, 2021, 05:37:40 am
content: Quote from: ledtester on May 11, 2021, 04:01:50 amAaaah, well that's excellent then. I don't know much about how SPI works yet, so had no idea that was even a possibility. I'll definitely look into that.

author: mindcrime
author_rank: Unknown
timestamp: May 11, 2021, 05:39:11 am
content: Quote from: rstofer on May 11, 2021, 03:57:48 amGood point. I was thinking about the max31856 board only because that's the one I already have. I'll look into this as a possibility as I proceed down this path. Thanks!

author: mindcrime
author_rank: Unknown
timestamp: May 11, 2021, 05:52:07 am
content: Quote from: David Hess on May 11, 2021, 03:54:40 amAwesome, that's handy to know. Thanks for the help!

author: Terry Bites
author_rank: Super Contributor
timestamp: May 11, 2021, 11:28:50 am
content: seehttps://oceancontrols.com.au/files/datasheet/ocean/KTA-259v4_Thermocouple_Mux_Shield.pdfexample code too. You didnt hear this from me.http://www.emesystems.com/OLDSITE/OL2therm.htmor go mad:https://www.analog.com/en/parametricsearch/11146#/10, 20 chanel

author: jpanhalt
author_rank: Super Contributor
timestamp: May 11, 2021, 12:27:48 pm
content: I have been using the MAX31856 both with a development board and later with a bare chip for a project. I use it in one-shot mode with a K-type TC and average 4 conversions per data acquisition. You will notice that there are two outputs (!DRDY (data ready) and !Fault (fault)) that can be read. That is, reg 0x01 is written with 0x23 (4 samples and K-type TC) in set-up, and reg 0x00 is written with 0x42 for each read.The reason to use 0x42 in reg. 0x00 is to clear any fault. It can hang, if there is a fault that is not cleared. So, be sure to include some escape. Early on, I only wrote 0x40, and it usually worked, but if I did any manipulation of the TC, I could make it hang.

author: Zero999
author_rank: Super Contributor
timestamp: May 11, 2021, 12:46:45 pm
content: I wonder if the thermocouples could be connected to the amplifier, via an analogue multiplexer such as the 74HC4051, or 74HC4052.https://assets.nexperia.com/documents/data-sheet/74HC_HCT4051.pdfhttps://assets.nexperia.com/documents/data-sheet/74HC_HCT4052.pdf

author: Kleinstein
author_rank: Super Contributor
timestamp: May 11, 2021, 01:14:02 pm
content: Those CMOS multiplexers should be OK. If used with low thermal gradient, there is very littler extra thermal EMF. One may need to keep the chips away from heat soruce. The low poser consumption of the CMOS chips helps.If the thermocoules have no additionsl connection to each other one side could be connected directly and the 4051 would be OK.The slightly tricky part is to get the max31856 to sense the right cold junction temperature. Usually this is the point where the thermocouple wired go to copper traces / wire.This may need some free wired / dead bug style connctions with a ready made baord for the max31856.

author: jpanhalt
author_rank: Super Contributor
timestamp: May 11, 2021, 01:28:27 pm
content: The MAX31856 has an internal temperature detector. I don't have a clue where it is on the die, but I have found that shielding the chip from air currents gives more stable readings. That temperature can be read (read only registers) and an offset can be changed. One does not need to use that internal cold junction, but for the purposes of this project, I suspect it is accurate enough assuming the chip is not appreciably heated by the oven.

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 13, 2021, 01:12:28 am
content: Thermocouples do not measure absolute temperature. They only measure a temperature difference between the hot and the cold junction, and the cold junction is typically the thermocouple is connected to the PCB, in combination with all the copper tracks, solder joints and whatever else you put in between.The Hot end temperature is always calculated by converting the voltage generated by the thermocouple to some temperature difference and then adding the temperature of the "cold" end to it.So if you want an accurate, reliable and repeatable measurement, then keep the thermocouple connector and the measurement chip close together on the PCB and also put some kind of heat isolation around the PCB in that area and keep any chips that cause temperature differentials as as far away as possible.If you're curious or just want to learn, then build a few different circuits and do some measurements to compare results.And indeed, using a thermocouple IC for each sensor is the easiest with the least room for errors to creep in.I would also use a 4052 and switch both thermocouple wires, just to keep it symmetrical and reduce errors. It's a cheap chip and there is no need to shave of pennies for a hobby project, especially if it reduces reliability (which can cost you a lot of debugging time, or re-design and soldering)