Hardware for Software People

Posted by wmginsberg on oct 17th, 2017 | 10 minute read

Diving into the world of hardware from software can be kind of overwhelming. Programming is free and generally can't electrocute or burn you, but it also can't be touched or felt, which can make hardware cool and attractive to all types of engineers. Also.. with hardware it costs dollars to build something, not just a couple cents here and there for compute power. That's foreign to most open source developers and (non-iOS) mobile developers. If you're a programmer who wants to know wtf you would do with a Raspberry Pi, why people care about them, and how to get one set up, I'll give a brief intro. I intend this to be part of a series, so let me know what else you're interested in!

Raspberry Pi 101

Who makes it?

The Raspberry Pi Foundation is a non profit organization based in the UK that builds $35 credit-card sized computers with the goal of making computing and CS education much more accessible. To run, the computers just need a monitor + keyboard, a power source, and an SD card with an operating system on it (free to download on any card or buy online).

What are they?

So basically, they're computers like any other. They're computers that you can easily plug sensors and gadgets into, stack into a cluster, or use like you would a standard linux or windows machine. You can run code on them just like any other machine, and even use it to power a DIY laptop for cheap.

Which one should I get?

The most standard model is the Raspberry Pi 3 Model B. It has 4 USB 2.0 ports, a micro SD slot, an Ethernet port, HDMI port, 3mm audio jack, and 40 GPIO (General Purpose Input/Output) pins. It can also run a variety of OSs including Raspbian (Raspberry Pi linux), Ubuntu, Windows 10, and a bunch more. This is what it looks like:

The Raspberry Pi 3 Model B ($35)
The Raspberry Pi 3 Model B ($35) with annotations

What do I need to start?

If you want to get started with a Raspberry Pi, here's what you should do. No one told me this when I was starting, so it took a couple of days for me to realize I couldn't just plug my raspi into my computer's USB port and start loading scripts on it like an Arduino. If you have a lot of regular computer stuff handy you can do this for as little as $35:

  1. Buy a Raspberry Pi. While the Raspberry PI foundation designs the Raspberry Pi chips, they do not sell them. They license their technology out to manufacturers, like (my favorite) Adafruit. I recommend this model.
  2. Acquire a keyboard + mouse. You may have one of these lying around, but if not you can get a cheap one on Amazon or at your local electronics store. You can even borrow one from a friend or from another computer, since you can just SSH in after you've set it up once if you only want to use it as a remote machine.
  3. Acquire a monitor. Same as above, you can also just SSH in after you've set it up if you want to use it remotely, so feel free to use your TV or a different machine's monitor.
  4. Acquire a micro-USB power supply. Maybe you have one of these lying around from an old cell phone or device, but if you don't you can get one for cheap online. This is a nice one on Adafruit.
  5. Get a micro SD card with an OS image. If you have a micro SD card lying around, you can imprint it with the OS you want. However, for whatever reason I've always struggled with that process, so I buy mine imprinted already in whatever size I need. Here's a cheap 8GB one.

What can I do with that?

If you have all that set up, you can pretty much do anything a regular computer can do. You can browse the web, write some scripts, etc. Keep in mind it only has 1 GB of RAM, so you probably won't be able to run anything massively hefty, but it works. You can connect them to WiFi or Ethernet as well.

What if I want to do more?

There's about a million ways to use your Pi thanks to the 40 GPIO (general purpose input/output) pins at the top of the device. Thankfully, Raspberry Pi and Adafruit make it super easy to do so using Raspberry Pi HATs! I think HAT stands for something*, which I've decided is irrelevant to me, because really they are just hats for your raspi to wear. They line up nicely with the device, look pretty, and are a stylish accessory.

Note: I looked this up. HAT stands for Hardware Attached on Top.. I will now imagine all IRL hats actually are this too.

Where do I get accessories?

These also are licensed/built by third parties, so you can buy them on Amazon, Adafruit, The PiHut, or wherever else. I prefer Adafruit or Pi Hut because they have excellent tutorials, libraries, and code snippets for almost all their products. HATs can get kind of expensive (running from a couple dollars to >$50), but they do a ton of heavy lifting by extending the compute power of your chip, and make things a lot easier. Using HATs you can control hundreds of motors, add LCD touch screens, control LED displays, create instruments, and more. Keep in mind that you'll usually need a bit more than the HAT to do anything with it, like sensors, motors, a supplemental power supply, or other electronics gadgets like capacitors or resistors. That's not meant to deter you (since it sounds like a lot), just as a heads up that projects tend to cost $20 more than I initially expect plus a couple days to wait on shipping.

Ok, I read this, but now I have even more questions than I started with...

I plan to do more in this series. Topics I'm considering are intros to: Arduino, circuits, electronics, getting the Arduino/Pi to communicate through Serial ports, soldering, and maybe some project tutorials! Let me know if this was helpful, and what you're interested in reading about, and I can prioritize accordingly.