-
Revisiting a Project
07/24/2015 at 03:52 • 0 commentsI began this build process about two years ago and got stalled when I didn't have the free time to troubleshoot. Originally afraid it was destined for a Hackaday FAIL article, I've run across a few ideas that have given me hope. My apologies if these updates seem to be in reverse order.
Originally built to be completed quickly (sigh), the plan was to use an Arduino mega, as it had the required 48 digital pins, one for each chip select pin. The MAX31855 communicates via SPI so the only other pins needed are a clock, digital in, and digital out, and power. This is the first proof of concept to read 3 TCs into Labview over serial.
/*--------------------------------------------------------------------------------------- This sketch is intended as a proof of concept for running multiple TC breakouts through a mega board and read them into labview. It will read 3 TC breakout boards (MAX31855). * ---------------------------------------------------------------------------------------- // // +--####----------------------||||||--+ // | #### |||||| | // | #### |||||| | // | | // | +---| // | AERF| o | // | GND| o | // | 13| o | // |---+ 12| o | // | o |Reset PWM 11| o | // | o |3V PWM 10| o | // | o |5V PWM 9| o | // | o |Gnd 8| o | etc... // | o |Gnd |---| // | o |Vin 7| o | CS4 // |---| 6| o | CS3 // | o |1 A 5| o | CS2 // | o |2 N 4| o | CS1 // | o |3 A 3| o | CLK // | o |4 L 2| o | DO // | o |5 O TX 1| o | // | o |6 G RX 0| o | // +------------------------------------+ //------------------------------------------------------------------------------------- */ #include "Adafruit_MAX31855.h" //Declarations //TC breakout pins int thermoDO = 2; int thermoCLK = 3; int thermo1CS = 4; int thermo2CS = 5; int thermo3CS = 6; //set name & pins for TC breakouts Adafruit_MAX31855 Thermocouple1(thermoCLK, thermo1CS, thermoDO); Adafruit_MAX31855 Thermocouple2(thermoCLK, thermo2CS, thermoDO); Adafruit_MAX31855 Thermocouple3(thermoCLK, thermo3CS, thermoDO); //------------------------------------------------------------------------------------------ void setup(){ Serial.begin(9600); } //-------------------------------------------------------------------------------------------- void loop(){ //Read TC1 double T1 = Thermocouple1.readFarenheit(); if (isnan(T1)) { Serial.println("Something wrong with thermocouple 1!"); } else { Serial.print("Temperature 1 is "); Serial.print(T1); Serial.println(" F"); } //Read TC2 double T2 = Thermocouple2.readFarenheit(); if (isnan(T2)) { Serial.println("Something wrong with thermocouple 2!"); } else { Serial.print("Temperature 2 is "); Serial.print(T2); Serial.println(" F"); } //Read TC3 double T3 = Thermocouple3.readFarenheit(); if (isnan(T3)) { Serial.println("Something wrong with thermocouple 3!"); } else { Serial.print("Temperature 3 is "); Serial.print(T3); Serial.println(" F"); } //could insert a stop signal here to let labview know we've collected //all the data from one run through of the sensors delay(500); }
The code is fairly straightforward, and everything worked, so I ordered a full set of components.The first pass at the LabVIEW program is below. This does not have inputs yet to select which thermocouples are connected. Eventually the goal would be to auto-detect the presence of a thermocouple.