Jonathan Stowe


Device::PiLite - Interface to Ciseco Pi-Lite for Raspberry Pi


    use Device::PiLite;

    my $pilite = Device::PiLite->new();


        $p->text("This is a test");



This module provides an interface for the Ciseco Pi-Lite for the Raspberry Pi.

The Pi-Lite has a 14 x 9 grid of LEDs controlled by an embedded ATMEL AVR microcontroller that itself can be programmed using the Arduino toolchain, however the default firmware provides a relatively simple mechanism to communicate with the board from the Raspberry Pi's TTL serial port.

Device::PiLite requires the default firmware and will not work if the Pi-Lite is loaded with some other sketch.


By default most Linux distributions for the Raspberry Pi will use the serial port for a console, this will interfere with the functioning of the Pi-Lite. Before you try to use the device you will need to turn this off, and instructions for a Debian based distribution can be found at:

If you are using a distribution with a different base (such as e.g. Pidora,) it may use systemd rather than an inittab to start the console process and you will need to use systemctl to disable the getty service. You will still need to alter the cmdline.txt as described in the above instructions.

Any users that want to access the Pi-Lite will need to be in the dialout group, which can be done by doing:

        sudo usermod -a -G dialout username

at the command line, where username is the user you want to add to the group.



This is the name of the serial device to be used.

The default is "/dev/ttyAMA0". If it is to be set to another value this should be provided to the constructor.


This is the Device::SerialPort that will be used to perform the actual communication with the Pi-Lite, configured as appropriate.

This delegates a number of methods and probably doesn't need to be used directly.


Turns all the LEDs on.


Turns all the LEDs off.


Turns the pixels on or off depending on the boolean supplied.


This sets the scroll delay in milliseconds per pixel. The default is 80 (that is to say it will take 1.120 seconds to scroll the entire width of the screen.)


This writes the provided test to the Pi-Lite. Scrolling as necessary at the configured rate.

It won't return until all the text has been displayed, but you may want to pause for $columns * $scroll_rate milliseconds before doing anything else if you want the text to completely scroll off the screen.

The ability or otherwise to display non-ASCII characters is entirely the responsibility of the firmware on the Pi-Lite (it uses a character to pixel map to draw the characters.)


This writes every pixel in the Pi-Lite in one go, the argument is a 126 character string where each character is a 1 or 0 that indicates the state of a pixel, starting from 1,1 (i.e. top left) to 14,9 (bottom right.)


The bargraph comprises 14 columns with values expressed as 0-100% (the resolution is only 9 rows however,) The takes the column number (1-14) and the value as arguments and sets the appropriate column.


This sets one channel of the "vu meter" which is a horizontal two bar graph, with values expressed 1-100%. The arguments are the channel number 1 or 2 and the value.


Turns the pixel specified by $column, $row on.


Turns the pixel specified by $column, $row off.


Toggles the pixel specified by $column, $row .


This performs the specified action 'ON' (1), 'OFF' (0), 'TOGGLE' (2) on the pixel specified by column and row. This is used by pixel_on, pixel_off and pixel_toggle internally but may be useful if the state is to be computed.


This scrolls by the number of columns left or right, a negative value will shift to the right, positive shift to the left.

Once a pixel is off the display it won't come back when you scroll it back as there is no buffer.


This displays the specified single character at $column, $row.

If the character would be partially off the screen it won't be displayed.

As with text() above, this is unlikely to work well with non-ASCII characters.


This is the number of columns on the Pi-Lite. This is almost certainly 14.


Returns a boolean to indicate whether it is an integer between 1 and columns.


This is the number of rows on the Pi-Lite. This is almost certainly 9.


Returns a boolean to indicate whether it is an integer between 1 and rows.


Return a boolean to indicate $value is greater ot equal to 1 and smaller or equal to $bound.


A Pi-Lite serial command sequenced is introduced by sending '$$$'.


Write the prefix to the device. And wait for the response 'OK'.

It will return a boolean value to indicate the success or otherwise of the write.


This sends a command to the Pi-Lite, sending the command prefix and the command constructed by $format and @arguments which are dealt with by _build_command.


This returns the command string constructed from the sprintf format specified by $format and the set of replacements in @arguments.


Jonathan Stowe, <jns at>


This appears to work as documented but it is difficult to test that the device behaves as expected in all cases automatically.

Automated test reports indicating failure will be largely ignored unless they indicate a problem with the tests themselves.

Please feel free to suggest any features with a pull request at:

though I'd be disinclined to include anything that would require a change to the device's firmware as this is somewhat tricky to deploy.

You can report bugs to but you should consider whether it is actually a bug in this code or that of the device, you can find the source for the firmware at:


You can find documentation for this module with the perldoc command.

    perldoc Device::PiLite




Copyright 2014 Jonathan Stowe.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.