Please be aware of all shipping deadlines before placing your order - we cannot guarantee orders will arrive before Christmas!

Using Arduino Due with MAX31855 thermocouple amplifier
Moderators: adafruit_support_bill, adafruit

Using Arduino Due with MAX31855 thermocouple amplifier

by sungsuk on Thu Oct 31, 2013 8:24 am

Hi, I am having a hard time using MAX31855 thermocouple amplifier with Arduino Due for school project. I just need serial data outputs(temperatures) and it doesn't matter if I uses normal digital pins or SPI pins. Since I am an mechanical engineering student, I have limited experience with programming.
I know libraries of MAX31855 (https://github.com/adafruit/Adafruit-MAX31855-library) are based on AVR like for Mega and Uno so they are not working with Due which uses ARM.
I have been trying to modify the following codes but all of them didn't work.

1. http://forum.arduino.cc//index.php?PHPS ... c=150629.0
This guy uses SD card and it doesn't shoots outputs.

2. http://forum.arduino.cc//index.php?PHPS ... c=150351.0
The first two codes look OK for me but it just shoots 0 after three loops. Also, the first output that he got (1000000010000000100000001) looks like digital output data which are not converted to decimal numbers.
The last code didn't work at all.

I know converting AVR based libraries to ARM based libraries is very challenging. Is there any way that I can run MAX31855 with Due?
Thank you.
sungsuk
 
Posts: 8
Joined: Fri Aug 30, 2013 5:03 pm

Re: Using Arduino Due with MAX31855 thermocouple amplifier

by adafruit_support_rick on Thu Oct 31, 2013 11:08 am

We are working on porting our libraries to the Due, but we haven't done the MAX31855 yet. We have no ETA. Sorry.

adafruit_support_rick
 
Posts: 14521
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: Using Arduino Due with MAX31855 thermocouple amplifier

by franklin97355 on Thu Oct 31, 2013 1:44 pm

Page 8 through 10 of this document http://www.adafruit.com/datasheets/MAX31855.pdf should give you the information to get the raw data from the MAX31855 and then you can manipulate it as necessary for your project.
User avatar
franklin97355
 
Posts: 6201
Joined: Mon Apr 21, 2008 2:33 pm

Re: Using Arduino Due with MAX31855 thermocouple amplifier

by sungsuk on Fri Nov 01, 2013 3:38 am

Thank you for fast reply. I inseted "Serial.println(data.bit8[i]);" in the setup and got outputs as following.

1000000010000000100000001
1
1
1
1
1000000010000000100000001
1
1
1
1
1000000010000000100000001

and when I changed the temperature(touching thermocouple), I got like this

0
0
0
0
0
0
0
0

Since the binary numbers stay same, I guess the raw data does not represent the temperature. How do you think?
Code: Select all | TOGGLE FULL SIZE
#include <SPI.h>

union FourByte{
    unsigned long bit32;
    unsigned int bit16[2];
    unsigned char bit8[4];
};

int SlavePin1 = 10; //Thermocouple #1
long unsigned data;

void setup() {
  Serial.begin(9600);
  pinMode(SlavePin1, OUTPUT);
  digitalWrite(SlavePin1, HIGH); //Disable SS
  SPI.begin(SlavePin1);                // Setup SPI to use pin 4 as CS.
  SPI.setBitOrder(MSBFIRST);
  SPI.setDataMode(SlavePin1,1);        // Use SPI Mode 1 (CPOL = 0, CPHA = 1)
  SPI.setClockDivider(SlavePin1, 21);  // Set SPI Clock divider to 21.(4MHz)
 
}

unsigned long transfer(unsigned long value){
  FourByte data = {value};
  for(byte i = 0; i < 4; i++){
    data.bit8[i] = SPI.transfer(SlavePin1, data.bit8[i]);
     Serial.println(data.bit8[i]);
    delay(1);
  }
  return data.bit32;
}

void loop() {
  digitalWrite(SlavePin1, LOW);
  unsigned long someValue = 0xFFFFFFFEUL; //No MOSI on MAX31855, dosent matter what is sent.
  data = transfer(someValue);
  Serial.println(data, BIN);
 
  digitalWrite(SlavePin1, HIGH);
  delay(1000);
}
sungsuk
 
Posts: 8
Joined: Fri Aug 30, 2013 5:03 pm

Re: Using Arduino Due with MAX31855 thermocouple amplifier

by federico.belfi on Tue Dec 10, 2013 4:51 pm

Hello,
still no news about? I have two thermocouple and i must read to do a PID controller. Using an Arduino DUE :D

Thank you for the help.

Bye
federico.belfi
 
Posts: 1
Joined: Tue Dec 10, 2013 4:44 pm

Re: Using Arduino Due with MAX31855 thermocouple amplifier

by adafruit_support_rick on Fri Dec 13, 2013 12:14 pm

Try the attached version of the library and see if it works for you:
Attachments
Adafruit_MAX31855_Due.zip
(8.8 KiB) Downloaded 38 times

adafruit_support_rick
 
Posts: 14521
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY