Fjodor and I started out Day 13 by starting again on the lab, hoping to go through laboratories #2 and #5, the labs we will be running with our group of teachers next week. We started our the day going to the laboratory and working on Laboratory #2.
When we started Lab #2, our Temperature Sensor Lab, it ended up being that they had someone solder the MAX6675 to some breakout boards. Fjodor and I hadn’t ever soldered, so we learned and tried to make our prototype.
Our board uses an Arduino to interface with the computer and give us a temperature output. We started by using last year’s script, but because Arduino has since updated their library, that script wasn’t working. In fact, it wouldn’t even compile.
We ended up finding another script online, which still wasn’t compiling. It ends up that the script was using SCK, which is now an Arduino library. We found and replaced SCK with CLK, and the script compiled.
We were, however, still receiving an interesting output- about 270 degrees Celsius. We kept trying to figure out why it was so high, but we couldn’t figure out why it was so off.
For the rest of the day, I recoded the script to get it to work. Around 4:45 pm, I ended up realizing that it was reading off by a decimal point. It should have been 27.0 degrees Celsius, not 270 degrees Celsius! I quickly recoded the solution, and it worked!
Here is our script for the MAX6675 temperature sensor with K-type thermocouple
/* Modified By Jason DeFuria, BUSAT <[email protected]> on 7/19/2012 Ryan McLaughlin <[email protected]> #define SO 12 // MISO #define TC_0 11 // CS Pin of MAX6607 void setup() { pinMode(SO, INPUT); pinMode(TC_0, OUTPUT); Serial.begin(9600); /* Create a function read_temp that returns an unsigned int Usage: read_temp(int pin, int type, int error) for (int i=samples; i>0; i–){ /* Cycle the clock for dummy bit 15 */ /* Read bits 14-3 from MAX6675 for the Temp /* Read the TC Input inp to check for TC Errors */ digitalWrite(pin, HIGH); //Disable Device value = value/samples; // Divide the value by the number of samples to get the average /* */ value = value + error; // Insert the calibration error value if(type == 0) { // Request temp in ˚F temp_out = temp; // Send the float to an int (X10) for ease of printing. /* Output 9999 if there is a TC error, otherwise return ‘temp’ */ void loop() { // Read the temperature and print it to serial delay(250); |
Here are some pictures:
Our setup connected with an Arduino Uno
Running Arduino on my Mac