Monday, November 24, 2014

Arduino Libraries

Update 2016-11-21: Since this post has many views, I want to point out that Arduino libraries are easier to install since IDE 1.6.2 (see these directions), and that EtherSia is my Arduino Ethernet library of choice because it supports IPv6 (single-stack) as well as the ENC28J60, W5500, and W5100 Ethernet controllers, and it's simple to change the Chip Select pin.

The next baby step with my Arduino is to load libraries into the IDE. (Yes, baby steps. It's easier for me to do in a short time that isn't as busy, and it's less likely that I'll get frustrated.) The directions to load Arduino libraries look easy enough. (Adafruit, Installing a Library on Mac OS X)

The library for the HTU21D is linked with the directions, another easy step.

And then, despite trying to keep it simple, I thought that first library was so easy, let me add the library for the ENC28J60 Ethernet. Alas, that was a rabbit hole! Here is my saga.

ENC28J60 and Arduino: a history, with an eye to IPv6 support

My journey starts here with Reflective Heat:

The official Arduino Ethernet Shield is based on the WizNet 5100 chip, which implements the IPv4 protocol stack in silicon. As a consequence, the Arduino Ethernet Shield cannot be used to implement an IPv6 stack.

Most people use the ENC28J60 in place of the WizNet 5100, either for its low cost, or because I wanted IPv6 support. And now I step through a littered history.

EtherCard is a driver for the ENC28J60 chip, compatible with Arduino IDE, from Jean-Claude Wippler. Adapted and extended from code written by Guido Socher and Pascal Stang ... but I don't see IPv6!

Back to Reflective Heat. The RHT IPv6 library for Arduino is based on the work of Pascal Stang, Xing Yu, and Guido Socher for EtherShield and IPv6EtherShield from G√ľnther Hoelzl. And I note:

The earlier ipv6ethershield developed by Guenther Hoelzl was tested but found to be unstable and would not compile on the most recent versions of the Arduino Integrated Development Environment (IDE).
However, I'm a bit nervous about the RHT offering because it only discusses Arduino UNO and Mega, and I have the Nano. So I thought I'd keep looking. Apparently I don't know enough to stay away from rabbit holes!

Hey, I found a list of Arduino IPv6 library choices and Telecom Bretagne is newer! but I don't want a wireless sensor network because wireless isn't as reliable as wired Ethernet. There are directions but for wireless, so I continue to look.

I found a blog with a whole category for Arduino and this Ethernet! but no IPv6 when I searched the blog.

So once again, I found myself back at the beginning, reading about Contiki's μIPv6 stack ported for 1-wire (original site appears to be offline now), but wrong microcontroller and wrong sensor family. However, μIP will appear again, with better luck next time.

The first two libraries at Tweaking4All also lack visible IPv6 support, but discuss the same problem of having a Nano instead of an UNO or a Mega (same concern I had with RHT!). The first set is ETHER_28J60 + EtherShield (from Jose Muanis Castro; mentioned by RHT); the second one is EtherCard (mentioned above). However, the third library looks like a winner! Do I see a nod to μIP? ... drumroll please ...

UIPEthernet has some IPv6! although with a gotcha noted. But I'm reminding myself that my small goal tonight is to load libraries, just the libraries, and not to discover what might be broken later. There are examples to test first!

There are some posts about which CS (chip select) pin to use for various configurations. I like this post because it shows where to change the underlying code if you don't want to re-wire.

No comments:

Post a Comment