Monday, May 21, 2012

An SSD1306 LCD controller in Perl for the BeagleBone

I've been hacking away on the BeagleBone some more, and I've come up with a controller for the common SSD1306 LCD controller, using the SPI interface. This controller is behind a bunch of the available small graphical LCD panels out there.

I've also written supporting libraries to display both text and PNG files, although don't expect too much from a 128x32 monochrome image!

I've uploaded my notes and libraries here:
https://github.com/TJC/BeagleBone

Coding it is as simple as:

my $lcd = BeagleBone::SSD1306::Text->new(
  rst_pin => 'P9_15',
  dc_pin => 'P9_16',
  # remainder of pins must be connected to SPI pins
);
$lcd->display_string("Hello world!");

7 comments:

  1. This is great! Your whole github repo looking like a great start to a bonescript alternative!

    ReplyDelete
  2. I hope you don't mind if I re post your blog =)

    ReplyDelete
  3. Sure, go ahead! :)

    It's not quite there yet -- I haven't imported the whole range of pin-to-gpio ranges yet, and there's no ADC or PWM support yet at all..
    But I'll get to those soon enough, and the digital GPIO is working nicely already.

    ReplyDelete
    Replies
    1. Have you gotten to the ADC, etc., yet? I'd be interested, for the BeagleBone Black.

      Delete
    2. Unfortunately my code was all targetted at the original Beaglebone, and thus the earlier Linux kernels with much simpler pin muxing. So it doesn't work at all on the Black or later revisions.

      Delete
  4. awesome! is there plans for c/c++ and I2C support? i just got a beaglebone black and wanted to learn about I2C.

    ReplyDelete
  5. I haven't done much with i2c myself, sorry.
    I've written some support for the SSD1306 in C for a project, but I didn't build it into a library to be released. I'm sure there's already some stuff out there for C/C++ though, since that's the language used by Arduinos.

    It's worth noting that my perl library above was targetted for the original beaglebone pin-muxing, which doesn't work on the 3.8.x kernels used by the beaglebone black.

    ReplyDelete