Beyond Pixels: 7 Tips for Getting started Programming Things
TLDR: Are you a purely software developer interested in programmings things on the Internet? Here are seven tips from my own, still-ongoing journey in making the transition.
In The Road to Porter, I described my lightbulb moment with IoT during Massimo Banzi’s talk about Arduino at Lift 13 when:
I finally, really got its importance: it allows software people like myself, with a little bit of learning, to solve hardware problems in the nimble way we’re accustomed to in code.
Looking around at the startup space, this lightbulb has been turning on across the industry. In a recent blog post, Elad Gill mentioned a shift towards investment in “software aware” rather than “software” driven companies. This means companies that are working within the software aware world of IoT may be perfectly positioned to capitalize on the latest investment trends.
Beyond just understanding the potential, actually making the change from programming pixels to programming things can be intimidating.
After all, getting shocked by electricity is now a very real possibility. There are more variables to work with in the analog world with more than one way to do something. Often, there isn’t a “right” way and one must settle for “close enough”.
Once you grasp the concept of programmable hardware, microprocessors with pins you can read from and write to by code, which can be put together with powerful off-the-shelf inputs and outputs, the seemingly overwhelming idea of hardware development gets a little easier.
At the end of the day programming things is effectively the same as programming pixels, albeit done in a slightly different way: the programmable microprocessor is your main application and the hardware components connected to that chip work like software APIs you call to interact with the outside world.
Have an idea of something you want to build? Here are some of my lessons learned from still-ongoing process of learning how to program things.
1. A Plethora of Platforms
TLDR: Understand the capabilities of your prospective chipset or platform, and make sure they match your project goals.
The first step choose your prototype platform or platforms. Now, there are many options: Arduino, Raspberry Pi, and BeagleBoard are just a few. But, I work with Particle: it provides an Arduino-like development environment (C/C++) with over-the-air (OTA) firmware updating and built in cloud connectivity for every chip.
2. The Breadboard is your Friend
TLDR: The breadboard is where your code will interface with the physical world.
This is important: you don’t need to learn soldering in order to get started. Most projects can be built on breadboards, which allow you to simply stick your processor and components into pin holes rather than attaching them to circuit boards.
Looking for an introduction to breadboards? Check out Breadboard Basics for Absolute Beginners on Instructables.
You will probably want to level up to some soldering skills as your projects advance, this will allow you to build field ready prototypes; but don’t let this stand in the way of getting started.
3. Pulling Up to Digital
TLDR: Learn when and how to read digital information from analog components.
Another important concept for a bit-programmer is how to ensure your getting a digital signal from what you think of as a digital component. While you would expect a button on your breadboard to either be on or off, the signal is actually analog. Unless it is processed properly, your input will provide junk, random data. If you’d like all of the details, check out this SparkFun article.
Because this is such a common scenario, most all chips have pull-up resistor built in, or even have exclusively digital pins. So, when you’r expecting zero or one, be sure to use a digital pin, or set the pin mode correctly (eg. INPUT_PULLUP).
4. Imitation is the Sincerest Form …
TLDR: Learn the basics by building a few good sample projects from sources like Hackster.io.
Before you create your own IoT project, you can get comfortable with the scope and standards of IoT development by mimicking what someone else has done.
5. Just Enough is Just Right
TLDR: Don’t try to figure out everything at once, achieve your immediate goals and keep moving.
Once you have completed a tutorial or two, jump into building your own “thing”. While you likely know what you want to build, start slowly and learn what you need to know in incremental steps, rather than looking at the whole problem and feeling overwhelmed. It’s like learning anything new — you can’t look to the finish otherwise it will feel impossible.
Keep in mind, most every component you might want to use—displays, sensors, and controls—already has a library written for it. These being nearly plug and play means you can become familiar their operation and then use those existing libraries to learn more about their internal operations as needed.
6. Debug Like They’re Pixels
TLDR: Debugging hardware is like debugging software except you have more actual moving parts to isolate.
Of course, you will make mistakes and you will become frustrated, but you already know that process from your experience learning software development.
This is simply the same process of testing and debugging a software project; except you may have to change wires and components on the breadboard in addition to your code.
All platforms provide a way to interact with your code over a serial interface, which means you can output text and watch for text input while your chip is connected to your computer by USB.
Serial output gives you realtime logging capability to see what is happening with your program and the readings you’re getting from your pins and the components there attached.
Serial input primarily gives you a way to issue commands to your project; but, it’s important to know that waiting for serial input in one of your programs is a simple way to create breakpoints where you can query the state of code, chip and inputs.
7. Iterating in the Wild
TLDR: Use the best remote development and debugging tools you can find when you’re ready to put your project online.
USB is great; but, your project is a thing on the Internet, which most likely won’t sit on your desk connected to your computer. You want to view, control, and debug it in the wild. For that you need a some sort of remote user interface.
This is one of the huge advantages of using the Particle platform; it does all of the heavy lifting on firmware side to Internet-connect your project. If you’re looking to write your own remote interface, they provide some libraries and project frameworks to get you started on their SDK page.
Or, if you want to save your time and effort, and concentrate on the project itself, you can use Porter. All you have to do is connect your Particle device to Porter, which generates a web app and mobile interface for you. From there, just customize your interface, if necessary, and go. Porter will even automatically keep up with changes you make to your firmware, so you don’t have to update your interface code as your project evolves.
Hopefully these brief notes from my ongoing learning process will help kickstart your adventure into programming things.
I’d love to hear what you’re creating; and, especially if you have and further tips or corrections to what I’ve written. Just comment below or find me on Twitter. Let’s continue this conversation!