Hi Folks
I am working a project that consists of an UNO and SD Logger along with a MAX 6675 just for temp recording at this time.
Hardware:
I want to mount the MAX on the Logger, so I ordered up so Female header stock to be placed on the DL.
Software:
Was hoping that some one has worked the Code for this to assist me in the learning curve,,, hope hope ....
If not, the problem currently is with the code for the logFile and dataString, well at least i believe this is where the problem is located ????
If I could see the script or sketch of the for mentioned (UNO, SD dataLogger and the MAX it would really help..
Thanks in advance
Bill
If I could see the script or sketch of the for mentioned (UNO, SD dataLogger and the MAX it would really help.
Open the Arduino IDE. Create a new sketch. Close your eyes and start typing. When you are done, open your eyes. Then, you'll be able to see the sketch.
It's really unlikely that anyone has used your particular combination of equipment with the exact same connections to record exactly the data that you are interested in.
Some links to the devices you have (except the UNO - we know what that is), and some description of how they are connected, would make it easier to provide some useful direction.
Surely Paul
BTW... Seattle.... I on the East side of the state from you about 105 mile NW of Spokane
Links to components
SD Data Logger Adafruit Data logging shield for Arduino [v1.0] : ID 243 : $24.80 : Adafruit Industries, Unique & fun DIY electronics and kits
MAX6675 Thermocouple Amplifier MAX31855 breakout board (MAX6675 upgrade) : ID 269 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits
K-Type Themocouple Thermocouple Type-K Glass Braid Insulated [K] : ID 270 : $9.95 : Adafruit Industries, Unique & fun DIY electronics and kits
The sketches are combined from adalady's and J. Blum # 11 tutorials
Please see inserted
include <SD.h> //SD Card Library
#include <SPI.h>
#include <Wire.h> //I2C Library
#include <max6675.h> // max Library
//SPI SD Card Pins
//MOSI = Pin 11
// MISO = Pin 12
// SCLK = PIN 13
int CS_pin = 10;
int pow_pin = 8;
int thermoDO = 4;
int thermoCS = 5;
int thermoCLK = 6;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO); //Max6657 board
int vccPin = 3;
int grdPin = 2;
//I2C Temperature Pins
//SDA = Analog Pin 4
//SCL = Analog Pin 5
//IR Distance Sensor Pins
// int IR1_pin = 2;
// int IR2_pin = 3;
//Light Sensor Pins
// int light_pin = 1;
float refresh_rate = 0.0; //Datalogger Refresh Rate
//int temp_address = 72; //Address of the I2C Temp Sensor
//long id = 1; //Use this to store the id # of our reading.
void setup()
{
//Wire.begin();
Serial.begin(9600);
Serial.println("Initializing Card");
//CS Pin is an output
pinMode(CS_pin, OUTPUT);
//SD Card will Draw Power from Pin 8, so set it high
pinMode(pow_pin, OUTPUT);
digitalWrite(pow_pin, HIGH);
pinMode(vccPin,OUTPUT); digitalWrite(vccPin, HIGH); //Max Power pin 3
pinMode(grdPin, OUTPUT); digitalWrite(grdPin, LOW); // Max Grd pin 2
//*{Serialprintln("MAX6657 test") //wait for Max Chip to stablize
//*delay(500)}
//Initialize Card
if (!SD.begin(CS_pin))
{
Serial.println("Card Failure");
return;
}
Serial.println("Card Ready");
//Read the Configuration information (COMMANDS.txt)
File commandFile = SD.open("COMMANDS.txt");
if (commandFile)
{
Serial.println("Reading Command File");
float decade = pow(10, (commandFile.available() - 1));
while(commandFile.available())
{
float temp = (commandFile.read() - '0');
refresh_rate = temp*decade+refresh_rate;
decade = decade/10;
}
Serial.print("Refresh Rate = ");
Serial.print(refresh_rate);
Serial.println("ms");
commandFile.close();
}
else
{
Serial.println("Could not read command file.");
return;
}
//Write Log File Header
File logFile = SD.open("LOG.csv", FILE_WRITE);
if (logFile)
{
logFile.println(", , , ,"); //Just a leading blank line, incase there was previous data
String header = " Temp ";
logFile.println(header);
logFile.close();
Serial.println(header);
}
else
{
Serial.println("Couldn't open log file");
}
}
void loop()
{
//Check Light Level
// int light_level = analogRead(light_pin);
//Read Temperature
//Wire.beginTransmission(temp_address); //Start talking
Wire.send(0); //Ask for Register zero
Wire.endTransmission(); //Complete Transmission
// Wire.requestFrom(temp_address, 1); //Request 1 Byte
//while(Wire.available() == 0); //wait for response
//int temp_c = Wire.receive(); // Get the temp
//int temp_f = round(temp_c*9.0/5.0 +32.0); //Convert to stupid American units
//Read Distances
//int IR1_val = analogRead(IR1_pin);
//int IR2_val = analogRead(IR2_pin);
//Create Data string for storing to SD card
//We will use CSV Format
// String dataString = String(id) + ", " + String(temp_f));
//Open a file to write to
//Only one file can be open at a time
File logFile = SD.open("LOG.csv", FILE_WRITE);
if (logFile)
{
logFile.println(dataString);
logFile.close();
Serial.println(dataString);
}
else
{
Serial.println("Couldn't open log file");
}
//Increment ID number
//* id++;
delay(refresh_rate);
}
Boy I want to thank all folks for the great assistance. Funny thing is, I persevered and made progress XD
Thanks alot !
zackie:
hello..hai everyone.i am new here.guys can i ask you something about this sensor? actually i am using thermocouple MAX6675 in my project connect with arduino mega 2560. i want to measure the substance in my project that have a temperature around 150-200 degree celcius.. when my thermocouple detect the temperature,my motor will start to move. i am just using dc motor.. just control the direction of motor.i don't control the PWM of my motor..that is the reason i just connect my PWM to the digital output.and i already test only the code for the motor..and it already works.so now i just want to insert my function of motor when my thermocouple detect the temperature between 150-200..thats all.. but the problem is, i dont know how i want to fix this code so that at 150 to 200 celcius my motor will start to move..can you help me??// this example is public domain. enjoy!
// www.ladyada.net/learn/sensors/thermocouple
#include <max6675.h>
#include <LiquidCrystal.h>
#include <Wire.h>
int thermoDO = 29; //so
int thermoCS = 30; //cs
int thermoCLK = 28; //sck
int PWM1 = 34; // speed of motor
int DIR= 4; // Direction (cw/ccw) of motor
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
int vccPin = 3;
int gndPin = 2;
LiquidCrystal lcd(22,23,27,26,25,24);
// make a cute degree symbol
uint8_t degree[8] = {140,146,146,140,128,128,128,128};
void setup() {
Serial.begin(9600);
// use Arduino pins
pinMode(vccPin, OUTPUT); digitalWrite(vccPin, HIGH);
pinMode(gndPin, OUTPUT); digitalWrite(gndPin, LOW);
pinMode(PWM1, OUTPUT); //for motor
pinMode(DIR, OUTPUT); //for motor
lcd.begin(16, 2);
lcd.createChar(0, degree);
// wait for MAX chip to stabilize
delay(500
);
}
void loop() {
// basic readout test, just print the current temp
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("MAX6675 test");
// go to line #1
lcd.setCursor(0,1);
lcd.print(thermocouple.readCelsius());
#if ARDUINO >= 100
lcd.write((byte)0);
#else
lcd.print(0, BYTE);
#endif
lcd.print("C ");
lcd.print(thermocouple.readFahrenheit());
#if ARDUINO >= 100
lcd.write((byte)0);
#else
lcd.print(0, BYTE);
#endif
lcd.print('F');
delay(1000);
}
void motor()
{
digitalWrite(DIR,LOW);
digitalWrite(PWM1,HIGH);
delay(3000);
digitalWrite(DIR,HIGH);
digitalWrite(PWM1,HIGH);
delay(3000);
}
thanks to ladyada i get this code.but to modify this, i hope you guys can help me.. thanks in advance..