July 11, 2010

Arduino Dev Camp: Your Favourite Library

Yesterday I was down in Oxford at the headquarters of RS Components for the Arduino Dev Camp unconference.

As it was an unconference, I'd spent the few days beforehand trying to work out what I should talk about at the event. Usually I'd give my Getting Started With Arduino talk, or maybe something about Mazzini and energy monitoring, but I figured almost everyone would already know about Arduino, and I knew Nigel Crawley was planning on giving his ecoduino talk.

So I decided it might be useful to chair a discussion about non-core Arduino libraries. There are lots of add-on bits of code written by all manner of Arduino enthusiasts which haven't made it into the core Arduino distribution. I've often only heard about them from chance conversations with fellow Arduino coders, so I thought it would be useful for people to share the libraries that either they'd written themselves, or that they'd found useful in their projects.

Michael Margolis (who has written a number of libraries, including the Servo library now part of the Arduino core) helped to run the session, so we started off with some insight on the process taken to get a library accepted into the core distribution. There are broadly three phases:

  1. An Arduino user writes a library to help with a problem they've got. They then release it somewhere on the Internet and post a link to it on the forum and/or playground. The forum tends to act as a place for the community to discuss the library, provide feedback, make suggestions, etc.
  2. The first level of "recognition and approval" from the core Arduino team is when it's highlighted and pointed to from the Arduino blog.
  3. Finally, once the library is proven to be popular and robust, the Arduino team will generally approach the library writer and work with them to bring it into the core distribution.

That led into some questions about whether libraries are usually developed by individuals or in collaboration - with consensus being that is was usually individuals, but for no particular reason; some wondering about what the CPAN of Arduino is (i.e. the central location to find what's available) - in retrospect (mainly from my preparing this write-up) I think that's the Playground area, maybe we need more pointers in the forum to encourage people to add new libraries to the Playground; and also some debate about how you add features to existing libraries, or do versioning of libraries - no real solutions were found, but I suspect this will become more of a problem over time as the amount of code available increases.

The "sharing of useful libraries" became mostly Michael and I describing the libraries we'd written, although I also brought up Jordan Terrell's DHCP library (because it's pretty essential for any serious Internet of Things project)

Michael's libraries are:


  • Time. Lets the Arduino act like a clock. Needs the time to be set somehow, but that can be from GPS, an RTC chip, an NTP server, the user... (and there's example code for most of those included with the library)

  • GLCD a library to control graphical LCD displays

  • Alarm. Part of the Time library now, lets you call a function at a configured time/date

  • ServoDecode. A library to decode signals from a RC controller

  • TextFinder provides a set of utility functions to make it easier to parse through text received over serial or via ethernet. It lets you search through for given keywords, converts strings into integers or floats, and even help with simple XML parsing.

  • There's also a "Print to file" library to make it easier to switch from outputting to Serial to outputting to a file on an SD card, but that's not on the playground yet.

The libraries I've released aren't on the playground yet (that was one of my big take-away messages from the session), so the links are to my Google code page.


  • DNS client. This is an add-on to the core Ethernet library, and works well alongside Jordan Terrell's DHCP code. Get the DNS server address via DHCP and then use the DNS client to resolve names like "arduino.cc" into IP addresses

  • HttpClient. A library to simplify making requests to web servers, and parses some of the response to extract things like the status code (200, 404, etc.) and the length of the response. Works with Michael's TextFinder library too, and when combined with the B64 library can do basic authentication

  • B64. A library is rather a grand term for this, but some simple code to perform Base64 encoding. Used by HttpClient to perform basic authentication.

  • AtomDateString A library to parse and compare dates in the format defined in the Atom specification.

We also discussed what libraries might be useful, but that we didn't think exist at present. JSON or XML parsing would be useful for interacting with the Web, but the issue there is parsing in a single pass and not storing lots of data in memory (because there isn't enough available) - TextFinder can help with that sort of task, and Michael would be more than happy to discuss extensions or amendments to help with that sort of task. The other suggestion was for a POV (Persistence of Vision) library, which sounds like a useful one given the popularity of POV projects.

Tags:

Posted by Adrian at July 11, 2010 12:35 PM | TrackBack

This blog post is on the personal blog of Adrian McEwen. If you want to explore the site a bit further, it might be worth having a look at the most recent entries or look through the archives or categories over on the left.

You can receive updates whenever a new post is written by subscribing to the recent posts RSS feed or

Comments
Post a comment









Remember personal info?





Note: I'm running the MT-Keystrokes plugin to filter out spam comments, which unfortunately means you have to have Javascript turned on to be able to comment.