I’m a Software Engineer, why should I care about Arduino?

Getting Started with Hardware Programming is actually Easier Than You Thought! Raspberry Pi, Arduino, What’s between them and Why it Matters

Uri Shaked
8 min readOct 4, 2018

A few weeks ago, I was reached out by a popular Israeli podcast called “עושים תוכנה” (which means Making/Doing Software). As the name suggests, the subject of this podcast is Software Engineering. They asked if we could record an episode about hardware programming for software engineers. I was intrigued — my background is software, and even though I do hardware projects as hobby, I am also pretty active in the JavaScript, Angular, Cloud, and Google Assistant communities. So why were they particularly interested in me speaking about hardware?

My first time recording a podcast in an actual studio 🎤

It turns out that the fusion between software and hardware is what they sought after. More specifically, they wanted to make a case for why it is beneficial (and fun) for programmers (like me) to get their hands “dirty” with hardware. It was my friend Demi Ben-Ari who made the connection (thanks Demi! 🙏), and as they really loved the Real-Life version of Chrome T-Rex game, they decided to invite me to record this episode with them.

Show me your Arduino

Arduino has become a buzzword. Many people use it as a generic term for a “programmable hardware board”, or more technically, any electronic board that contains a MicroController, a small processor that can be easily interfaced with other electronics and hardware.

an Arduino Uno clone (with some fancy hardware on the right)

Let’s get this straight first — Arduino is actually a brand of boards, with the most popular one being Arduino Uno (to make things more confusing, there’s Genuino Uno, which is the same thing, but with a different name), and also a development environment that lets you program the Arduino boards, as well as hundreds of other boards. So Arduino is both the name of a specific brand of boards, and a software that programs these boards, as well as a set of standard library functions and convention that are built into these environment.

This is the Arduino software

The Raspberry Pi 🥧

Another very popular device you have probably heard of is the Raspberry Pi. The Pi is actually a full computer — It has an HDMI output that you can connect to a monitor, USB ports (so you can easily connect a keyboard, mouse), Ethernet, WiFi, Bluetooth and it runs an fully fledged operating system — Linux being the most popular, but it can also run Android and Windows 10 IoT.

This is a good place for a good comparison between the Pi and the Arduino Uno. The Uno has the computing power of 80ties computer, yet it is cheaper, much more power efficient, and can easily interface with more types of electronic sensors and hardware. It doesn’t run any operating system, just your code on the “bare-metal”, meaning that you have pretty much complete control over the environment and can use it for things that require very accurate timings.

a Raspberry Pi with a 3G Cellular Internet Dongle in one of my recent projects

The Raspberry Pi, on the other end, is much more capable, it can do much more heavy duty stuff such as image and video capture and processing, deal with tasks like speech recognition or machine learning, and can take advantage of existing software libraries such as OpenCV or TensorFlow. Yet it is much more power hungry, and you have the operating system that can interfere with your code and even pose a security risk (if you set up the OpenSSH server and forget to change the default password, for instance).

I like to place these devices on the two ends of a scale — the small, simple, cheap, and power efficient Arduino Uno on one end, and the fully-fledged, power-hungry Raspberry Pi computer on the other end. I tried to give you the gist of the differences, but you can easily find more information online, for instance in this comparison table I once made.

Arduino Uno and Raspberry Pi on the opposite ends of the device scale

You don’t tawk C++? Assembly?

When developers hear about hardware programming (or, as it is sometimes called, Embedded Programming), they usually immediately think of writing low-level code in C or even assembly. This used to be true for a long time, but today this is no longer the case.

In fact, most of the code examples for the Raspberry Pi are written in Python, and it also comes with Scratch pre-installed, meaning even your 6 years-old child can learn how to write a simple program that controls an LED or reacts to input from a push-button. As stated above, the Pi is a full-computer, which means you can use pretty much any programming language to write software for it, be it JavaScript, Java, Kotlin, Go or C#. even Cobol.

The Arduino Uno itself is usually programmed using a simplified dialect of C++. The board itself is too limited to directly run JavaScript or Python code, but you can easily control it from code running on your PC using the Johnny-five JavaScript library.

Hardware game, completely powered by JavaScript.

But don’t worry — there is a wide range of Arduino-compatible boards, which are equipped with more capable microcontrollers that can be programmed directly with high level languages. Two of my favorites are the Pixl.js board by Espruino, which you can program with JavaScript and has Bluetooth support and a built-in display, and the Metro M0 by adafruit industries, which runs Python out of the box. In fact, I used an Espruino board to program my Real-life Chrome T-Rex game with JavaScript.

Hello World, Who’s afraid of soldering?

If you never held a soldering iron, no worries — you can get a pretty good mileage with electronics without even touching a soldering iron. The “Hello World” program of Arduino is simply blinking an LED, and since the Arduino Uno has one built-into the board, you can get this “Hello World” up and running in less than 5 minutes. Programming the Arduino is as simple as connecting it to the computer with a USB cable and pressing a single button in the software to upload your code.

But what if you want to build something more complex? connect some sensors, LEDs, speakers, whatever?

There is a simple piece of hardware called “Breadboard” that got you covered. It allows you to prototype and make electrical connections by simply plugging in components and jumper wires — no soldering required, and it is super-easy to change the connections whenever you like.

A Raspberry Pi connected to LEDs, buttons and a display using a Breadboard

Stay safe!🔌

When you deal with electronics, you usually deal with low voltages, typically 5 volts or below (at times 12V, but usually not much higher). These voltages are considered safe (unless you do stupid things like try to pass them directly through your heart for several minutes — don’t do that! 💔). When you deal with smartphone chargers or plug something into your car’s cigarette lighter socket, you deal with similar voltages, yet most of us do it regularly. So touching electronics with your hands is safe.

Working with hot-air gun and soldering iron on fine electronics circuit. Be careful not to burn yourself! 🔥

Dealing with mains, or any device that connects to mains and operates on 110VAC or 220VAC is extremely dangerous, can kill you, and can also cause fire hazards. So do stay away from these devices, and don’t try to fix broken power supplies / transformers, unless you have appropriate training.

So why should you care about Arduino?

I meet many makers. Some of them have no background in software, and after they learned to design and 3D Print parts and models, and wire some basic electronic circuits, they eventually want to make something more sophisticated. Like a T-Shirt that can be controlled from a Slack chat. Then they suddenly have to learn programming — it usually starts with some basic Arduino code, but quickly gets complex when you add control-flow, functions, string manipulation and 3rd-party libraries into the mix.

You are a software developer. You already know all of that. In fact, you already write code that controls hardware — whenever you call the Web Camera API, you usually turn on that LED that indicates the camera is on. You can write a simple JavaScript program that will make this LED blink by switching the camera on/off with a timer, basically recreating the hardware “Hello World” program with tools you already know. You can even control smart light bulbs, switch them on and make a colorful light show just with Web APIs.

Arduino Theremin — A software engineer built this just 2 hours after learning about Arduino in my workshop

For you, learning Arduino (or Raspberry Pi) is so much simpler — you already have the core skill of programming. It allows you to reuse your existing knowledge and experience and extend it to a new platform, giving you new capabilities. Working with electronics and programming it teaches you how things work behind the scenes — without many of the abstraction layers imposed by operating systems and platforms such as Android, iOS or the web. It gives you new tools and perspectives, like debugging with LEDs (to indicate the presence or absence of signals), in place of the debug prints (or console.log) you are used it.

Working with Electronics also improves your ability to plan ahead and conduct a comprehensive research. While programming, you can usually import new 3rd party libraries and components just by running a simple command and waiting for them to download. When dealing with hardware, adding a new chip, board or an extension module requires paying for them and waiting days or weeks until they ship to you. So you have to learn to plan ahead, and do your homework before you start writing code.

Go ahead, give it a try — I’m sure you will surprise yourself!

This is my 4th post in my Postober challenge — writing something new every single day throughout October.

I will tweet whenever I publish a new post, promise! ✍

--

--

Uri Shaked

Google Developer Expert for Web Technologies, Maker and Public Speaker