Pin Numbering - LeMaker BananaPi

Platform Configuration

Unlike the RaspberryPi, to use the BananaPi board you must first configure the Pi4J library to use an alternate platform implementation.

There are three methods to configure the platform. You are free to use any of these three methods.

  • Method 1 : Environment Variable

    You can set the "PI4J_PLATFORM" environment variable to a value of "bananapi".

  • Method 2 : Java System Property

    You can configure a Java system property named "pi4j.platform" to a value of "bananapi".

  • Method 3 : Inline Java Code

    You can configure the platform in your Java code before you instantiate the Pi4J controller instance.

    // ####################################################################
    //
    // since we are not using the default Raspberry Pi platform, we should
    // explicitly assign the platform as the BananaPi platform.
    //
    // ####################################################################
    PlatformManager.setPlatform(Platform.BANANAPI);

Numbering Scheme

Pi4J uses an abstract pin numbering scheme to help insulate software from hardware changes.
Pi4J implements the same pin number scheme as the Wiring Pi project. More information about the WiringPi pin number scheme can be found here: http://wiringpi.com/pins/

Pi4J provides a BananaPiPin enumeration that is used to manage the accessible GPIO pins.

Expansion Headers

The BananaPi board contains a 26-pin expansion header labeled as 'CON3' providing access to 17 GPIO pins. The board also includes an 8-pin expansion header labled as 'J12' that provides an additional 4 GPIO pins.
(The CON3 and J12 headers are illustrated below)

CON3 Pinout (26-pin Header)

The diagram below illustrates the GPIO pinout using the Pi4J/WiringPi GPIO numbering scheme.

(click here for hi-resolution image)

J12 Pinout (8-pin Header)

The diagram below illustrates the GPIO pinout using the Pi4J/WiringPi GPIO numbering scheme.

(click here for hi-resolution image)

Examples

A number of source code examples are provided to demonstrate the following capabilities/integrations:

  • GPIO Input read state for single pin
  • GPIO Input read state for all pins
  • GPIO Input event listener for a single pin
  • GPIO Input event listener for all pins
  • GPIO Output
  • I2C Communication
  • SPI Communication
  • Serial/UART Communication
  • Hardware-based PWM (1 hardware PWM pin supported)
  • Software-based PWM
  • System Info

View BananaPi Examples

Additional Resources