Why you should learn to program on the Raspberry Pi

In this article “Java vs Python - Which Programming Language Should Programmer Learn First?” by Javin Paul, you can find a comparison between the two most popular programming languages. Of course, as being a Java-developer myself, it’s not a mystery which I would prefer ;-)

But more important than the language, could be the computer you are using! Let me tell you why I think the Raspberry Pi is the perfect getting-started computer…

About the Raspberry Pi

The goal of the Raspberry Pi project was to build an inexpensive PC that is affordable for all. You can connect it to your TV if you don’t have a computer-screen and different versions are available, depending on your budget.

If you want to have a quick start, buy the “Raspberry Pi 4 Desktop Kit” (130€) which includes the board, power supply, HDMI cables, case, and microSD card with the operating system pre-installed. You only need to add a monitor or TV.

Why use a Raspberry Pi?

The price

If you already have a power supply, cables, and/or microSD card, you can buy the board itself starting from 40€. Yep, indeed, that’s the starting price for a complete PC on a small board!

Raspberry Pi OS (full)

There are different operating systems available for the Raspberry Pi, but the perfect starting point is provided by “Raspberry Pi OS (full)” which can be copied to a microSD card with the free “Imager” tool.

When you use this OS you’re ready to start working from minute one as these tools are pre-installed:

I only added “Visual Studio Code” to this list myself. This program is not available through the official website in a version for Raspberry Pi OS, but follow these steps to install it through the terminal:

$ cd /home/pi/
$ wget https://github.com/stevedesmond-ca/vscode-arm/releases/download/1.28.2/
vscode-1.28.2.deb
$ sudo apt install ./vscode-1.28.2.deb

Multiple programming languages

Make your choice: Java, Python, JavaScript,… or start with the basics with Scratch. You can all run and use it on the Raspberry Pi.

And as you can see in the above screenshot, multiple tools are available for all these programming languages.

The GPIOs

When you look at the Raspberry Pi board, you’ll find 40 pins (2 rows of 20). Those are the GPIOs (= General-purpose input/output). Some of those can be used as a digital input or output pin, meaning 0 Volt is off, 3.3 Volt is on. And the number of things you can do with it is amazing!

These GPIOs pins are even one of the main factors which made the Raspberry Pi such a success! As I discussed in a podcast with Adam Bien (airhacks.fm), you can indeed find a cheap second-hand laptop which includes a battery, screen, etc. but you’ll never be able to build experiments which combine soft- and hardware in such an easy way as you can do with the Raspberry Pi.

In this long article on Oracle Java Magazine you can find a detailed step-by-step for a Java application with a user interface to control a LED and show the measurements of a distance sensor on a graph.

The power

The latest Raspberry Pi 4 is fast and available with 2, 4, or 8GB of memory. I wrote a full book on it and created a lot of different Java applications on it. You can connect up to two 4K monitors, so a lot of space to have different applications, terminal, file explorer, etc. Already one such a 4K screen is a programmer’s heaven!

Book “Getting Started with Java on the Raspberry Pi”

If you want to start experimenting with Java on the Raspberry Pi, I can highly recommend my book which guides you through all the steps to get started with a lot of examples.

It’s available as ebook on Leanpub and paper book on Elektor. If you want to dive into the sources of the examples, take a look at this GitHub repository.

Cover of ebook and paper book “Getting Started with Java on the Raspberry Pi”