Developing applications for Raspberry Pi or Linux

Depending on: project’s scope, business expectations, your knowledge and Raspberry Pi’s role you can develop software for RPi in mainly three ways:

  1. Turn Raspberry Pi into API-like webserver with node.js and do all the programming in clients.
  2. Develop a HTML/CSS/JS application
  3. Develop an native Raspberry Pi app

All of the above require you to:

  • Develop a regular Linux app
  • Optimised to use hardware and computing power of Raspberry Pi
  • Run it in Raspbian OS or any other Linux distribution of your choice

And, if you really want to get your hands dirty and truly have no limits then you must forget about Linux and start thinking about Ultibo (there’s a separate article for that).

Developing in Ultibo (or similar complete embedded development environment) requires a lot of expertise, development knowledge and practice. And simply isn’t an option for all. Especially, if you only need to build a quick-and-easy app for RapberryPi. For these purposes this article lists details about RPi development.

Contents

Building for RPi

You can program your Raspberry Pi in generally three ways:

  1. Turn Raspberry Pi into API-like webserver with node.js and do all the programming in clients:
    1. All the logic is in your thin client or clients
    2. Develop an language and platform of your choice
    3. I.e. web application in React run in your favourite browser
    4. Send and receive JSON to/from RPi like you’d with any API server
    5. Your Raspberry only reads and sets GPIO pins (or other ports) reacting to your API requests
    6. This way you can control any device connected to GPIO in any way you would like
  2. Develop a HTML/CSS/JS application:
    1. You can use Electron (baked by Cordova?), AppJS, Quark, Tauri and many more
    2. Develop your logic and design just as you’d do with rich web page or web application
    3. Build it / embed it with an executable header (mostly web view for the OS of your choice)
    4. Install and run it on Raspbian OS or any other RPi-based Linux distro
  3. Develop an native Raspberry Pi app:
    1. Requires a bit more programming skills and experience
    2. But unleashes maximum possibilities with virtually no limits
    3. Develop using Visual Studio or Xojo (either paid or free)
    4. Develop for Raspberry Pi in any way as you would do for any Linux distro

But… there’s always a Linux in the equation.

Raspbian OS in the background.

Each of above approaches:

  • Requires different level of expertise
  • Consumes more or less time and thus is or isn’t costly
  • Gives some possibilities, but also sometimes hit the wall
  • Has less or more strict approach into security of the developed app

As said, each of listed approaches requires you to have any Linux distribution behind your app, acting like an operating system. They can be big or small, but they still are. If that’s a problem for you then a complete embedded development environment like Ultibo seems to be the only option.

Which one should I choose?

I can’t answer that. No one can, except for you.

As said in the introduction, decision must be made depending on:

  • Project’s scope
  • Business expectations
  • Your knowledge and experience and
  • Raspberry Pi’s role in particular scenario.

If you truly unsure, but have some spare time (for both learning curve and development) then consider… trying all of them.

What would you do?

In my case, developing an native Raspberry Pi app was out of option for many reasons:

  • I don’t have enough hands-on knowledge
  • I can build only one platform solution out of single code base
  • In most RPi projects I’ve been so far we simply didn’t need the flexibility this approach gives
  • And in the same time our budget didn’t allow to hire a professional native Linux apps’ developer

Because I am an API and multi-platform fascist, in all Raspberry Pi-based projects that I recall so far (and actually in all development projects, I’ve been in since 2015) we used second approach:

  1. We had some API server, written by ourselves in PHP or someone else in Java or Node.js
  2. We were building a HTML/CSS/JS application from the same base as views for webpage
  3. Out of single codebase we could build: web page or web app, mobile application and RPi application
  4. Because of the same API server and single codebase the exchanged data was the same in all scenarios

But, I can easily think about many scenarios that uses first approach — i.e. turning Raspberry Pi into API server itself and doing all the logic in thin clients.

Leave a Reply