Spectacular Java projects on Raspberry PiOriginal post on foojay.io — a place for friends of OpenJDK
Thanks to Twitter and LinkedIn I got into contact with several developers who are doing Java stuff on Raspberry Pi and I want to share those projects with you as they can be an inspiration for all of us to get started with Java development on the Raspberry Pi.
Igor Souza - Kafka on the Raspberry Pi
Igor shared this nice video where he set up a Kafka cluster on Raspberry Pi. He also has a nice example where this is combined with an e-ink display to show real-time bus information. Some of his work is available on GitHub where you can find Kafka and other example code.
This week he also published a very nice example using Quarkus, Qute, and Pi4J to control a LED number display. The sources for this project are also available on GitHub.
Roberto Marquez - GPIO and JavaFX
This project by Roberto uses the Raspberry Pi GPIOs to detect button presses for a game. JavaFX APIs were used to present the user interface on the Raspberry Pi’s frame buffer. The project is further described on the Adafruit website and the code is available on GitHub.
Shamika Dalvi - Several projects with Java and Pi4J
Shamika has multiple example projects on here website cubeminx.com. One demonstrates how you can control an OLED display using Java and Pi4J, while another one shows how to do UART communication between a Raspberry Pi and Arduino, also using Pi4J. The data received on the Raspberry Pi is stored in a MySql database that can be read by a Java web application. Click on the “Machinestate > Machine” button on cubeminx.com to see the result.
Greg Flurry - Autonomous robot
On instructables.com you can find two nice manuals created by Greg. The first one is “Efficient Java Development for the Raspberry Pi” and describes how he uses NetBeans to build Java programs for the Raspberry Pi. A second post is pretty spectacular as he has built “An Autonomous Rover” which travels from one location in his house to another, with no help from a human, using Java code. He didn’t share the Java code itself as it is very specific for his hardware, but describes all the steps he took to select the hardware and pseudocode to control his rover.
Daniel Mårtensson - PiJukeBox
Daniel used Java and Pi4J to turn an old Centrum U68 from 1940 into a MP3 player. The reason is that short wave, middle wave and long wave is today obsolete and not being used or sent in Sweden. Also, the electronics inside was a mess and very dangerous because it runs on both AC/DC current and all the wires began to lose their isolators.
Features: auto-play next song, 60 songs included, volume tuning, song select, low power consumption, works on old Raspberry Pi’s, terminal-based.
With a Raspberry Pi B+, OpenJDK 8, and Pi4J inside this radio, it became a jukebox. The sources are available on github.com/DanielMartensson/PiJukeBox.
Another project of Daniel, called “OpenSourceLogger” which is also shared on GitHub, provides a web application with Pi4J and Vaadin to control and measure analog inputs and outputs and store them into a MySQL database (requires a Raspberry Pi 4).
Frank Delporte - Drumbooth controller
The main advantage of being the writer of an article? You can sneak in one of your very own projects :-)
Based on several example applications from my book “Getting Started with Java on Raspberry Pi”, I created a touch-screen JavaFX application for the drum booth of my son. He can use it to control 8 relays (for various lights on different voltages) and LED strips attached to an Arduino board. The application also contains a webserver, so we can trigger a “red alert” from anywhere in the house from our phone or PC to let him know dinner is on the table when we are too lazy to go up the stairs.
The full project is described in this blog post and both the Java and Arduino sources are available on GitHub.
openjfx.io - Community examples
If you need more JavaFX-inspiration to build beautiful user interfaces, check out the many JavaFX tools and frameworks listed on openjfx.io. There is even a full game engine based on Java and JavaFX in that list: FXGL.