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

I couldn't work on this for a few days, but came back to it to try and figure out where I'm going wrong, and for the life of me I can't figure out what I'm doing wrong.

Using your example code I'm able to read (and save) data from a thermocouple to a text document with very little issue. The system still seems to stumble from time to time and I'll get a few seconds of data with random temperature spikes with high and low values, but in every case it jumps around for a bit, then goes back on track. It also gives me an error about 50% of the time when I try to run the VI saying it couldn't talk to the arduino, the other 50% it runs without issue.

I've also been able to read LM35 sensors and record their data with a simple VI I made myself - basically read a voltage, multiply by 100 then display the temp in degrees C. This seems very stable, and hasn't given me any issues.

When I combine these, however, I get results that make no sense to me. By adding an arduino read VI to your example code, for example, and multiplying it by 100 and displaying it, I get temperature readings of over 26000 degrees C (in a room around 22C). I've tried troubleshooting this, and it seems like the data coming out of the read VIs changes once the INIT VI is added outside the loop. If I remove this initialization VI, but leave the Get all Data VI, I cannot read the thermocouple, but the LM temperature values are then correct.

Is there any chance that the Arduino Resource is altered by the Initialization VI? I know that you said you couldn't think of a reason why this would be, but if removing that VI allows for the other arduino VIs to run normally, I can't think of what else I could be doing wrong. I've built the VI from scratch three times now, and the result is always the same. The only other thing that I've tried that may help, is that if I move the Init VI inside the loop, the LM temperature readings will jump (pretty much at every read point) from some huge value to the expected temperature, then back again. I haven't the faintest idea as to why.

Thank you very muchcircle.png

0 Kudos
Message 81 of 130
(6,520 Views)

I thought I figured this out but then realized that you probably have an earlier version of the library.  I have attached my latest version which likely won't fix anything.  It simply adds the ability to use multiple of these sensors.

Here is an example with version 2 along with a simpler, more efficent method (I believe) of writing to the file:

max31855_write_file.png

The Init VI for this simply sets 3 global variables holding the pins used for communication and sets their default values if needed.  You said that you tried removing the Init VI but you should try removing the Read All Data VI while leaving the Init VI in there so we can see if it's related to the reading of the actual data from the MAX (because when you don't do the init VI, the Get All Data VI will not work at all).  Let me know if you are getting good values from the LM35 when you remove only the Get All Data VI. 

Also, try using the Get TC Data Only VI instead of the Get All Data VI to see if that works better.

Message 82 of 130
(6,520 Views)

Your example looks much better - I'm still new to this whole LabView environment, so once I find something that works I kind of let it ride - thanks for the input. I'd love for the data not to get saved in reverse chronological order (like mine currently does) so this should help a lot.

So I tried running the most recent revision, and if I want to monitor just the thermocouple data it works great - I still had to do the wire swap from comment 35, but that's fine - seems to be an anomoly on my end. As far as adding in any other VI's though, if I add the read VI (to the example VI you made as it is) the thermocouple still works fine, but the readings from the LMs are off. By changing the Get All Data to Get TC Data, the value for the temperature of the LM is something like 7.5 E -6 (in a room around 22C), if I get rid of the TC VI blocks all together within the loop, but leave the Init VI outside the loop, the temperatures are in the 0.0007 range (and change up or down slightly... all pretty much with the same magnitude though)

0 Kudos
Message 83 of 130
(6,520 Views)

I am really confused about this.

Sammy, Ben, and/or Kevin, do you guys have any ideas why this would be happening?

0 Kudos
Message 84 of 130
(6,520 Views)

Nathan can you please tell me how to make this program work ? from the first step, i have arduino uno, labview 2013 and arduino software.All i need is step by step to make it run.I installed drivers for arduino and with a program i had made some tests and read temperature from a k type thermocouple live in arduino, but i want to make a labview VI that can show me graph and temperature live... PLEASE HELP ME !

0 Kudos
Message 85 of 130
(6,520 Views)

Based on gturner87's post, you can use the library that I created which is attached to post 81 but make the change stated in post 35.

0 Kudos
Message 86 of 130
(6,520 Views)

Can i also use these for MAX6675 - which things i have to change?

0 Kudos
Message 87 of 130
(6,520 Views)

Now i have include it into the Lifa Base. But i think it would better, to do this with the Labviewinterface.ino. And there is another problem with zero points in the measurement.

0 Kudos
Message 88 of 130
(6,520 Views)

To use it with LIFA, you either have to add new functions to LIFA (in LabVIEWInterface.ino and in LabVIEW using the Arduino library) or you can use the provided SPI VIs in LIFA.

0 Kudos
Message 89 of 130
(6,520 Views)

Could you help me to do this? I dont know but there is also a problem, because it works with fewer bits.

0 Kudos
Message 90 of 130
(6,520 Views)