PSA: Use a heatsink on your W5100 Arduino Ethernet Shield

ethShieldHeatSink

This past summer, I had quite a few problems with some of my ethernet shields when the temperatures got hot.  I had intermittent connectivity and sometimes the shields would need to be reset, or would only work randomly whenever ambient temperatures were up above 80 degrees F or so (I have a few in the garage).  It took me a while to figure out that the problem was with the w5100 chip on the shields.  They get hot (or at least the inexpensive eBay knock-off versions I have been buying do).

I was able to make them work in a completely reliable fashion by attaching a small heatsink directly to the w5100 chip with some thermal paste (cpu paste).  I was able to get some 11x11x5mm heatsinks from eBay for about $2.50 shipped for five of them.

Anyhow, if you have experienced unreliable results with Arduino Ethernet Shields, you might try this.  It worked perfectly for me.

How to use an nrf24l01 (rf24) with an Arduino Ethernet Shield

rf24Ethernet
I have been working on a project that requires the use of both a wiznet-type w5100 Ethernet shield like this and an nrf24l01 radio at the same time.  The problem I ran into was that both of these peripherals use the SPI protocol, and I could not get them both working simultaneously (the Ethernet shield has it’s pins hardwired to the hardware SPI, of course).  After doing some reading on the SPI protocol, I found out that there seems to be some kind of issue that, according to the freetronics website, causes the w5100 chip to maintain control of the SPI bus even when another device has been selected.

After much searching, and much experimenting, I finally found a workaround that seems to be working reliably for me.  The solution was to use ‘software’ or ‘bit-banged’ SPI.  This allows the Ethernet shield to happily commandeer the hardware SPI pins, while the nrf24l01 (or any other peripheral, I suppose) to operate on a separate, emulated SPI bus.

The credit for this goes to a user on the Arduino forums, nicoverduin, who suggested using some software SPI libraries already available and modifying maniacbug’s nrf24 library to use the software spi interface.

Here is the step by step:

1.)  Download the modified maniacbug library and softSPI libraries here.
2.) Copy the libraries to your Arduino libraries folder.
3.) Configure your Arduino/Ethernet-shield/nrf24l01 like this (you can also modify the pin configuration if needed.  Instructions are in the readme file on the linked github repository):

 

Connect to the soft-spi designated pins
Connect to the soft-spi designated pins

 

If you would like to download the fritzing file, here you go:
rf24-softSPI_plusEthernetShield

4.) Add the library references to your code or use example code provided below.

This sketch is a companion sketch to the nrf24l01_send_string sketch I posted previously.

Once you have completed the above steps, you can upload your sketch to the Arduino and you should be able to browse to the IP of your Arduino with Ethernet shield and you will see a web page that tells you the last message received over the nrf24l01.

There is one major caveat to all of this, however.  I have found that sometimes when I am working with the softSPI version of the nrf24 library and then I switch back to the regular/hardware version (e.g. when I work on the sending device, which in this case has no ethernet shield, after I upload a sketch to the one with the ethernet shield), the hardware-based SPI nrf24l01 breaks.  This seems to be happening because the Arduino IDE is holding on to the softSPI version of the rf24 library.  I am just speculating on that, but it kind of makes sense since the internal naming is identical between the libraries.

The fix for this problem is simple, if a bit inconvenient.  I have been removing my modified version of the rf24 library from the Arduino libraries folder before working with the hardware-SPI version.  I am sure there is a smarter way of fixing this, and if someone could point it out to me, I would be glad to post the solution here.