Sd card logger shield with Ethernet shield

Hi Forum,

The project is to log temperature information every minute or so, save it to the SD card and then occasionally upload the data via a webserver to a requesting client.

The hardware is.............. 1) Duemilanove 328, 2) 'Official' Ethernet (w5100) shield, 3) Ladyada Data Logger shield (with RTC).

The problem is that the all three hardware components will not run as an assembled unit. The logging / recording part with 2009 and SD shield runs perfectly, The Web server part with 2009 and the Ethernet shield also runs flawlessly but combined - no way. The system always fails at SD card initialization.

OK, the problem is known and discussed on several occasions in this forum but I cannot find a definitive article anywhere that says "Yes, this is possible and here is how it's done" or "No, it's not possible because......".

I know one of the problems is that the Wiznet chip does not drive MISO into high Z when the SPI function is de-selected. Another is that both 'peripherals' use Dig pin #10 as the /CS line (Arduino and manufacturers should really get their heads together on this one). I don't know if there are any other issues.

Basically, I just want to make sure I'm on the right track before I go cutting conductors and re-wiring Arduino shields.

Sounds like an interesting project, just started on something similar. I don't have the solution for you but here are my experiences so far.

I am using the sparkfun sdcard - has no RTC :( The sdcard shield has a CS on pin 8 and I had to patch the sdfat lib to get it working - yesterday. The adaloggershield also works with the sdfat.lib so maybe you could do the following:

  • buy a set of header-pins and extend the loggershield.
  • cut pin 10 from the header pin (keeps the loggershield intact),
  • connect pin 10 and pin 8 on the loggershield !Note: the loggershield must be on top of course.

  • patch the sdfatlib to use pin 8 instead of 10

== ArduinoPins.h line 518 SS_PIN 8 iso 10 == Sd2Card.h line 36 uncomment #define Mega .. (this enables soft config of SPI ) == Sd2Card.h line 64-66 SS_DDR etc use 8 iso 10 (copy the lines and comment the original)

Hopes this helps you a step further.

Q: Are you satisfied with the Data Logger shield?

Q: What Temp sensors do you use I have 3 DS18B20 - 11 bit modus in my project, sample freq once per second

Regards, Rob Tillaart

Hi Rob, Dank u wel voor uw antwoort !! (Sorry, that's about all the Dutch I know.)

Actually this is up and working - I posted on the Ladyada forum a while back for some advice and a contributor - sdfatlib - provided some valuable info.

The two main issues were as I suspected. First of all, creating separate SlaveSelect lines - one for the Ethernet shield and one for the DataLogger shield and then, how to handle the Ethernet Wiznet chip fault where the MISO line does not go Hi-Z in stand-by mode. Crack this and the system should work.

Just before describing how to do this, the 'stacking order' should be noted. 'Ground level' is the 328Duemilanove. Then comes the logger shield and finally the Ethernet shield on top. Do NOT attempt to put the Ethernet shield 'in the middle' unless you have extended length header pins on the Ladyada shield - a solder connection on the under-side of the Logger shield can short out on the metal Ethernet socket housing. Although this didn't cause any damage with momentary contact, it may well do with a longer period of contact.

Fixing problem 1) The ladyada logger shield has full 'break-out' capabilities so you can 're-direct' signals very easily by soldering in pin (socket) headers to make new connections simply using jumpers.

On the Logger shield, cut the track immediately as it leaves pin 10. Pin 9 is free on the Logger shield so connect it the the track of pin 10. That's the hardware fixed - now the software. Go into the libraries for the Ladyada Data Logger sketch and open Sd2Card.h. Somewhere about line 53, paste in the following......

/** SPI Slave Select pin */

define SPI_SS_PIN 9//SS_PIN

and save. That takes care of the SD card access and should work without any problem.

Fixing problem 2) The only thing we have to do here is switch the SEN input on the W5100 chip. This disables the SPI function on the Ethernet chip with MISO going Hi-Z when SEN is switched LOW.

On the circuit diag. for the Ethernet shield, locate the 'PROG' jumper somewhere lower left on the diagram. Make a connection between the switchable side of this jumper (which goes to the SEN input) and any available digital pin - I used pin PA7 as it was available and 'in the area' !

In your sketch declarations, declare the pin as a digital output . Now, whenever you wish to communicate with the Ethernet shield, simply switch SEN HIGH. When the software is finished communicating with the Ethernet shield, switch SEN back LOW. This allows the SDCard to communicate freely using the SPI bus.

On a general note, if anyone trying to put this together can't get their system up and running, it's pretty safe to assume the error will be in the application code as this mod is tested and working.

Regarding the Ladyada Data Logger shield...... I've only used 2 SD Card shields - a Libellium and the Ladyada shield. The Libellium is RUBBISH - never be tempted to even look at this hardware, The Ladyada shield is quite the opposite. Thoughtfully designed PCB and soooooo easy to break out signals. There's even planty of space for prototyping, it has an RTC and is half the price !!! OK, you've got to pay carriage from the USA and build it as it's a kit but there is nothing difficult about it - just be extra careful when soldering the SD card holder. If I was going to stick with the Arduino, I'd use the Ladyada Logger shield as the ideal 'SD Card' partner for the 2009

I don't know the DS18B20 sensor but I've used the Analog Devices TMP36 which I think would give a similar performance. I'd give the TMP36 a 'pass' mark but it's pretty average performance - not particularly stable unless you use a lot of sampling and averaging. My favourite sensor is the Sensirion SHT15 - a class piece of work. I've never measured it against a calibrated device, but I think it would be pretty accurate and its very stable.

That's about it - hope this helps. If anyone has any questions, just reply to the topic.


Thanks for your explanation, found several pieces you mentioned but now I have them alll together. Before soldering my ethershield the following Q:

Suppose I have a file of 1 MB on the sdCard and want to send it to a server. When I have opened a socket on the ethershield and I disable the shield using SEN to read a buffer of data from the SD will the socket stay open??.

// dummy code
EES();   // Enable ethershield;
s = opensocket(server, port);
DES();  // Disable ethershield;

f = openfile(filename);
buffer =;
while (buffer.size >0)
  res = s.write(buffer);
  if (res == error) => appropiate action
  buffer =;
// close things.

TIA, Rob

Hi Rob,

I haven't actually tested that so I cannot give you a definite 'yes' or 'no'.

However, as I understand it, switching the SEN line does not enable/disable the Ethernet chip - just the SPI bus section. As a result I can't see why it should have any negative effect - i.e. if there is an active connection, the chip should not drop the connection if SEN is switched.

The following is the code I use to initialise the Ethernet function...........

void setup(void) { pinMode(spiBUScontr, OUTPUT); digitalWrite(spiBUScontr, HIGH); Ethernet.begin(mac, ip); server.begin(); digitalWrite(spiBUScontr, LOW); // other code; }

Obviously, there's no connection to hold at this point but the when the Ethernet chip is accessed later, the response is perfect so there has been no negative effect by switching SEN (spiBUScontr).


simple question- Yes, I am a NOOB... so thank you for a response :o on the mac address in the sketch- 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED- my mac address is 90, A2, DA... etc. Does the sketch need to read 90DE, A2AD, DABE... etc or just simply replace the 4 digit string sequence with my mac address 2 digit string sequence?

A mac address contains six bytes, often written in hexadecimal notation. The ethernetschield for arduino let you define the mac-address. Mac addresses may not conflict as they are used to route packets over the internet. They are more "fundamental" then the better known IP addresses. To answer your question, you should use 0x90, 0xA2, 0xDA etc

But do not (repeat NOT!) use the same numbers as your PC or any devic e in your (local) network as that may cause interference in routing. Rob

Thank You SIR ;D