Printing Ethernet Interface Settings…the easy way

Just a quick little library for printing the current settings of the Ethernet interface on Arduino.

Be sure to check the examples. You can print to Serial or any stream you choose. If you’re printing to your own stream you might not want labels, and there’s an option for that too.

The library can be found on GitHub here: https://github.com/blackcatm/PrintIF

Sample Output:

Attempting to start Ethernet.
Ethernet address: 00:aa:bb:cc:de:02
      IP address: 192.168.0.101
     Subnet mask: 255.255.255.0
 Gateway address: 192.168.0.1
      DNS server: 192.168.0.1

Extended EEPROM Library for Arduino

The first post here on was an article including some code to print the EEPROM contents in a hex dump on an Arduino to the serial port.

I’ve now built that functionality into a library to replace the EEPROM library. You can now sent the hex dump to any stream (software serial, second hardware serial, etc).

Another handy feature is a set method which works similar to memset. If you need to clear a number of bytes, or set them to a single value this function keeps you from having to implement yourself, and it has some simple bounds checking in case you forget.

The library can be found on GitHub here: E2PROM

Be sure to check out the examples for some usage details.

Arduino Ethernet MAC Address Storage Library

Ethernet interfaces must have a unique hardware address to communicate on the local network. When using a Wiznet based Ethernet connection (either bare module, shield or integrated board) as part of the hardware initialization you must provide the hardware address, or MAC (Media Access Control) address.

MAC addresses are 48-bits, most commonly represented as 6 bytes displayed in hexadecimal. Newer Arduino Ethernet Shields and Arduino Ethernet boards ship with a MAC address on a sticker. Easy for you to read, hard for your program to read. If you have multiple boards you wish to deploy the same software on you’ll want a way to keep the code portable between your boards.

While you could just change the address in code, that requires individual configuration and recompiling for each board. Instead, much like other configuration or user preferences you ought to consider storing the MAC address in nonvolatile memory.

The AVR chips the Arduino is based on has a limited amount of EEPROM memory (512 bytes on atmega168, 1k on atmega328 and even more on the atmega1280 and atmega2560 chips). By storing the address in EEPROM and reading the address before initializing the Ethernet interface you can minimize errors later if you need to change software. Best of all, during normal flash programming the EEPROM is left intact so you can change your program but retain the MAC address (and any other configuration you might store).

I have written a library for Arduino which lets you store and retrieve a MAC address in EEPROM. I choose to store the address in the last 8 bytes of EEPROM memory. For data integrity the value is stored with two checksum bytes. During retrieval the checksum is calculated on read and compared with the stored values and an error case returned if there are any mismatches. During storage the MAC address is written with checksums calculated and before signaling success the MAC address is reread and checked against the checksums.

The library can be found on GitHub here: EtherMac

Please see the included examples for usage.

You can read more about MAC addresses on Wikipedia.
Learn more about Arduino Ethernet.