---

Monday, February 20, 2012

Deuligne I2C LCD Shield for Arduino

A few months ago, I wrote a review of two LCD shields. One from Freetronics and one from DFRobot.

On the face of it, this shield could be mistaken for yet another LCD shield. It even has the same 2 x 16 character LCD display of the two I reviewed in November. However this shield from Snootlabs has one very important difference. It is an I2C-based device and that means that rather than use 6 or 7 pins of the Arduino, it just uses A4 and A5. As well as being analog pins on the Arduino, these also double-up as the I2C interface.


I got mine in kit form, and as always the Snootlab's construction instructions were clear and easy to follow.

As well as the display itself, there is a little joystick interface, that is also controlled by I2C, so once again, no Arduino pins taken up.


Because it uses I2C, you do not use the standard LCD Library, but instead, you use a library provided by Snootlabs (see the product's download tab). This library came with a parallel set of examples, like those found in the LCD library.

This library sensibly uses the same names as the LCD library, so you will not find it difficult to use if you have used the LCD library. Here is the hello world example code, for example.


#include "Wire.h"
#include <Deuligne.h>

// initialize the library with the numbers of the interface pins
Deuligne lcd;

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.init();
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}

To gain access to the joystick button presses, you use the method get_key.

lcd.get_key();

-1 means no key pressed
0: Right
1: Up
2: Down
3: Left
4: Select

The headers are the pass-through type, which may seem redundant for a shield that by its nature must be on the top layer, but while you would't put another shield on top, you may want to plug in header pins and the header sockets are low enough below the level of the display for this to be possible.

In addition, the designers have placed an extra set of connector pins next to the headers, to which right-angle connectors could easily be attached.

Conclusion

This is the best LCD shield that I have used. Not just because of the I2C interface. The display is particularly nice and the trimmer pot used to set the contrast much better positioned than the DFRobot module.


About the Author
These are my books. Click on the image below to find out more about them.



No comments: