98 January & February 2021 http://www.elektormagazine.com
I also joined the Pi4J-team. Pi4J is a frame-
work and library to combine Java applica-
tions with the full power of the GPIOs of
the Raspberry Pi. This project was started
by Robert Savage, and he was looking for
extra team members to bring this project to
a new generation which fully supports Java
11+ and the Raspberry Pi 4 with Java modules
and an easily extendable architecture. I’m
really excited about the second version of this
framework, which we hope to release soon.
Abate: Let’s return to the book, Getting
Started with Java on the Raspberry Pi. Why
did you write it?
Delporte: When starting the drum booth
project, I had to find out how to use Java on
the Raspberry Pi, how to install the right
version of JavaFX, how to control the GPIO
and an Arduino, etc. That’s when I wrote my
first article [9], which was published in MagPi
(July 2019, Dutch [10] and French [11] edition).
Elektor contacted me and asked if this
could be the subject of a book. As I couldn’t
find a recent one on this topic and Java
had some major changes in the last years,
this question really triggered me and the
next day I started writing. It took me more
than six months and a lot of evening and
nights, but I really had fun while writing
and experimenting. And, of course, I hope
it’s as much fun to read the book and try out
the projects that I included.
Abate: Do you have any advice for engineers
or makers who are thinking about using Java
for their Raspberry Pi-based designs?
Delporte: Try it, really! Java is still one of
the top programming languages world-
wide. Whether you are an experienced
Java developer or starting from scratch,
there is a lot to learn and experiment when
experience with Arduino and Raspberry
Pi. They brought there kits to the club, and
I was really amazed of the power of these
inexpensive boards and what you can
achieve with them combined with small
electronic components.
I was blogging already for some time, but
my first “public” Raspberry Pi-project was
indeed this Pong game that we used on
some activities of the school of my son.
I used Python for the user interface; but
I have to be honest, I didn’t like to code
it very much. For that kind of applica-
tion, I really prefer JavaFX for which there
is even a very nice gaming framework:
FXGL [6].
Abate: Do you have any RPi-based designs
or applications running at home or in your
workspace?
Delporte: I started with Java on the
Raspberry Pi to build a drum booth control-
ler [7] for my son. It’s a touch-screen user
interface to control multiple lights with a
relay-board and LED strips controlled by
Arduino (Figure 3).
This way I learned to use serial communi-
cation between the two boards and I²C to
control the relays. In my book, I extended
this further and used a Mosquitto queue to
exchange messages between more boards
and PCs.
Abate: What else are you working on these
days? New projects, programs, or books?
Delporte: I’m further experimenting with
Java on the Raspberry Pi, of course. I wrote
some more blog posts on this subject and also
experimented with other Java technologies
(Quarkus [8], Spring, GraalVM) and 64-bit
operating systems on the board.
Since I started experimenting with Java
on Raspberry Pi, I got involved in some
open-source projects and discussions, and
that’s a complete new world to me, where
I meet a lot of very bright people who are
also willing to share their knowledge and
experience. Still every day I’m amazed by
the stuff you can learn from these projects
and people. You don’t have to contribute
code, but you can also join such a project
by reviewing pull requests, helping to test
or document the code.
Abate: Are you anti-Python or anti-C? I
assume you aren’t, but I have to ask.
Delporte: Definitely not! I hate haters.
There are no bad programming languages!
I once read a quote which says, “The best
tool for the job is the one you know the
best.” In my case, that’s Java and JavaFX if
I want to make an application with a nice
user interface. But in my book, I also used
Python to control a LED number display
and an Arduino with LED strips.
For each project (Figure 2), you must make
a decision what the best tool, programming
language or framework is. And once you’ve
decided, go for it! Maybe you’ll realize later
you didn’t make the best choice, but at least
you will have learned new things.
Working with Java on the
Raspberry Pi
Abate: You have been blogging about technol-
ogy since 2007. It looks like your first post
about Rapsberry Pi was “Pong on a Raspberry
Pi” [5] (December 2017). Can you tell us about
your first experiences and projects with RPi?
When did you get started with it?
Delporte: When I started with CoderDojo,
there were some coaches who already had
Figure 3: The drum booth controller’s installed components. Figure 4: Rainbow effect selected for LED strips.