MATLAB Answers

Matlab cannot read data from MAX6675 through Arduino

조회 수: 18(최근 30일)
I tested a MAX6675 module using "max6675.h" library on Arduino IDE to measure temperature with type K thermocouple. It worked well.
Then I connected Arduino UNO with Arduino Support Package in Matlab to read data from the MAX6675 module.
And I set SPI object:
This was what command window showed:
Matlab support 01.png
I tested the reading with these commands:
And the result was:
Matlab support 02.png
It is not possible those values. Temperature in the room is tipically 19°C. The result must be [0 76] or something like that. I used a digital multimeter to test "CS" and "D10" pins and voltage remained in high state while "writeRead" function was executed. It should change from high to low level according to SPI protocol during reading operation on MAX6675.
What am I doing wrong?

  댓글 수: 1

As I needed to read the temperature from module MAX6675, and I had no time, I decided no to use the Arduino Support Package in Matlab. Instead, I wrote a code directly on the Arduino IDE to communicate it with a PC. In that sketch, Arduino acquires temperature value from the module, and then it sends it to the PC via the serial port. In Matlab, I used the "serial" function to manage the data interchange.
I hope someone with time and knowledge can solve the problem with the MAX6675 and SPI object of the Arduino Support Package, and then share the solution with us.

Sign in to comment.


Daniel Melendrez
Daniel Melendrez 4 Dec 2019
편집: Daniel Melendrez 4 Dec 2019
I am working at the moment on a big project that uses the MAX6675. Here are some pieces of advice based on my experience:
  1. I would delegate the full data conversion to the Arduino itself. Do not use Matlab to convert the data. Meaning that I would only use Matlab for reading the converted value and displaying it in the console or in a plot.
  2. Don't forget that each conversion time is about 250 ms (read the datasheet, page 2), therefore, you need to query Arduino if the conversion is ready after this time. In my application I implemented a serial query routine that "spits out" the temperature value once it's ready.
Hope this helps for now

  댓글 수: 0

Sign in to comment.




Translated by