LamaPLC: Arduino shields

Ethernet shield

The Arduino Ethernet Shield enables an Arduino board to connect to the internet using the Ethernet library and read or write data on an SD card with the SD library.

Difference Between W5500 and W5100

W5100W5500
Arduino Ethernet shield W5100Arduino Ethernet shield W5500
  • Number of Sockets: The W5500 supports eight simultaneous open sockets, whereas the W5100 supports only four.
  • Power Consumption: The W5500 consumes less power, especially in power-down modes, compared to the W5100.
  • Interface: The W5500 features a high-speed SPI mode, which is faster than the older interfaces used by the W5100.
  • Features: The W5500 supports Wake on LAN (WoL) over UDP and has a smaller physical footprint.
  • Performance: The W5500 generally offers better performance due to its advanced features, although the W5100 can still provide a sufficient Ethernet solution for many applications.

Network Settings

The shield must be assigned a MAC address and a static IP address using the Ethernet.begin() function. A MAC address is a globally unique identifier for a specific device. Current Ethernet shields have a sticker showing the MAC address to use.

For older shields without a dedicated MAC address, generating a random one should work, but avoid using the same one on multiple boards. Valid IP addresses depend on your network configuration. You can also use DHCP to dynamically assign an IP address. Additionally, you can specify a network gateway and subnet if needed.

Arduino Uno Ethernet PinsThe Arduino board communicates with the shield using the SPI bus. This is on digital pins 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega.

On both boards, pin 10 is used as the SS (Slave Select) pin. On the Mega, the hardware SS pin, 53, is not used to select the Ethernet controller chip, but it must be kept as an output, or the SPI interface won't work.

The communication between the microcontroller and the SD card uses SPI, which takes place on digital pins 11, 12, and 13 (on most Arduino boards) or 50, 51, and 52 (Arduino Mega). Additionally, another pin must be used to select the SD card.

This can be the hardware SS pin, which is typically pin 4 (on most Arduino boards) or pin 53 (on the Mega), or another pin specified in the call to SD.begin(). Note that even if you don't use the hardware SS pin, it must be left as an output, or the SD library won't work.