From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading SPI of MAX31855

Solved!
Go to solution

You say that you have a "working sketch for sending serial data" but does it show the correct temperature?  This is the most important part since you say that the LabVIEW code does not show the correct temp.

0 Kudos
Message 11 of 130
(6,176 Views)

yes it does read correctly. I think the error is in how the spi is being read insted of getting 32 bites of the whole code I think I am getting the first 8 bites 4 times becouse the cs is being pulled high between 8bit bytes. how do I make spi keep cs low threw the entire read.

0 Kudos
Message 12 of 130
(6,176 Views)

I think I found an error in SPI readwrite but I don't know how to fix it.

the error is in how it decides to run the true or false loop. it takes the array size and in bytes and compares it to the packet size in bits then falles apart from there.

spi1.JPG

spi2.JPG

0 Kudos
Message 13 of 130
(6,176 Views)

After studying two different Arduino sketches for this sensor, I've determined that the real issue is that the sensor does not actually use the [standard] SPI protocol and this would explain why the LabVIEW SPI functions don't work.  We will have to create a custom version of LIFA (AKA add a function specifically for this).

As far as your claim there is something wrong with SPI Send Receive, it is not wrong, it is comparing bytes to bytes.

0 Kudos
Message 14 of 130
(6,176 Views)

Dear LexLuther and Nathan,

I have to implement this chip as it is the only one to read type s thermocouples - but I can't solve the problem on my own, as I'm not good enough at programming in LabView. But I'm willing to pay for a solution to this.

Nathan, you wrote:

We will have to create a custom version of LIFA (AKA add a function specifically for this).

Is there a reallistic chance that it will come to that? That is to say: will this specific function be availlable in the near future?

Any help concerning this topic would really be highly appreciated!

0 Kudos
Message 15 of 130
(6,176 Views)

NathanB if this is added to LabViewInterface with #include MAX31855.h in the begining could you make a vi that will send command2 = SCK command3 = SS command4 = MOSI command5 = bool 0 = Celsius, 1 = Fahrenheit then read the buffer for the returned values.

    /*********************************************************************************

    ** MAX31855

    *********************************************************************************/     

    case 0xF0:    // MAX31855 read

      // Setup the variables we are going to use.

      double tempTC, tempCJC;

      bool faultOpen, faultShortGND, faultShortVCC;

      // Init the MAX31855 library for the chip.

      MAX31855 temp(command[2], command[3], command[4]);

      Serial.write(temp.readMAX31855(&tempTC, &tempCJC, &faultOpen, &faultShortGND, &faultShortVCC, command[5]));

      break;

something like this

max9.JPG

0 Kudos
Message 16 of 130
(6,176 Views)
Nathan, you wrote:

We will have to create a custom version of LIFA (AKA add a function specifically for this).

Is there a reallistic chance that it will come to that? That is to say: will this specific function be availlable in the near future?

I can write it for you but note that this assumes that the Arduino sketch that my code is based on works correctly.  Once I get it done, you will need to test it for me as I will not be able to do it.

EDIT:  I just now noticed there was another post on the second page.  I'll look over your code and and see what I can do (I'm sure I can do it since I've only done stuff like this a million times it feels like lol).

0 Kudos
Message 17 of 130
(6,176 Views)

I can write it for you but note that this assumes that the Arduino sketch that my code is based on works correctly.  Once I get it done, you will need to test it for me as I will not be able to do it.

Nathan, you're my hero! 🙂

Thanks a lot for your help. I'll test it as soon as I get it from you...

0 Kudos
Message 18 of 130
(6,176 Views)

Ok, here it is.  It will only get the thermocouple temperature at the moment and does not do any error checking.  After you test it and confirm that it works then I can add more functionality to it.

-- Attachment Removed -- See later post for latest version.

0 Kudos
Message 19 of 130
(6,176 Views)

If you want Nathan I can send you one of my breakout boards for testing. It is a board I designed for prototypers I'm gonna be selling it on eBay soon. still assembling more got 100 boards o.O

0 Kudos
Message 20 of 130
(6,176 Views)