Datalogger + Thermocouple Mux

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Datalogger + Thermocouple Mux

Post by adafruit_support_rick »

christopherb2 wrote:1.) How do you start a new post? Can't find any button.
At the top of this page, you'll see "Forum Index -> Arduino -> Arduino Shields from Adafruit"
If you click on the name "Arduino Shields from Adafruit", you'll go to the topic list for this forum.
There's a "New Topic" button there.
christopherb2 wrote:2.)Why are some of your tutorial pages jumbled up and unreadable.
Which ones in particular? Jumbled up how? Can you post a screenshot? (use the 'Upload Attachment' tab).
christopherb2 wrote:3.)I tried to download the temp/light sketch and I get the merry runaround from one page to another back to the datalogger start page?
We have a tutorial on downloading libraries and example sketches here
http://learn.adafruit.com/adafruit-all- ... nstall-use
christopherb2 wrote:4.)The other page adasomething or other tells me about my broswer. Why is your stuff not backwards compatible with IE.7?
I don't know that it isn't. What is the exact error message that you are seeing?

dustintweir
 
Posts: 1
Joined: Wed Dec 18, 2013 11:00 am

Re: Datalogger + Thermocouple Mux

Post by dustintweir »

Wow, I wish I'd found this page a while ago. I fixed the problem by physically re-routing pin 13 on the MUX to pin 8. It works, but is a hell of a lot harder to do than your solution...

gabscar
 
Posts: 3
Joined: Fri Mar 28, 2014 11:26 am

Re: Datalogger + Thermocouple Mux

Post by gabscar »

I am encountering the exact same problem with the Adafruit data logger and the Ocean Controls thermocouple MUX. I have tried the solution "Change SD.begin(chipSelect); to SD.begin(chipSelect, 11, 12, 13);" However I am being presented with an error " no matching function for call to 'SDClass::begin(int&, int, int, int)'

I am using the uno and have read here (http://www.adafruit.com/forums/viewtopi ... 31&t=42858) that SD.begin(chipSelect) should work for the uno, but this is not the case.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Datalogger + Thermocouple Mux

Post by adafruit_support_rick »

gabscar wrote:I am encountering the exact same problem with the Adafruit data logger and the Ocean Controls thermocouple MUX. I have tried the solution "Change SD.begin(chipSelect); to SD.begin(chipSelect, 11, 12, 13);" However I am being presented with an error " no matching function for call to 'SDClass::begin(int&, int, int, int)'
You need to download the Adafruit version of the SD library, which supports software SPI on any pins.
Install it in your sketchbook/libraries folder

https://github.com/adafruit/SD

gabscar
 
Posts: 3
Joined: Fri Mar 28, 2014 11:26 am

Re: Datalogger + Thermocouple Mux

Post by gabscar »

Thanks Rick. That worked a treat. I had played around with the SdFat library, but didn't get anywhere with it. I am building a mobile data acquisition module to process monitor a solar water heater I am doing R&D on here in sunny Edinburgh. I will post my code and hardware list once complete.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Datalogger + Thermocouple Mux

Post by adafruit_support_rick »

Hey, I've been to sunny Edinburgh. Except it wasn't sunny - it was raining. I guess I must have just picked the wrong time to go... :wink:

gabscar
 
Posts: 3
Joined: Fri Mar 28, 2014 11:26 am

Re: Datalogger + Thermocouple Mux

Post by gabscar »

Hi Rick, I hope the weather didn't spoil your trip too much. When the sunshines in Edinburgh we tend to make the most of it, as it may be a while until he puts his hat on again!

I am still having a few problems logging data to the SD card. I cannot log the temperatures as they appear on the screen, and the RTC is messed up

For example this line of code...

Code: Select all

  SD.begin(CS_pin, 11, 12, 13);
          File dataFile = SD.open("test.txt", FILE_WRITE);
          dataFile.println(floatTemp,2);
          dataFile.close(); 
just writes 0.00 to the file each loop even though the correct temps are displayed on the screen. I can write simple text to file, but output functions from the MUX or RTC are pretty messed up. Any insight you could give would be greatly appreciated.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Datalogger + Thermocouple Mux

Post by adafruit_support_rick »

Try doing a Serial.println at the same place you're doing the dataFile.println. See if the data is still messed up.

User avatar
AndrewJones
 
Posts: 4
Joined: Tue Dec 02, 2014 1:56 am

Re: Datalogger + Thermocouple Mux

Post by AndrewJones »

wilheldp wrote:So I emailed the tech guy at Ocean Controls, directed him to this thread, and he fixed the problem on his first try.

Code: Select all

date,time,Ch1,Ch2,banned,Ch4,Ch5,Ch6,Ch7,Ch8
6/12/2013,22:52:52,77.45,76.10,77.45,76.10,77.00,76.10,76.10,75.20
6/12/2013,22:53:2,77.45,75.65,77.45,76.10,77.00,76.10,75.65,75.20
6/12/2013,22:53:12,77.45,76.10,77.45,76.10,77.00,75.65,75.65,75.20
6/12/2013,22:53:22,93.20,76.10,77.45,76.55,77.00,76.10,77.00,75.65
6/12/2013,22:53:32,83.30,77.00,93.65,78.80,77.00,76.55,78.80,77.00
6/12/2013,22:53:42,78.80,93.65,80.60,79.70,77.00,76.55,86.90,76.10
6/12/2013,22:53:52,78.35,80.15,77.90,94.10,77.00,77.00,81.95,76.55
6/12/2013,22:54:2,78.35,77.00,76.55,81.05,77.45,77.00,94.10,76.55
6/12/2013,22:54:12,78.35,76.10,76.10,77.45,77.45,77.00,80.60,93.65
The smoking gun, you ask? Change SD.begin(chipSelect); to SD.begin(chipSelect, 11, 12, 13);. It was already using the standard Arduino MOSI, MISO, and SCK pins, but just telling it that it had to use those pins allowed the mux to control the SCK pin (which is what tipped the Ocean guy to the real problem).

Thank you again for all your hard work on my problem, Rick. And if you're checking this thread again, thanks again to you, Greg from Ocean!
OK I am having the same problem with my TC/SD setup. I have downloaded the alternative SD library but at the moment am having issues with our IT department getting local admin right on my PC to modify the C:\Program Files\Arduino\libraries\.

in the mean time, I am trying to see in wilheldp's code "SD.begin(chipSelect);" appears. unless it is supposed to be "if (!SD.begin(chipSelect)) {..."

Can anyone help me understand what this command does anyway?

User avatar
AndrewJones
 
Posts: 4
Joined: Tue Dec 02, 2014 1:56 am

Re: Datalogger + Thermocouple Mux

Post by AndrewJones »

Here is the code i am using

Code: Select all

#include <SD.h>


#include <SD.h>//from datalogger


#define PINEN 7 //Mux Enable pin
#define PINA0 4 //Mux Address 0 pin
#define PINA1 5 //Mux Address 1 pin
#define PINA2 6 //Mux Address 2 pin
#define PINSO 12 //TCAmp Slave Out pin (MISO)
#define PINSC 13 //TCAmp Serial Clock (SCK)
#define PINCS 9  //TCAmp Chip Select Change this to match the position of the Chip Select Link


//char data[16];
char i, j;

const int chipSelect = 8;//***************************from datalogger code


void setup()   
{     
  Serial.begin(9600);  

  pinMode(PINCS, OUTPUT);
digitalWrite(PINCS, HIGH); //Drive Pin 9 high to initalize the SD Card

SD.begin(chipSelect,11,12,13);   
  
   //**********************************from datalogger initialize card
    if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    return;
  digitalWrite(PINCS, LOW); //Drive Pin 9 low to reset for the MUX 
  }
  Serial.println("card initialized.");  
  
//This is not working ***********************************************/

  pinMode(PINEN, OUTPUT);     
  pinMode(PINA0, OUTPUT);    
  pinMode(PINA1, OUTPUT);    
  pinMode(PINA2, OUTPUT);    
  pinMode(PINSO, INPUT);    
  pinMode(PINCS, OUTPUT);    
  pinMode(PINSC, OUTPUT);    
  
  digitalWrite(PINEN, HIGH);   // enable on
  digitalWrite(PINA0, LOW); // low, low, low = channel 1
  digitalWrite(PINA1, LOW); 
  digitalWrite(PINA2, LOW); 
  digitalWrite(PINSC, LOW); //put clock in low

  
  
 pinMode(10, OUTPUT);//*******************************from datalogger code
  
}

void loop()                     
{
      //Just look at Channel #1
      digitalWrite(PINA0, LOW); 
      digitalWrite(PINA1, LOW); 
      digitalWrite(PINA2, LOW);
    
      
      delay(5);
      digitalWrite(PINCS, LOW); //stop conversion
      delay(5);
      digitalWrite(PINCS, HIGH); //begin conversion
      delay(100);  //wait 100 ms for conversion to complete
      digitalWrite(PINCS, LOW); //stop conversion, start serial interface
      delay(1);
      

      for (i=31;i>=0;i--)
      {
          
        digitalWrite(PINSC, HIGH); //Pulse the TC serial clk
          delay(1);
      
        Serial.print(digitalRead(PINSO));   //Print the raw binary data to the terminal
    
        digitalWrite(PINSC, LOW);//Finish pulse
        delay(1);
      }
Serial.println("");
   
   
 

}


User avatar
AndrewJones
 
Posts: 4
Joined: Tue Dec 02, 2014 1:56 am

Re: Datalogger + Thermocouple Mux

Post by AndrewJones »

OK found the SD.begin call in the setup. should have used CTRL F to begin with.

User avatar
AndrewJones
 
Posts: 4
Joined: Tue Dec 02, 2014 1:56 am

Re: Datalogger + Thermocouple Mux

Post by AndrewJones »

I am having some problems if anyone can help. I have downloaded and installed the updated libraries as described above, specifically addressed the pins 11, 12 and 13 in the SD.begin command but the card is still not being initialized.

Hardware is : Arduino Uno, Sparkfun MicroSD Shield, and Ocean Controls K type Thermocouple Multiplexer.

I have stripped down the code so i can understand better what is happening. I just initialize the card, pulse the SC on the on the TC chip, read the binary code output for just the first thermocouple, and write "something" to the card.

Code: Select all

#include <SD.h>
#include <SPI.h>

Sd2Card card;
SdVolume volume;
SdFile root;

#define PINEN 7 //Mux Enable pin
#define PINA0 4 //Mux Address 0 pin
#define PINA1 5 //Mux Address 1 pin
#define PINA2 6 //Mux Address 2 pin
#define PINSO 12 //TCAmp Slave Out pin (MISO)
#define PINSC 13 //TCAmp Serial Clock (SCK)
#define PINCS 9  //TCAmp Chip Select Change this to match the position of the Chip Select Link



char i, j;


// change this to match your SD shield or module;
// Arduino Ethernet shield: pin 4
// Adafruit SD shields and modules: pin 10
// Sparkfun SD shield: pin 8
const int chipSelect = 8;//***************************Sparkfun shield


void setup()   
{     
  Serial.begin(9600);  

//pinMode(PINCS, OUTPUT);
//digitalWrite(PINCS, HIGH); //Drive Pin 9 high to initalize the SD Card

SD.begin(chipSelect, 11, 12, 13);
/*
while (!card.init(SPI_HALF_SPEED, chipSelect)) 
  {
    Serial.println("initialization failed....");
  } 
*/

  pinMode(PINEN, OUTPUT);     
  pinMode(PINA0, OUTPUT);    
  pinMode(PINA1, OUTPUT);    
  pinMode(PINA2, OUTPUT);    
  pinMode(PINSO, INPUT);    
  pinMode(PINCS, OUTPUT);    
  pinMode(PINSC, OUTPUT);    
  
  digitalWrite(PINEN, HIGH);   // enable on
  digitalWrite(PINA0, LOW); // low, low, low = channel 1
  digitalWrite(PINA1, LOW); 
  digitalWrite(PINA2, LOW); 
  digitalWrite(PINSC, LOW); //put clock in low

  
  
 pinMode(10, OUTPUT);//*******************************from datalogger code
  
}

void loop()                     
{
      //Just look at Channel #1
      digitalWrite(PINA0, LOW); 
      digitalWrite(PINA1, LOW); 
      digitalWrite(PINA2, LOW);
    
      

      digitalWrite(PINCS, HIGH); //begin conversion
      delay(100);  //wait 100 ms for conversion to complete
      digitalWrite(PINCS, LOW); //stop conversion, start serial interface
      delay(1);
      

      for (i=31;i>=0;i--)
      {
          
        digitalWrite(PINSC, HIGH); //Pulse the TC serial clk
          delay(1);
      
        Serial.print(digitalRead(PINSO));   //Print the raw binary data to the terminal
    
        digitalWrite(PINSC, LOW);//Finish pulse
        delay(1);
        

      }
Serial.println("");


//*Write something to the datafile
digitalWrite(PINCS, HIGH); //Drive Pin 9 high to enable the SD Card http://forums.adafruit.com/viewtopic.php?f=31&t=39699

File dataFile = SD.open("testdata3.txt", FILE_WRITE);
dataFile.println("Somerhing");
dataFile.close();
digitalWrite(PINCS, LOW); //Drive Pin 9 low to reset for the MUX 

//*******************************************/   
 
 

}
Can anyone Pleeeeeeez help.

AJ

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”