max6675+ethernet+sd card

If I use the example of the max6675 library with this pin configuration it runs ok
So its not a wiring problem.

OK, then you should be good to go!

No surfer tim
Acording to paul with is first program sugestion I should get ok for both the sd card and the ethernet shield begin.

José

jmaxado:
No surfer tim
Acording to paul with is first program sugestion I should get ok for both the sd card and the ethernet shield begin.

José

But you don't, do you?

No
So I am still in trouble.

José

jmaxado:
No
So I am still in trouble.

Not yet. If you use my last code and disconnect the max6675, does all do ok except the output show:

Setup complete
0
0
0
0

...and on

Yes, making some progress
With your latest code and the wiring of the max6675 disconnected I get

Starting SD..ok
Starting w5100..192.168.1.96
Setup complete

José

OK! Now we are good. We must figure out how to connect the max6675. If you connect the max6675 to the sck (pin 52), miso (pin 50), and CS (digital pin 49), does it still fail?

No luck this time
With the max wires connected I get

Starting SD..fail
Starting w5100..

And it just hangs like that

José

There must be a wiring problem or IC fail. Check:
Pin 7 (SO) to digital pin 50
Pin 6 (CS) to digital pin 49
Pin 5 (SCK) to digital pin 52
Pin 4 Vcc = 5v
Pin 1 GND is connected to ground on the Arduino.

Try the test sketch with the above connected, except leave SO (Pin 7 to digital pin 50) disconnected for a test. Do the SD and w5100 start ok then? SO should be a tri-state output on the max6675, but that may not be working correctly.

edit: If that works ok, then connect pin 7 to digital pin 50 and connect pin 6 (CS) to +5v. Try the test again.

Without pin 6 I get

Starting SD..ok
Starting w5100..192.168.1.96
Setup complete

With pin 6 to 5v I get

Starting SD..ok
Starting w5100..

And it hangs there.

Jose

Without pin 6 I get

Starting SD..ok
Starting w5100..192.168.1.96
Setup complete

You did mean without pin 7 connected to the Arduino, correct? If that is correct, then the max6675 is malfunctioning. The SO pin on that IC is not tri-state, and trashing up the SPI bus. On that, I don't have a solution except try replacing it.

Sorry I meant pin 7 the one on the pin 50 of mega.

José

I contacted Maxim tech support about the max6675 SO pin, and if it is in fact a tri-state output. I should hear from them soon.

edit: Maxim is on the west coast, so it may be a while. If you want to experiment a little while you wait, remove the ethernet shield and run this code with the max6675 connected.

#include <SPI.h>

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

  pinMode(53,OUTPUT);
  SPI.begin();
 
  // disable max6675 SPI and start the first A/D conversion
  pinMode(49,OUTPUT);
  digitalWrite(49,HIGH);
  
  Serial.println("Setup complete");
}

void loop() {
  delay(1000);

  // thisTemp gets temp in 1/4 degrees C
  int thisTemp = readMax();
  
  Serial.print(thisTemp/4,DEC);
  Serial.print(".");
  Serial.println((thisTemp%4) * 25,DEC);
}

int  readMax() {
  int maxLow;
  int maxData;
  
  //  enable max SPI
  digitalWrite(49,LOW);

  // do the 16 bit read  
  maxData = SPI.transfer(0x00);
  maxLow = SPI.transfer(0x00);
  
  // disable max SPI and start next conversion
  digitalWrite(49,HIGH); 

  // convert to an integer from the two bytes
  maxData = maxData << 8;
  maxData = maxData | (maxLow & 0xff);

  // shift temp reading into position
  maxData = maxData >> 3;
  
  // return 1/4 degrees Celsius
  return maxData;
}

Does it display the correct temperature on the serial monitor?

I forgot to set pin 53 to OUTPUT in the setup() function. I corrected that.

This is from Maxim tech support:

Tim,
Yes, the MAX6675 SO pin should be high-impedance when CS\ is high, as well as during the D0 bit output (see Figure 1a).

Send us a scope shot of a read to another chip, showing our CS, SCLK, & SDO.

MAX6675 is not recommended for new designs; use MAX31855KASA+.
Mixed-signal and digital signal processing ICs | Analog Devices

Mixed Signal Apps

I will presume the output section of your device has failed. It may output the correct data when connected by itself, but not go to high impedance when the CS line is HIGH.

Hello
Surfer Tim I will do that test later tonight. I am at work now and I cannot remove the Ethernet shield.
Meanwhile I was doing some searching regarding the version of the Ethernet shield and I found this site

http://shieldlist.org/arduino/ethernet-v5

This is my board.
Here it says that this version of the Ethernet shield uses analog 0 and 1.
Currently I am using this port as analogs inputs.
Could this be the problem ?

José

My opinion? Disconnect everything from your Mega. Try just the max6675 on the standard SPI bus. Then try it with just the ethernet shield. Then add one thing at a time until it fails, then back up one step. :slight_smile:

Hello
I would prefer not to do that because I have lots of stuff connected and between testing I keep my old version running and getting data for all the other sensors.
So can we keep testing with all plugged ?

Thanks

José

Sure! Upload the code in reply #18. What does the serial monitor show?

Could this be the problem ?

Clearly a problem. Not necessarily THE problem.

I shell correct this as soon as I get home.
And do the testing Surfer Tim suggested.
thanks for all the help guys.