HiPi
Perl Modules for Raspberry Pi
Version 0.67 - released 08 October 2017

HiPi::RaspberryPi

Provides information about your Raspberry Pi board.

Methods

Create a new instance of HiPi::RaspberryPi

use HiPi::RaspberryPi;
my $pi = HiPi::RaspberryPi->new();

Dumps information about your Raspberry Pi board.

print $pi->dump_board_info;

The method produces output similar to the following:

pi@raspberry:~ $ perl -MHiPi::RaspberryPi -e"print HiPi::RaspberryPi->new->dump_board_info;"
--------------------------------------------------
Raspberry Pi Board Info
--------------------------------------------------
Model Name       : Raspberry Pi 3 Model B Rev 1.2
Released         : Q1 2016
Manufacturer     : Sony
Memory           : 1024
Processor        : BCM2837
Hardware         : BCM2835
Description      : Type 3 40 pin GPIO header
Revision         : a02082
Serial Number    : 0000000012345678
GPIO Header Type : 3
Device Tree      : Yes

Information for the individual lines is produced using other module methods

use HiPi::RaspberryPi;
my $pi = HiPi::RaspberryPi->new();

# Model Name
my $modname = $pi->model_name();

# Released
my $released = $pi->release_date();

# Manufacturer
my $manu = $pi->manufacturer();

# Memory
my $mem = $pi->memory();

# Processor
my $proc = $pi->processor();

# Hardware
my $hware = $pi->hardware();

# Description
my $desc = $pi->board_description();

# Revision
my $rev = $pi->revision();

# Serial Number
my $serial = $pi->serial_number();

# GPIO Header Type
my $type = $pi->gpio_header_type();

Returns a descriptive model name for the Raspberry Pi board

my $mname = $pi->model_name();

Returns the release date for the Raspberry Pi board

my $date = $pi->release_date();

Returns the manufacturer name for the Raspberry Pi board

my $manu = $pi->manufacturer();

Returns the amount of memory for the Raspberry Pi board in Mb

e.g. 256, 512 or 1024

my $mem = $pi->memory();

Returns the Processor as displayed by cat /proc/cpuinfo

The Raspberry Pi 3 returns BCM2837. The Raspberry Pi 2 returns BCM2836. All other models return BCM2835

my $proc = $pi->processor();

Returns the Hardware as displayed by cat /proc/cpuinfo

This may be BCM2708, BCM2709 or BCM2835 depending on your board model and the version of Raspbian installed. This isn't a good method to determine the capabilites of your board. Use the other methods for that.

my $hware = $pi->hardware();

Returns a description for the Raspberry Pi board based on the GPIO header type

my $btype = $pi->board_description();

Returns the Revision as displayed by cat /proc/cpuinfo. This can be used to determine the capabilities of the board

my $rev = $pi->revision();

Returns the unique serial number for your Raspberry Pi.

my $serial = $pi->serial_number();

Returns a number representing the type of GPIO header on your board

1      26 pin header for the first Model B's with different pin out for the i2c device
2      26 pin header for the Model B rev 2 and Model A
3      40 pin header for the Pi 3, Pi 2, B+, A+, Zero and Zero Wire
4      Compute Module 3
my $type = $pi->gpio_header_type();