Getting Started With Embedded Programming in Linux, the Cheap and Easy Way

2185

The embedded space is growing like crazy as microcontrollers invade everything we use every day. If you’re looking for new fields to conquer consider the embedded space — it’s cheap and easy to get started, and it’s fun. Here are two great starting points for the wannabe embedded coder.

These two open hardware projects are great for learning embedded programming, and they take two different but complementary approaches. The Arduino project is both hardware and software: tiny low-power single-board computers that are programmed using the Arduino IDE (integrated development environment). The Arduino programming language is based on Wiring and Processing, which were developed as teaching tools, and to program microcontrollers. Arduino is especially good for learning the fundamentals of electronics principles and hardware. The BeagleBoard is more powerful and supports any ARM-capable operating system such as Debian Linux, Ubuntu, Fedora, Gentoo, or Android.

Tiny Arduino Boards

Arduino is family of tiny single-board computers. The Arduino hardware platform is red-hot, and for good reasons. It’s flexible, it’s open, and it’s friendly to beginners. The hardware is open, with freely available specs and CAD files. The Arduino programming language and libraries are open, licensed under the GPL and LGPL. All documentation is open, licensed under a Creative Commons Attribution Share-Alike license. Arduinos are used in myriad projects: robots, music devices, race cars, games, little airplanes, greenhouse monitors and controllers, clothing with blinky light animations, animated signage, burglar alarms, deer-scaring devices, and all kinds of imaginative devices.

Arduino boards are inexpensive, ranging from around $25 to $80. Arduinos are powered by 8-bit Atmel ATmega single-chip AVR microcontrollers. These are modified RISC controllers that use on-chip Flash memory for storage, so you can write and load different programs and have all kinds of fun.

Accessories like audio boards, motion sensors, LEDs, little electric motors, little speakers, pushbuttons, resistors, and power supplies are also inexpensive. A couple of hundred dollars buys everything you need for building a whole lot of projects, including a good-quality soldering iron, grounding straps and mats, and a good multi-meter. Why not go nuts and build your own multimeter, because you can.

If you have old PCs and other electronics lying around, chances are you have a lot of salvageable parts. You can also build an Arduino board by hand, using the downloadable schematic and diagrams. Another way is to use a breadboard, where you plug in your various components instead of etching a printed circuit board (PCB). It’s a fast and fairly easy way to learn about the different pieces that go into an embedded board. Arduinos are built in Italy by SmartProjects, and by SparkFun Electronics and Gravitech in the US.

Arduinos come in a range of forms and functionality. The LilyPad Arduino is disc-shaped and flexible for sewing into garments. The Mini is super-small, the Ethernet Shield provides networking, and the Uno is a complete board with enough functionality to power a lot of projects without major modifications. The Uno is the current reference model for the Arduino platform. When you want a good general-purpose board that’s ready to go, get the Uno; it connects to your PC via USB for both programming and power.

Learning and Hardware Resources

Adafruit Industries is the embedded hardware store founded by Lady Ada, Limor Fried. Ms. Fried is an electronics guru with an interest in helping noobs and do-it-yourselfers, and both sites are full of great Arduino tutorials and plans for making cool gadgets, like the Make page, and where to find parts and stuff to make more stuff.

Arduino has inspired a large number of good howto books. These three are excellent for starters:

  • Getting Started with Arduino, by Massimo Banzi, co-founder of the Arduino project.
  • Arduino Cookbook, by Michael Margolis
  • 30 Arduino Projects for the Evil Genius by Simon Monk

BeagleBoard

When you want more horsepower and capabilities, check out the BeagleBoard single-board computer. The BeagleBoard is a fanless low-power computer with the expandability of a desktop PC. BeagleBoards can make ordinary devices like routers, firewalls, thin clients, and compact desktop PCs and servers. They can make less-ordinary things like self-driving vehicles, submarines, digital camera controllers, robots, fancy audio processors, media servers, and audio book readers. It has enough power and flexibility to make it a first-rate, highly adaptable general purpose computing platform.

The original BeagleBoard was developed by a small team at Texas Instruments and first released in 2008. It is powered by Texas Instrument’s high-performance OMAP3530 system-on-a-chip (SoC). This incorporates an ARM Cortex-A8 600 MHz CPU, and 2D and 3D video with OpenGL support. It includes 256 MB of NAND Flash memory for storage, and 128 MB low-power DDR RAM. The BeagleBoard has S-Video, HDMI (High-Definition Multimedia Interface), USB, RS-232 serial port, two stereo 3.5 mm ports, a SD/MMC slot (storage cards), DVI-D, and a JTAG port (for debugging).

It also includes factory software loaded into read-only memory, and you have to install whatever operating system and applications you want to use. All of this is packed onto a board about three inches square, requiring only 2 watts power consumption. You get all this for $149.

There are two new models, the BeagleBone and the BeagleBoard-xM. The BeagleBone is smaller and less expensive at $89. It comes with on-chip Ethernet, 256 MB DDR2 RAM, and a microSD slot. It includes a 2GB microSD card loaded with the Ångström mobile embedded Linux distribution. This runs either from the command line, or you can use the Opie or GPE handheld/smartphone graphical interfaces. The BeagleBone-xM is the high-powered everything-board with a 1 GHz CPU, 512 MB LPDDR RAM, a 4-port USB hub, and a camera port for $149. The BeagleBone and BeagleBoard-xM have no NAND, and so they must boot from a microSD card. Get some extra microSD cards for easy experimentation withdifferent operating systems.

What about the software? Anything you can do in Linux you can do on a BeagleBoard; you don’t have to learn a special language like on the Arduino. It should run any Linux, or any operating system, that runs on ARM. The BeagleBoard has not inspired masses of books like the Arduino, but the Resources page contains a wealth of useful links to all kinds of references, from gnarly engineering specs to help for beginners.

You can also learn more with The Linux Foundation’s 10 Ways to Get Started in Embedded Linux Development.