Device::BCM2835::LCD - Perl extension for driving an HD44780 LCD from a Raspberry Pi's GPIO port


Version 0.02


    use Device::BCM2835::LCD;

    # Init display, specifying the GPIO pin connections 
    my $foo = Device::BCM2835::LCD->new();
        Display => 2004,
        RPI_PIN => V2,
        pin_rs => RPI_GPIO_P1_24,
        pin_e => RPI_GPIO_P1_23,
        pin_d4 => RPI_GPIO_P1_07,
        pin_d5 => RPI_GPIO_P1_11,
        pin_d6 => RPI_GPIO_P1_13,
        pin_d7 => RPI_GPIO_P1_15
     # print text to the screen 
     # move cursor to line 2, col 0
     # print text on second line

     # Clear the LCD screen

     # bignums - position, number
     # display "123"



init([pin_rs => $pin], [pin_e => $pin], [pin_d4 => $pin] .. [pin_d7 => $pin], [RPI_PIN => V1] )

Initialises the LCD display, using either the default wiring arrangement or the pins specified with init(). RPI_PIN refers to the P1 header GPIO mapping scheme. Early boards use 'V1', B+ and revision 2 boards use RPI_PIN V2. The default is V2 pinout.

Default wiring is: pin_rs => RPI_GPIO_P1_24 pin_e => RPI_GPIO_P1_23 pin_d4 => RPI_GPIO_P1_07 pin_d5 => RPI_GPIO_P1_11 pin_d6 => RPI_GPIO_P1_13 pin_d7 => RPI_GPIO_P1_15 RPI_PIN => V2


        Moves the cursor to the specified position.
        The top/left position of a 20x4 LCD is (1,0),
        with the bottom/right being (4,19)


        Clears all characters from the display


        writes the string $msg to the display starting
        at the current cursor position.
        Note that a 4 line display will wrap line 1 to 3, and 2 to 4.


        Delay for $milliseconds ms. 


        Displays $digit in 4x4 large font at position $position.
        A 20x4 display has 5 positions (0-4), a 16x4 display has 4.
        This will only work with 4 line displays.


        Writes command $instruction to the display.
        Useful instructions are:
        cmd(1) - clear display
        cmd(8) - switch off display
        cmd(12) - switch on display


Joshua Small, <josh at>


Please report any bugs or feature requests to bug-device-bcm2835-lcd at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


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

    perldoc Device::BCM2835::LCD

You can also look for information at:

* RT: CPAN's request tracker (report bugs here)

* AnnoCPAN: Annotated CPAN documentation

* CPAN Ratings

* Search CPAN



Copyright 2015 Joshua Small.

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.