Raspberry Pi history, versions, pins and headers as a Java Maven library

The best way to understand and learn something new, is to document it yourself. That’s what I’m doing in every step for my book-in-progress. And to fully get the pinnings and headers of the different Pi-boards, I decided to gather all info into a Java library with different enums to be able to auto-generate some content for the book and use in a few different example applications.

Maven repository

A first version is now available on Maven, but will definitely be further extended as I’m working on the content of the book.

Source code

The sources are available on GitHub. For example the list of available pin types:

public enum PinType {
    POWER("Power", 0x990000),
    GROUND("Ground", 0x000000),
    DIGITAL("Digital", 0x009900),
    DIGITAL_AND_PWM("Digital and PWM", 0xff7ff00),
    DIGITAL_NO_PULL_DOWN("Digital without pulldown", 0x800080);

    ...
}

Example application: JavaFX visualization

As an example in the book this library is used to automatically generate this JavaFX view of a Pi header:

Auto-generated README

Some code in the sources (UpdateReadme.java) automatically generates a new readme file with all the info from the enums.

Pi models

NameLabelDescription
MODEL_AModel AWithout ethernet connector
MODEL_BModel BWith ethernet connector
COMPUTECompute ModulePi on a 200-pin DDR2-memory-like module for integration in embedded devices
ZEROZeroSmaller size and reduced GPIO capabilities

Pi major versions

NameLabelDescriptionHeaders
VERSION_1Version 1First generation26pin header
VERSION_2Version 2Added more RAM26pin header + 8pin header
VERSION_3Version 3Including WiFi and Bluetooth40pin header
VERSION_4Version 4Gigabit ethernet, USB 3.0 and dual monitor40pin header

Pi board versions

NameLabelModelVersionRelease date
MODEL_1_APi 1 Model AMODEL_AVERSION_12013-02
MODEL_1_A_PLUSPi 1 Model A+MODEL_AVERSION_12014-11
MODEL_3_A_PLUSPi 3 Model A+MODEL_AVERSION_32018-11
MODEL_1_BPi 1 Model BMODEL_BVERSION_12012-04
MODEL_1_B_PLUSPi 1 Model B+MODEL_BVERSION_12014-07
MODEL_2_BPi 2 Model BMODEL_BVERSION_22015-02
MODEL_2_B_V2Pi 2 Model B V1.2MODEL_BVERSION_22016-10
MODEL_3_BPi 3 Model BMODEL_BVERSION_32016-02
MODEL_3_B_PLUSPi 3 Model B+MODEL_BVERSION_32018-03
MODEL_4_BPi 4 Model BMODEL_BVERSION_42019-06
COMPUTE_1Compute Module 1COMPUTEVERSION_42014-04
COMPUTE_3Compute Module 3COMPUTEVERSION_42017-01
COMPUTE_3_LITECompute Module 3 LiteCOMPUTEVERSION_42017-01
COMPUTE_3_PLUSCompute Module 3+COMPUTEVERSION_42019-01
COMPUTE_3_PLUS_LITECompute Module 3+ LiteCOMPUTEVERSION_42019-01
ZERO_PCB_1_2Pi Zero PCB V1.2ZEROVERSION_22015-11
ZERO_PCB_1_3Pi Zero PCB V1.3ZEROVERSION_32016-05
ZERO_WPi Zero WZEROVERSION_42017-02

Pin types

NameLabelColor
POWERPower#990000
GROUNDGround#0
DIGITALDigital#9900
DIGITAL_AND_PWMDigital and PWM#ff7ff00
DIGITAL_NO_PULL_DOWNDigital without pulldown#800080

Pin functions

NameLabelDescription
UARTUniversal Asynchronous Receiver and TransmitterAsynchronous serial communication protocol
GPCLKGeneral Purpose ClockOutput a fixed frequency
I2CInter Integrated CircuitSynchronous serial computer bus
SPISerial Peripheral InterfaceFour-wire serial bus

Header types

8pin header

Pin n°TypeFunctionBCM n°Wiring pi n°NameRemark
1POWER5.0 VDC
2POWER3.3 VDC
3DIGITAL2817
4DIGITAL2918
5DIGITAL3019
6DIGITAL3120
7GROUNDGround
8GROUNDGround

26pin header

Pin n°TypeFunctionBCM n°Wiring pi n°NameRemark
1POWER3.3 VDC
2POWER5.0 VDC
3DIGITAL_NO_PULL_DOWNI2C28SDA1 (I2C)SDA.1 pin has a physical pull-up resistor
4POWER5.0 VDC
5DIGITAL_NO_PULL_DOWNI2C39SCL1 (I2C)SCL.1 pin has a physical pull-up resistor
6GROUNDGround
7DIGITALGPCLK47GPCLK0
8DIGITALUART1415UART TxD
9GROUNDGround
10DIGITALUART1516UART RxD
11DIGITALSPI170
12DIGITAL_AND_PWMSPI181PCM_CLK/PWM0Supports PWM0 [ALT5]
13DIGITAL272
14GROUNDGround
15DIGITAL223
16DIGITAL234
17POWER3.3 VDC
18DIGITAL245
19DIGITALSPI1012MOSI (SPI)
20GROUNDGround
21DIGITALSPI913MISO (SPI)
22DIGITAL256
23DIGITALSPI1114SCLK (SPI)
24DIGITALSPI810CE0 (SPI)
25GROUNDGround
26DIGITALSPI711CE1 (SPI)

40pin header

Pin n°TypeFunctionBCM n°Wiring pi n°NameRemark
1POWER3.3 VDC
2POWER5.0 VDC
3DIGITAL_NO_PULL_DOWNI2C28SDA1 (I2C)SDA.1 pin has a physical pull-up resistor
4POWER5.0 VDC
5DIGITAL_NO_PULL_DOWNI2C39SCL1 (I2C)SCL.1 pin has a physical pull-up resistor
6GROUNDGround
7DIGITALGPCLK47GPCLK0
8DIGITALUART1415UART TxD
9GROUNDGround
10DIGITALUART1516UART RxD
11DIGITALSPI170
12DIGITAL_AND_PWMSPI181PCM_CLK/PWM0Supports PWM0 [ALT5]
13DIGITAL272
14GROUNDGround
15DIGITAL223
16DIGITAL234
17POWER3.3 VDC
18DIGITAL245
19DIGITALSPI1012MOSI (SPI)
20GROUNDGround
21DIGITALSPI913MISO (SPI)
22DIGITAL256
23DIGITALSPI1114SCLK (SPI)
24DIGITALSPI810CE0 (SPI)
25GROUNDGround
26DIGITALSPI711CE1 (SPI)
27DIGITAL_NO_PULL_DOWNI2C030SDA0 I2C ID EEPROMSDA.0 pin has a physical pull-up resistor
28DIGITAL_NO_PULL_DOWNI2C131SCL0 I2C ID EEPROMSDC.0 pin has a physical pull-up resistor
29DIGITALGPCLK521GPCLK1
30GROUNDGround
31DIGITALGPCLK622GPCL2
32DIGITAL_AND_PWM1226PWM0Supports PWM0 [ALT0]
33DIGITAL_AND_PWM1323PWM1Supports PWM1 [ALT0]
34GROUNDGround
35DIGITAL_AND_PWMSPI1924PCM_FS/PWM1Supports PWM1 [ALT5]
36DIGITALSPI1627
37DIGITAL2625
38DIGITALSPI2028PCM_DIN
39GROUNDGround
40DIGITALSPI2129PCM_DOUT