DEV Community

Cover image for From Mobile Simplicity to Pi Complexity
Mihai Chiorean
Mihai Chiorean

Posted on

From Mobile Simplicity to Pi Complexity

As a backend developer with a solid grounding in Linux and a fair share of experience in mobile development for both Android and iOS, I recently decided to venture into the world of Raspberry Pi 5. I naively assumed that setting up a Raspberry Pi would be as straightforward as plugging in an Android device or an iPhone and hitting the run button in my IDE. Spoiler alert: it wasn’t.

The Illusion of Plug and Play

In mobile development, we’re spoiled by the simplicity of connecting a device via USB and seamlessly deploying our code. The development environments are mature, and the tooling is designed to minimize friction. With Raspberry Pi, I quickly realized that this convenience doesn’t translate.

The OS Conundrum

The first hurdle was choosing an operating system and flashing it onto an SD card. Unlike mobile devices that come with a pre-installed OS, the Raspberry Pi requires you to select and install one yourself. Options like Raspberry Pi OS, Ubuntu, and others each come with their own quirks and compatibility considerations. This step isn’t just a minor setup task; the choice of OS affects not only performance but also the tools and libraries available to you and it’s a critical decision that affects the entire development experience.

The Peripheral Predicament

Most online resources assume you’re plugging in peripherals like a mouse, keyboard, and monitor directly into the Raspberry Pi and doing development on the device itself. However, this approach can be impractical for developers who might not have these peripherals readily available. Instead, we often have powerful laptops with our own development environments already set up — complete with local dotfiles, custom IDE configurations, and personalized editor settings. Recreating all of this on a single-board computer feels counterintuitive when we could leverage our existing setups.

The USB-C Connectivity Challenge

Attempting to connect the Raspberry Pi 5 to my MacBook Pro via USB-C didn’t yield the immediate connection I expected. There was no automatic recognition, no prompt to trust the device, nothing. It turns out that setting up USB networking with the Raspberry Pi requires additional configuration. I stumbled upon this guide, which, while helpful, was far from trivial. It involved modifying configuration files and setting up network interfaces manually.

SSH: A Necessary Evil?

Some developers might not have peripherals like a mouse, keyboard, and monitor readily available, making SSH the default method of interaction despite its learning curve.

Once the OS is installed, connecting to the Raspberry Pi becomes the next challenge. For many, SSH emerges as the primary means of interaction. However, not everyone has extensive experience with SSH, and setting it up can introduce additional complexities.

Relying on SSH adds another layer of detachment from the development process. Instead of the immediate feedback loop we’re accustomed to, every code change requires building and deploying over an SSH connection — often without the safety net of an interactive debugger. This can significantly disrupt the development workflow, especially when compared to the seamless experience of mobile development environments.

The IDE and Development Stack Dilemma

In mobile development, IDEs like Xcode and Android Studio provide a rich set of tools, including debugging, breakpoints, and seamless deployment. With the Raspberry Pi, there’s no out-of-the-box IDE that offers this level of integration. You’re faced with choosing a development stack that may or may not support all the features you need. Do you develop directly on the Pi, or do you set up a cross-compilation environment? Each option has its own set of complexities.

The Debugging Desert

Speaking of debugging, the lack of straightforward debugging tools was perhaps the most jarring difference. Setting breakpoints and inspecting variables in real-time is a staple of my usual workflow. With the Raspberry Pi, setting up such an environment requires significant effort, and in some cases, might not even be feasible depending on the chosen development stack.

Breaking Through: Achieving a Streamlined Setup

Despite the initial challenges, I eventually succeeded in setting up the Raspberry Pi to be recognized by macOS. After configuring the necessary USB networking settings and tweaking some configurations, my MacBook Pro could finally communicate with the Raspberry Pi directly. This breakthrough was significant — it meant I could leverage my existing development environment without the need for additional peripherals.

But I didn’t stop there. I went the extra mile and created a custom OS image with all my configurations, dependencies, and settings pre-installed. This image could be flashed onto another Raspberry Pi and would work out of the box. The ability to replicate the setup effortlessly on multiple devices not only saved time but also opened up possibilities for scaling projects or collaborating with others who could benefit from a ready-to-use environment.

To enhance the development experience further, I’m currently working on integrating Visual Studio Code into my workflow. By utilizing VSCode’s remote development capabilities — or possibly developing a custom extension — I aim to replicate the rich IDE features I’m accustomed to. This setup would allow me to edit, build, and debug code on the Raspberry Pi directly from VSCode on my MacBook Pro. It brings back the convenience of a seamless development environment, bridging the gap between the powerful tools on my laptop and the Raspberry Pi’s hardware capabilities.

Conclusion

While the journey to get a simple ‘Hello World’ running on the Raspberry Pi 5 was unexpectedly convoluted, breaking through those barriers proved incredibly rewarding. By configuring the device to work seamlessly with my MacBook Pro and leveraging tools like VSCode, I’ve started to bridge the gap between powerful development environments and the Raspberry Pi’s unique capabilities. Yes, the initial setup is complex and can be a barrier to entry, but with persistence and the right resources, it’s a challenge that can be overcome. For developers willing to venture into this space, the possibilities are vast and well worth the effort.

Invitation to Connect

If you’re interested in trying out this setup or if you have your own experiences with Raspberry Pi development, I’d love to hear from you! Please feel free to reach out through the comments section below or connect with me on social media. Let’s collaborate and share our insights to make the Raspberry Pi development experience better for everyone.

References:

https://blog.hardill.me.uk/2023/01/07/raspberry-pi-usb-gadget-creator-update/

This is cross posted from https://medium.com/@mihaichiorean/from-mobile-simplicity-to-pi-complexity-3d18d8916fcc

Top comments (0)