SSD1306 :: Core

SSD1306 :: Core POM

License

License

GroupId

GroupId

org.bidib.eu.ondryaso
ArtifactId

ArtifactId

ssd1306-core
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

SSD1306 :: Core
SSD1306 :: Core POM

Download ssd1306-core

How to add to project

<!-- https://jarcasting.com/artifacts/org.bidib.eu.ondryaso/ssd1306-core/ -->
<dependency>
    <groupId>org.bidib.eu.ondryaso</groupId>
    <artifactId>ssd1306-core</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.bidib.eu.ondryaso/ssd1306-core/
implementation 'org.bidib.eu.ondryaso:ssd1306-core:1.0'
// https://jarcasting.com/artifacts/org.bidib.eu.ondryaso/ssd1306-core/
implementation ("org.bidib.eu.ondryaso:ssd1306-core:1.0")
'org.bidib.eu.ondryaso:ssd1306-core:jar:1.0'
<dependency org="org.bidib.eu.ondryaso" name="ssd1306-core" rev="1.0">
  <artifact name="ssd1306-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.bidib.eu.ondryaso', module='ssd1306-core', version='1.0')
)
libraryDependencies += "org.bidib.eu.ondryaso" % "ssd1306-core" % "1.0"
[org.bidib.eu.ondryaso/ssd1306-core "1.0"]

Dependencies

compile (4)

Group / Artifact Type Version
org.bidib.com.pi4j : pi4j-core jar 1.2.M1
org.bidib.com.pi4j : pi4j-device jar 1.2.M1
org.bidib.com.pi4j : pi4j-gpio-extension jar 1.2.M1
org.slf4j : slf4j-api jar 1.7.25

test (3)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.2.3
org.mockito : mockito-core jar 2.12.0
org.testng : testng jar 6.14.2

Project Modules

There are no modules declared in this project.

Java SSD1306 library

Java library for controlling SSD1306-based OLED display (usually the 0.96" mini OLEDs). It's not exactly the fastest thing, but it works quite well.

Based on Adafruit_Python_SSD1306.

You'll need Pi4J library.

Build a JAR file with maven

You need Maven to use the following procedure. Perform the following in the project root folder.

  1. Create the JAR file with the following command: mvn clean package
  2. Start example: sudo java -classpath .:/opt/pi4j/lib/'*' -jar target/ssd1306-0.0.1-SNAPSHOT.jar

This will execute class Pixels which tries to draw a sample image via SPI on the OLED. In case you want to try the I2C bus version (PixelsI2c), execute the following command:

sudo java -classpath .:./target/ssd1306-0.0.1-SNAPSHOT.jar:/opt/pi4j/lib/'*' eu.ondryaso.ssd1306.examples.PixelsI2c

For performance reasons, it is advised to build the JAR on a PC and copy the file afterwards to the Raspberry PI. In case the commands are executed from the same folder where the JAR is located, the target/ has to be omitted.

Connecting

You just have to connect your display to the Raspberry Pi SPI (or I2C) pins. I haven't got the I2C thus I don't know if it'll work. Probably not. Reset pin is not always present and it's not necessary for function. You can use this website for reference.

SPI connection:

Board pin name Physical RPi pin RPi pin name WiringPi pin
DC 16 GPIO23 4
CS 24 GPIO8, CE0 10
MOSI/Data 19 GPIO10, MOSI 12
RST 22 GPIO22 3
CLK 23 GPIO11, SCKL 14
GND 6, 9, 20, 25 Ground
VCC/3V3 1 3V3

I2C connection:

Board pin name Physical RPi pin RPi pin name WiringPi pin
RST 22 GPIO22 3
SDA 3 GPIO2, SDA 8
SCL 5 GPIO3, SCL 9
GND 6, 9, 20, 25 Ground
VCC/3V3 1 3V3

Remember that Pi4J is using WiringPi numbering.

Usage

There are JavaDoc comments in the Display class itself, it should be pretty simple. Also, you can look to the examples.

Versions

Version
1.0