I want to write my first embedded program. Where do I start?

Laptop with some code on screen

The boom in the Internet of Things (IoT) commercial devices and hobbyist platforms like the Raspberry Pi and Arduino have created a lot of options, offering inexpensive platforms with easy to use development tools for creating embedded projects.

You have a lot of options to choose from.

An embedded development platform is typically a microcontroller chip mounted on a circuit board designed to show off its features. There are typically two types out there: there are inexpensive versions, sometimes called “evaluation kits” or “demo kits,” designed to keep costs low and are produced in large quantities. There are also fairly comprehensive designs, sometimes referred to as “development kits” or “reference designs”, that provide options and flexibility so they can be used to design and test prototypes. Development kits tend to be significantly more expensive. These kits are typically designed and sold by the manufacturer of the microcontroller chip, or one of their partners. This sometimes means you have several to choose from for the same chip.

The third type of platform has come on the scene, and this group is growing rapidly. This is the hobbyist platform arena. Raspberry Pi and Arduino are probably the best known in this group. These are platforms designed for and used by hobbyists, students and researchers. They are typically low cost. Some have very specific applications in mind, while others are designed to be very flexible.

Embedded development boards, clockwise starting with the top left: Nordic Semiconductor nRF52840DK, Intel Arduino, Silicon Labs ST32F103 “Blue Chip”, Arduino Esplora, Silicon Labs Thunderboard, Parallax BASIC Stamp.

What sort of program do you want to write?

Your first program should be simple. It should interact with the user to show you that it’s actually working. If you were to write the first program for your laptop, your program will probably show something on the display, like the words “Hello, world.” That’s the de facto standard first program for a traditional computer. In an embedded environment, the first program is likely to blink an LED instead.

I *strongly* recommend you pick a basic board, start with blinking an LED, and then expand on that for a little while. Eventually, you will want to create something a little more sophisticated or connected. Embedded devices interact with all kinds of things: sensors, joysticks, buttons, relays, motors, actuators, wired and wireless communications, displays, audio, cameras, etc. The sensor list seems almost endless. You can measure voltages, temperature, movement, acceleration, light, magnetic flux, proximity/touch, sound, speed, distance, barometric pressure, etc. So, you will want to decide what you want to do with your platform, and which platform makes the most sense.

But for that first program, start simple.

Choose a platform

This is probably the toughest step due to the number of choices and options. Here are several features to consider to narrow down the list of options.

  • Board cost
  • Built-in debug hardware
  • Development tools
  • USB powered (no additional power supply)
  • Built-in sensors/peripherals
  • Support

Board cost – Choose a low-cost board to get started. After you have used it for a while, you will have a better idea of what features you need and want. At that point, you will be better suited to invest a bit more. There are literally hundreds of platforms available. You can find numerous ones for under $100 that will perform as a great platform on which to get started. There are many options in the $50 and under category. You can even find platforms for less than $10 dollars, but some of them may need additional equipment in order to be useful. The prices usually correlate with the features on the platform, but they’re also affected by the popularity of the platform.

Built-in debug hardware – When the time comes to load the program into your embedded system, the computer you used to write the program will need to send the program to your board. There are several techniques for doing this, but each board will likely only support one method. Some devices simply require you to connect a USB cable to your computer. These boards have built-in debug hardware, so you don’t need additional equipment. This method is simple, straight forward, and you won’t have to shell out for additional equipment. Other methods will require a debug interface of some type. These can range in price from tens of dollars to hundreds of dollars, or more. Not all debug interfaces will work with every development board, so there will be additional research into compatibility, too.

Development tools – Many manufacturers and some organizations provide free compilers and assemblers for their platforms. This may be in the form of an all-in-one program where you can write code, download, and debug it. This is known as an Integrated Development Environment (IDE). You may also piece together your favorite compiler, editor, and debugger. If you’re starting off, go with the IDE approach. It will take some additional know-how to go the second route, and if you’re starting off, there’s no sense in piling more obstacles in your way. Modern IDEs are fairly comprehensive tools, and you should be able to accomplish what you set out to do. Not every IDE works on every major OS, so make sure you select a development environment. Windows is probably the best supported platform, but MacOS and Linux are catching up quickly. Just be sure to confirm that the software will work with your computer.

USB powered (no additional power supply) – The cable used to download your programs to the board will also serve to power the board itself in many cases. That means the board draws what it needs to operate over the USB cable, and you won’t need any additional equipment to get started. Just plug it in and go. Some boards may require external power supplies or batteries. This will be common with applications like motor control because the USB interface cannot supply enough power to run the motors. For starting off, keep it simple. Stick with a board that can be powered over USB.

Built-in sensors/peripherals – Your program will interact with various devices. You can either buy a board with some devices already integrated into the board, or you can add devices, and in many cases, you can do both. There are a few standardized form factors and connectors which allow you to easily stack additional hardware on top of your board to add features. Arduino and Raspberry Pi platforms fall in this category. For the Arduino platform, there are a couple of rows of pins on the board, and you can attach a “shield” — which is a board with mating connectors, by simply lining up the connectors on both boards and pressing them together. You can also skip the shields altogether and just wire your circuit up to the same pins. Starting off, this may not be the best way to go: if something doesn’t appear to be working, it might be tricky trying to figure out if it’s due to the software or if something is wired incorrectly.

Arduino shields, from left to right, Cellular modem, SD Card interface, and Ethernet adapter.

Established chip maker/chip – There is a lot of variety available from the big-name chip makers. You may not find every new and cool feature in this category, but for a first board, I would suggest going this route. To get started, there will be many example programs available, and things will be tried and true. You will also find lots of message boards where you can ask questions and find answers. You will also find more people with experience with the hardware you’re using. More obscure platforms will have fewer resources available to start, and you may find it more difficult to find help to resolve issues when they arise.

If you’re new to this area, you may not recognize the more established names just yet. By no means is this list intended to be exhaustive, but here are a handful of names to look out for: Adafruit, Arduino, Atmel, Microchip, Parallax, Silicon Labs, Sparkfun, ST Microsystems, Texas Instruments.

Support – This is probably one of the more important areas to drive your decisions. The support mechanisms for embedded development follows the lead set by many other technology companies in the past decade or so. There typically isn’t a phone number you can dial for support with staff standing by to answer your questions. There are representatives, but they typically focus their limited time on larger customers, not so much the individual developer. It’s not to say you can’t get support contacting the company directly, but this is not the way things are done these days, and you shouldn’t expect it.

Your support will come in the form of *community support*: from message boards, blog posts, and various websites. Chip and board manufacturers host message boards. Depending on the company, there may be employees who monitor and answer posted questions. Many developer-centric websites have message boards where questions get answered by other site users. The more popular a chip or a development board is, the more likely you will find messages about common issues you might encounter. This is also true about finding code samples and examples.

Other sources for support also exist. Local groups and organizations exist in some areas where you can take classes or meet up with other users and work together or ask questions. Perhaps you can join a local Maker group, or take an evening class. These options probably aren’t necessary for starting off, but as you get into more complex programs and setups, this can make a huge difference.

There are many options from many companies. For someone starting out, you will save yourself a lot of frustration if you choose a popular platform, because you will find more support for it.

Get some hardware and go

There are lots of options available to get started in embedded software. Find an inexpensive, starter platform with some interesting sensors or actuators attached. Download and install the development tools on your computer. Grab the “Blinky” sample program and get up and running.

Really, start with one of their basic programs. Build it, download it, and run it. This will do several things. First, it will show you the basic steps needed to write and run programs. Second, it will verify that everything is in working order. There’s no reason to be debugging your own code while also debugging a hardware, driver or setup issue. Once you confirmed everything is working, go nuts! Add some features, or change the existing features. Try out some new ideas. Hook up some new sensors.

And if you are looking for even more on embedded ops, we host a weekly Lunch and Learn on a variety of topics from embedded on cellular, deep learning with robots, and more! Check out our current list of events and sign up for your seats – always no cost!

One thought on “I want to write my first embedded program. Where do I start?

Leave a Reply