Building A Raspberry Pi Rover: My Big Fat Linux Weekend

Linux! Such a wonderful, rich, capable operating system has blessed us, and all for the low, low cost of absolutely free. It’s under the hood of countless servers, computers, phones, and embedded devices, and is the go-to solution for when you want to get the job done right. Why, then, does it curse me so?

Prologue

The penguin giveth, and the penguin taketh away.

My experience with the almighty penguin stretches back to the late 90s. Facebook hadn’t been invented yet, so most weekends were spent installing whatever came on the front of the latest computer mags. I wish I was kidding, but I’m really not.

Way back when, us kids would load the latest Red Hat or Fedora distribution onto our hand-me-down Pentium IIs, trying not to accidentally wipe our hard drive in the process. Limited to dial-up internet and very few help resources, it was pretty common that you’d spend hours watching progress bars tick over, only to wind up with no working mouse, or an X server that simply refused to start for man or God. Did I mention we did all this for fun?

Trying To Get Some Work Done

Of course, after growing up, real life and real responsibilities take over. Now, if I’m using Linux, it’s because I’ve got a job to do, not just because there’s nothing good to watch on Cartoon Network this weekend. I consider myself to be a fairly intermediate user. I’ve compiled a few things successfully, understood how to work with a variety of package managers, and once, just once, even managed to connect to a wireless network from the command line. There’s not a whole lot that phases me in this realm anymore.

For the past few years, I’ve been slowly working on a little rover by the name of TKIRV, powered by a Raspberry Pi. It was overdue for a camera upgrade, as I’d been using an old Microsoft webcam for far too long. I ordered a nice 1080p Raspberry Pi camera, and naturally the parts marinated in their boxes for a good couple of years. Finally, after much procrastination, I was eager to get my wheely boi back out on the road.

This was but the beginning my weekend slaying embedded Linux dragons.

Reconfiguring a Fresh Install

I sat down, and was pleased to see everything fire up without too much trouble. I’d left passwords on their defaults, and went through the process of reconfiguring the Raspberry Pi to connect to the WiFi, because I move house approximately every 10 months. I unpacked the camera, slotted in the flat flex cables, and… nothing! Not being prone to panic, I calmly began troubleshooting the problem.

Ah, there’s a tool required to enable the camera. raspi-config… that should sort me out.

It should have been this easy.

I was upbeat, eager to see my lab in crisp high definition with my rover’s new camera. Despite my efforts, the camera remained inoperable. My brow furrowed as I studiously pored over a widening net of forum posts. In these situations, many recommend a little housekeeping to tidy things up. With a few keystrokes, I instructed the package manager to both update… and upgrade. How foolish I was.

First Signs of Trouble

After the package manager finished, I decided to reboot, as is the custom. Upon starting, I was greeted with a login prompt. This would normally not be cause for alarm, but my Pi was specifically configured not to do this.Never mind,” I muttered, as my eyebrow twitched, sweat beading on my forehead. I tapped in my login credentials and prepared to…

…the login screen reappeared. I blinked. A typo, surely. Again. And again. I triple checked the default credentials, and yet I continued to fail. The screen would blank, and return me back to the login prompt. This was utterly maddening, and I once again turned to beg the forums for aid.

I managed to beat my way back to a command line, while the desktop remained a distant oasis on the horizon. Another two hours passed, as I fruitlessly attempted to cleanse various “~/.profile” files and massage an “Xauthority” back into shape. Try as I might, nothing I could do would get me back up and running.

I had thus far avoided starting from scratch. While it’s a fairly quick job to reinstall Raspbian, I had it set up the way I like. I’d wanted to avoid this, but I was left with little choice. I downloaded the latest image, squirted it on to an 8GB SD card and took a deep breath. My trials would surely be over soon.

Of Course They Weren’t

Inserting the new SD card, I powered everything up and waited. With a Pi Zero, there are no clicks, beeps, hums, or whirrs as per the computers of old. You just stare at a little blinking LED and watch the boot sequence fly by. It’s kind of soulless, but this is the modern way. I was greeted with a functioning desktop courtesy of the X server, and allowed myself to exhale.

Cracking my fingers, I opened a terminal and resolved to get to work. It was time to begin reinstalling Python, and Gstreamer, and about fifteen other useful utilities, and there was no time to waste. Before I could do any of that, though, I needed to get online.

The original Pi Zero lacks onboard WiFi, so a USB dongle is the way to go. Normally this would be a plug and play affair, but of course, Linux wasn’t done needling me just yet. If you’re following the general theme here, I plugged it in, and it didn’t work.

This rabbit-eared demon was the cause of much consternation. If you change the chipset, please change the model number. Help us all out.

I’d chosen the TP-Link WN-822N WiFi adapter, which comes in several versions all with different hardware inside. After drilling down and figuring out I had a version 3 with a Realtek rtl8192cu chipset, I found out that Raspbian didn’t have the relevant driver installed by default.

Easy fix, right? Wrong — and very wrong, at that.  See, driver installs in Linux aren’t always so easy. You’ve got to find the driver first, and then if you’re lucky, someone will have compiled it for your architecture and the precise version of the distribution you’re using. If not, things get sticky. Of course, you can always compile it yourself. This of course necessitates the use of certain tools. These can be installed quite easily, when you’re connected to the internet, that is. I, unfortunately, was not.

TKIRV sits waiting, dying to explore once again…

After further hours spent trying to find some manner of precompiled driver I could copy over on a USB drive and install, I was close to snapping. Mercifully, it turned out I could instead tether my iPhone, and get online long enough to use the package manager to install a suitable driver package for the WiFi dongle. With that, the Pi was back online and I could get back to work.

Epilogue

Unfortunately, at this point, the weekend was over. I had just enough time to install a couple packages and verify that, yes… the camera works. Nothing else does, right now — I still have another mess of utilities and libraries to reinstall, and I shudder at the thought. But the camera works, and I’m telling myself that’s enough for now.

My rover still languishes on my desk, quiet and still.

You will roll again, wheely boi, I promise you.

You will roll again.

46 thoughts on “Building A Raspberry Pi Rover: My Big Fat Linux Weekend

  1. Reminds me of the “good old days” when I was in college, and a handful of us decided to install Linux on our laptops. The wifi cards didn’t work out of the box, and the college wasn’t allowing student machines to connect to the network, so we drove around to all the coffee shops to find one that offered Ethernet connections, to pull down wifi drivers.

  2. Linux really isn’t that difficult to use once you let go of the trappings of “convenience” – I found that the reliance on GUIs was what kept me from enjoying Linux at the outset. Once I got a grasp of the CLI I was able to do so much more in a much shorter span of time and I haven’t looked back! Everything is SO much easier to fine-tune and configure in the CLI, but I am admittedly much more particular about my setup than most people might be. Best of luck in what seems like an exciting project, though!

  3. This so perfectly captures the mood every time I start a raspi/linux project! I learn so much about obscure problems I care so little about, and that likely will never need drudging up again. Oh well, if it all worked well, everyone would be using linux and that feeling of being a tech-hipster would disappear.

    1. “I learn so much about obscure problems I care so little about, and that likely will never need drudging up again”

      This, unfortunately, is why it’ll never make it big as a consumer desktop/laptop OS. It’s fine for people who want to get their hands dirty, but most consumers want plug-and-play convenience. If a lot of people don’t know what they’re doing with a GUI you’re never going to get them to accept a CLI.

      I like that I understand more about how my machine works since starting with Linux, but there are times when I just want the bloody bluetooth to work properly.

      1. Wrong. Android. Chromebook.
        Mint cinnamon is a great example of “it just works”. As are most main distros. If you don’t want to use Linux, then don’t. Sure, this guy could have done things very differently. Like getting a 14$ board with built in WiFi. Or keeping backups. Im so used to re-flashing my pi every few months, I’m making frequent backups. No one uses a cli unless they’re an admin/dev, and even then… Tools exist.
        Linux is the answer when a computer is broken, or you need super security, or you want a server at home. It’s the outliers, the misfits, nerds and geeks that love and support Linux.

    2. Do you mean like, in middle school the kids who carried a large size floppy disk case around would be considered hip and stylish, and so people carried floppy disk cases around even though they were blank, because they wanted to be hip?

      I’m not sure I’m understanding it.

      You have to already feel like a tech-hipster to even know what a feeling of being a tech-hipster would be. So as an accusation it is nearly circular, except it actually spirals towards you instead of circling forever.

      When I’m using linux and getting stuff done, and I remember how hard the same thing was in some other system, and I feel smug and self-important, I can assure you there is nothing “hipster” about the feeling. It is entirely too self-centered and tool-oriented to include worrying about if you think it is “cool” or not.

      Actually, the floppy disk case worked the same way. The only person trying to be “cool” is the meathead jock trying to bully the nerds for using tech!

    3. This. Exactly this. I have never succeeded in getting raspberry pi to do anything interesting because all my energy is drained on said obscure problems.
      Most recently I spent a weekend a couple of weeks ago wanting to get Snips voice control running on pi to control my coffee machine, I actually spent it trying to get the pi to listen to a mic board designed for pi; Snips never entered into it.
      The example installation process doesn’t work, and it seems driver related. I brought it into work and even our most evangelical Linux/pi fan couldn’t get a peep out of it in a further 3 hours. The board wasn’t cheap, but is destined for the bin because computer says no getting it to say yes appears as easy as manually mining bitcoin; I could spend my entire life trying things that might work, but the probability of success is still vanishingly small.

  4. I learned long ago when installing non Microsoft operating systems that you know your hardware and know what hardware has builtin support. Then you build your system. You know, a little bit like engineering. If you want someone to control what you can an can’t do, then you do only the things that company lets you do.

    BTW, look into PIGPIO for direct PWM control of RC signaling. And the rPi Zero W iincludes Bluetooth too so you can use game controllers to remote control your little robot.

  5. Sheldon would offer you a nice hot beverage for your troubles. How about a nice cup of Java?

    But seriously, these kind of problems are the main reason I rarely touch Linux sadly. And I think many newbies feel the same way.

    1. Some of his issues are self-inflicted by using a Pi Zero instead of a Pi 3 B/B+ – most notably the WLAN issues.

      Nearly all of the other issues are ARM-architecture idiosyncracies that prevent even Windows IoT from running on 95%+ of the ARM hardware out there. So if you are avoiding Linux, what OS *are* you running on your ARM hardware?

      1. None.

        I find that if I need an OS then it’s probably because I need more processing power and all the amenities available on x86 platforms. If I just need a web browser, Android.

  6. Yeah, i think we probably all had week-ends like this one. If i have to choose i still prefer having this kind of problems on Linux, at least there a – mostly – verbose error messages, dmesg, log files and if you really need you can even change the code and recompile.
    Good luck…

  7. “If you change the chipset, please change the model number.”

    Yes. Yes. Yes. Having the same shell doesn’t make it the same product, especially if functionality has been altered.

    What’s wrong with these companies?

  8. I first installed Linux from an MCC distribution with kernel 0.95 in 1992. I didn’t get very serious until Debian came out in ’94. The last Microsoft product that I used as my primary OS was Windows 98. I also had to walk to school in the snow, uphill in both directions. Get off my lawn.

    1. You could *walk* to *school*?!? I had to slither myself on jagged stones because I’ve no limbs. And that’s just to go to the latrines which was nothing but a hole in the ground that I had to dig on my own first, with my mouth.

      ((c:

  9. Such a strange post to be reading here. Why did you need X, just to open the terminal and install Python? Why did you chose a WiFi adapter that wasn’t clearly compatible with Linux?

    I understand beginners had to start somewhere, but I wasn’t aware that it was the front page of Hackaday.

  10. The endless login issues sound a lot like a buggered SD card. I get the same issue sometimes on Armbian when using “genuine” SD cards from AliExpress, even though the card flashes and validates perfectly. All that updating might’ve worn the poor card out.

    Love the reminiscing of early days Linux too lol. Brings back happy memories.

  11. I seriously recommend a proper embedded Linux distribution. You can use generators such as buildroot (self-explanatory, good for small/quick projects that you will not need to support long-term) and Yocto/OpenEmbedded (steep learning curve but infinite possibilities, good for long-term industrial projects).

    It will allow you to cross compile easily so your are not limited by the slow embedded CPU. You can also easily use a read-only rootfs to reduce wear on the SD card.

    1. Yeah, this type of project people who don’t want to learn a lot about linux might be better off with a BeagleBone and a full distro.

      People often don’t really appreciate that when the system gets too small, it gets harder to configure, and that isn’t the fault of the OS! It is just a reality of working below the normal minimum requirements because you want to use cheap hardware.

      There is a definite difference between “you can do that easily in regular linux” and “you can just barely do that on an embedded system running an unusual and incomplete distro.”

      I run a lot of linux boxen, in a lot of different contexts, and I wouldn’t want to get stuck wrestling some distro I don’t have experience with just for a weekend project like this. Especially on proprietary hardware with limited software choices.

  12. My best advice for developing on the raspberry pi is to create a “clean” image, which has all your libraries and drivers installed, and back that up, then make your application source a git repo. This way if you want to start from a well-known good point (due to SD card problems or whatever) you can just flash a new card in 3 minutes, pop it in and do a git clone.

    If you need to install or update a library/driver, re-flash the card with the “clean” install, then make the updates, and back up again.

    This allows you to separate your application management from your system administration.

  13. I recently bought one of those rabbit-eared demon TP-Link WN-822Ns with the Realtek rtl8192cu chipset, and I’m starting my quest for a driver. The name of that “suitable driver package” would be handy.

  14. Lol not sure if the Linux is a toy people understand how much of the tech in their life runs some form of Linux/Unix kernel. Not to mention OSX and Android.
    I wonder how many current -nix users have downloaded source and compiled for their own system.

  15. Amen on the whole “please change the model when you change the chipset” thing.. or at least clearly state which revision it is, and what specs that revision means somewhere that can be found on your site.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.