Building an Electronics Project with Java, Maven, and Pi4J on Raspberry Pi with Visual Studio Code
On Thursday 29th of May, Raspberry Pi announced a new $75 board with 8GB RAM, a very small but powerful computer. This new board comes next to the ones with 2GB (35$) and 4GB (55$) which have the same processor and ports.
Some time ago I bought the 4GB version and combined it with a 4K display and was really amazed by the power of this board. On the screenshot, you can see it running with two Visual Studio Code windows, Arduino IDE and some others…
The MagPi Magazine
Based on my experience to get started with Java development on the Raspberry Pi, I wrote two articles for The MagPi Magazine which is published by the Raspberry Pi Foundation and can be freely downloaded or bought in paper version from their website:
- Issue #93: Learn Java and Electronics (page 50)
- Issue #94: Java electronics: build a Maven app (page 54)
These two articles describe every step required to start Java development on the Raspberry Pi with Maven in Visual Studio Code. The Pi4J framework is also used to control a LED and read the state of a button connected to the GPIO’s of the Raspberry Pi board.
To make everything more clear, this video shows every step described in the articles:
64-bit Raspbian OS
Raspbian OS is the default operating system for the Raspberry Pi, but is now only available in a 32-bit version which means “only” 3GB can be used per process. The same day as the 8GB board was announced, a post describing the beta test version of a 64-bit Raspbian OS was published on the forum. This will allow to install 64-bit software (e.g. the latest version of Visual Studio Code) which can use more memory.
Boot from USB storage
One of the weak points of the Raspberry Pi is the SD card with the OS. It can get corrupted, for instance, if you cut the power. But there is also a beta test solution that allows us to use a USB storage device.
When 8GB RAM + 64-bit OS + USB mass storage boot get past the beta stage, the Raspberry Pi will become an even stronger PC for everyday use at a very low price! I’m really looking forward to upgrade my home office… :-)