LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading SPI of MAX31855

Solved!
Go to solution

I got it by pulling the thermo couple so I would have a known value sent by the chip. When there is no TC plugged in the TC data is all 1's and the first bit is one for open. 0111 1111 1111 1101 XXXX XXXX XXXX 0001 is what you would see if there is no TC where X is the CJC data. then I made the outputs display as hex and read it from there to get what order the lines should be in. The next thing that would be nice is to be able to set the CS pin in the read command so that multiple chips can be placed on the same SCK SO and each read command can select a different chip when they are placed one behind the other. Does that make sense?

lab12.JPG

lab11.JPG

0 Kudos
Message 41 of 130
(4,927 Views)

also if you just want the temp data and a cumulative fault bit you can read  16 bits from the chip and bring up the cs line. that would be a great option for people who don't need to know the CJC temp or the exact fault. it should make for faster less complicated code.

lab13.JPG

0 Kudos
Message 42 of 130
(4,927 Views)

But, the bytes should be in order.  It's as if the sensor is sending them out of order.  I will add another function to do just the TC temp and error bit.  Then, you can test it like that and see if it actually returns like it should.

Give me a few minutes.

0 Kudos
Message 43 of 130
(4,927 Views)

I've added the function to get only the TC temp with error bit.  Let me know if it works correctly.

When we get this part of the library 100% working, we can look into adding the multiple TC sensors.

0 Kudos
Message 44 of 130
(4,927 Views)

I'm gonna open yours next have a look at mine and what I did in the code to make it work

0 Kudos
Message 45 of 130
(4,927 Views)

Samething that I did, essentially, for just the TC data except you failed to include the LIFA firmware.

0 Kudos
Message 46 of 130
(4,927 Views)

You two were real helpers in need...

For me, everything is working now as intended.

Thank you both for your kind help.

0 Kudos
Message 47 of 130
(4,927 Views)

One more thing:

as I wrote in the beginning, I need to read out a type S TC, not a type K one; unfortunately, these are the most nonlinear from all TCs. To make that work, I took a look at the Extract TC Temp.vi, and now I ask myself why you multiply the read data with 0.25; is it because the MAX31855 resolves temp. to 0.25°C?

So, now I have to correct the read data, because the MAX assumes a linear relationship between temp. and voltage, what is more or less true for type K TC, but not at all for type S - as mentioned. That means that I'm correct at 1000°C, but consequently off to about 50°C up to 900°C - and that's a serious error. It would have been best if the MAX just gave out the amplified voltage, but unfortunately it doesn't. Or am I wrong and it is possible to read out the raw voltages from the MAX?

If not: is there a common data correction routine four type S TCs you know of and I don't? (So I don't have to come up with something that may be already some kind of common knowledge…)

0 Kudos
Message 48 of 130
(4,927 Views)

Theophrastus wrote:

You two were real helpers in need...

For me, everything is working now as intended.

Thank you both for your kind help.

Could you specify exactly which set of VIs that you are using?  There is so many posted in this thread.  I just want to make sure that I can finalize something and post it as a document.

0 Kudos
Message 49 of 130
(4,927 Views)

Theophrastus wrote:

One more thing:

as I wrote in the beginning, I need to read out a type S TC, not a type K one; unfortunately, these are the most nonlinear from all TCs. To make that work, I took a look at the Extract TC Temp.vi, and now I ask myself why you multiply the read data with 0.25; is it because the MAX31855 resolves temp. to 0.25°C?

So, now I have to correct the read data, because the MAX assumes a linear relationship between temp. and voltage, what is more or less true for type K TC, but not at all for type S - as mentioned. That means that I'm correct at 1000°C, but consequently off to about 50°C up to 900°C - and that's a serious error. It would have been best if the MAX just gave out the amplified voltage, but unfortunately it doesn't. Or am I wrong and it is possible to read out the raw voltages from the MAX?

If not: is there a common data correction routine four type S TCs you know of and I don't? (So I don't have to come up with something that may be already some kind of common knowledge…)

0.25°C is the resolution stated in documentation. 

I can only assume, since there is a special sensor for each type, that it should compensate for each specific type of TC.  If it didn't, then it would be a worthless sensor.

You cannot get the voltage data from this sensor.

Can you do what Lex did and tell me the number that you get for the raw data when you unplug the TC? Using my VIs.

0 Kudos
Message 50 of 130
(4,927 Views)