Open-Source Guide for Embedded Systems Developers (EE Tip #114)

What comes to mind when you hear the term “open source”? Hopefully, it means more to you than just a software application running on a PC.

As an embedded systems developer, you should familiarize yourself with the wide range of open-source programs, programming tools, and hardware platforms currently available. In addition to saving yourself the costs of pricey user licenses, you’ll find that open-source community forums helpful, informative, and engaging.

Open-source software offers a number of advantages. The product is independent of a particular manufacturer and there aren’t license costs. Plus, the product is usually high quality because it is often supported by a large active community of users. When a program’s source code is available, you have the chance to fix errors, change its behavior, and even add new features.

The aforementioned advantages should be good enough reasons for any designer of microcontroller applications to work with open-source software. PC tools such as editors, documentation programs, toolchains (for the vast majority of microcontrollers), operating systems, and libraries are widely available with open-source code.

On the hardware side, open-source microcontroller boards are gaining popularity among serious engineers. The circuits, PCBs, and CAD files are available so you can modify them, improve them, and add more features to meet the demands of your applications. It’s an added benefit that open-source hardware is always supported by software code and libraries that enable you to get up and running fairly quickly.

Since we couldn’t include in the space provided all the open-source resources currently available, we simply list several open-source projects that Elektor and Circuit Cellar engineers and editors recommend.

Below we provide the following lists: hardware; libraries and run-time tools; PC tools, and GNU toolchains. By no means are the lists complete. Still, they’re helpful starting points.

Download your Arduino Uno poster

Click image to download a free Arduino Uno poster

Arduino—This popular platform offers a range of simple microcontroller and development boards that you can purchase from several suppliers. The Arduino website has an active forum and the wide range of software examples will ensure that you are up and running in minimum time.

Openmoko—It’s a complete software stack for a smart. The Neo FreeRunner mobile phone is the target hardware platform. Development and debug boards are also available.

GNU Radio & Universal Software Radio Peripheral—The GNU Radio project is a software toolkit to produce a software-defined radio. The open-source hardware for this project is the Universal Software Radio Peripheral (USRPBoard), which is based on an FPGA.

KiCAD—One of the best-known suites of CAD programs for hardware production, KiCAD includes tools for generating circuit diagrams and PCBs. You can view 3-D representations of the finished board.

Fab Lab—This interesting project offers 3-D laser cutters, 3-D printers, and other machines for use by the general public. It’s a handy resource for making robot parts and art objects.

uIP/lwIP—Two outstanding network stacks, the first is for 8-bit microcontrollers. lwIP is a development of the first and more suited to medium sized controllers. The uIP licence is not so strict allowing the stack to be used in commercial products.

LUFA (formally MyUSB)—A large library of applications for interfacing (both Host and Device) USB enabled AVR controllers. The demonstration applications allow an AVR controller for example to emulate a keyboard and many other devices (mass storage device, audio I/O etc.)OpenSource2

Crypto-avr-lib—It’s a library of optimized cryptographic routines for the Atmel ATmega controller. Issued under the GPL Version 3 licence. Contact the author for other types of licence.

FreeRTOS—FreeRTOS is a lightweight Real Time kernel which can run on many controller families. It can be used in commercial applications and allows the use of closed-source software.

U-Boot—Universal bootloader with a large range of routines for memory, UART interface, SD card, network and USB etc. Conceived originally as a bootloader but now through comprehensive hardware support can be used as the basis of a C code module.

Embedded Filesystems Library—A useful (FAT) file format, when you are short of memory. The GPL licence includes a clause allowing static linking to the library without public disclosure of your code.

.NET Micro Framework—Now open source this very compact, trimmed down .NET Framework running on diverse ARM platforms. Programmable using the object orientated C variant C#; lots of resources including support for I2C, Ethernet and many more. Helps reduce development time.

Eclipse—This is a good development environment. It has a modular structure which makes it very easy to configure. There are around 1,000 plug-in modules (both open source and commercial) for a range of program languages and target systems.

Kdevelop—Kdevelop is an integrated development environment which should satisfy most power-user needs. Runs in MS Windows, Mac OsX, Linux, Solaris and FreeBSD. Plug-in expandable.

Programmer’s Notepad—A lightweight but efficient editor for writing source code. Allows fast, simple and comfortable program production. Can be expanded with plug-ins.

Doxygen—An intelligent tool which can automatically generate code documentation (C, C++, Java etc.). The programmer provides tags in the source file; Doxygen generates the comprehensive documentation in PDF or HTML format. It can also extract the code structure from undocumented source files.

WinMerge—A good tool for code comparison and code synchronization. The program can also compare the contents of folders/files and display the results in a visual text format that makes it easy to understand.

Tera Term—A terminal program to access COM ports, supports Telnet communication Protocol. A debugging tool to eavesdrop on serial communications.

Note: Toolchains for GNU projects are available most processor architectures AVR, Coldfire, ARM, MIPS, PowerPC and Intel x86. The GNU-toolchain includes not only compilers for C, C++ and in most cases also Java (GCC = GNU Compiler Collection), but also Linkers, Assemblers and Debuggers together with C libraries (libc = C library). The tools are used from within other-open source projects, like WinAVR, which provides a familiar user interface to speed up program development.

MCU-Based Projects and Practical Tasks

Circuit Cellar’s January issue presents several microprocessor-based projects that provide useful tools and, in some cases, entertainment for their designers.

Our contributors’ articles in the Embedded Applications issue cover a hand-held PIC IDE, a real-time trailer-monitoring system, and a prize-winning upgrade to a multi-zone audio setup.

Jaromir Sukuba describes designing and building the PP4, a PIC-to-PIC IDE system for programming and debugging a Microchip Technology PIC18. His solar-powered,

The PP4 hand-held PIC-to-PIC programmer

The PP4 hand-held PIC-to-PIC programmer

portable computing device is built around a Digilent chipKIT Max32 development platform.

“While other popular solutions can overshadow this device with better UI and OS, none of them can work with 40 mW of power input and have fully in-house developed OS. They also lack PP4’s fun factor,” Sukuba says. “A friend of mine calls the device a ‘camel computer,’ meaning you can program your favorite PIC while riding a camel through endless deserts.”

Not interested in traveling (much less programming) atop a camel? Perhaps you prefer to cover long distances towing a comfortable RV? Dean Boman built his real-time trailer monitoring system after he experienced several RV trailer tire blowouts. “In every case, there were very subtle changes in the trailer handling in the minutes prior to the blowouts, but the changes were subtle enough to go unnoticed,” he says.

Boman’s system notices. Using accelerometers, sensors, and a custom-designed PCB with a Microchip Technology PIC18F2620 microcontroller, it continuously monitors each trailer tire’s vibration and axle temperature, displays that information, and sounds an alarm if a tire’s vibration is excessive.  The driver can then pull over before a dangerous or trailer-damaging blowout.

But perhaps you’d rather not travel at all, just stay at home and listen to a little music? This issue includes Part 1 of Dave Erickson’s two-part series about upgrading his multi-zone home audio system with an STMicroelectronics STM32F100 microprocessor, an LCD, and real PC boards. His MCU-controlled, eight-zone analog sound system won second-place in a 2011 STMicroelectronics design contest.

In addition to these special projects, the January issue includes our columnists exploring a variety of  EE topics and technologies.

Jeff Bachiochi considers RC and DC servomotors and outlines a control mechanism for a DC motor that emulates a DC servomotor’s function and strength. George Novacek explores system safety assessment, which offers a standard method to identify and mitigate hazards in a designed product.

Ed Nisley discusses a switch design that gives an Arduino Pro Mini board control over its own power supply. He describes “a simple MOSFET-based power switch that turns on with a push button and turns off under program control: the Arduino can shut itself off and reduce the battery drain to nearly zero.”

“This should be useful in other applications that require automatic shutoff, even if they’re not running from battery power,” Nisley adds.

Ayse K. Coskun discusses how 3-D chip stacking technology can improve energy efficiency. “3-D stacked systems can act as energy-efficiency boosters by putting together multiple chips (e.g., processors, DRAMs, other sensory layers, etc.) into a single chip,” she says. “Furthermore, they provide high-speed, high-bandwidth communication among the different layers.”

“I believe 3-D technology will be especially promising in the mobile domain,” she adds, “where the data access and processing requirements increase continuously, but the power constraints cannot be pushed much because of the physical and cost-related constraints.”

Arduino Uno Blueprint — Free Download

Elektor.Labs recently produced an Arduino Uno blueprint poster for element14. The poster details everything you need to know about the Arduino Uno.

Download it for free here.

Download your Arduino Uno poster

Download your Arduino Uno poster

The poster also includes coding notes that will get you working with your Arduino Uno in no time.

About the Arduino Uno:

  • Core Architecture: AVR
  • Core Sub-Architecture: megaAVR
  • Silicon Core: ATmega328
  • Features: The Arduino Uno is powered via USB or an external supply. It’s programmed with Arduino software.

Recent Arduino-related articles from Circuit Cellar:

 

Client Profile: Digi International, Inc

Contact: Elizabeth Presson
elizabeth.presson@digi.com

Featured Product: The XBee product family (www.digi.com/xbee) is a series of modular products that make adding wireless technology easy and cost-effective. Whether you need a ZigBee module or a fast multipoint solution, 2.4 GHz or long-range 900 MHz—there’s an XBee to meet your specific requirements.

XBee Cloud Kit

Digi International XBee Cloud Kit

Product information: Digi now offers the XBee Wi-Fi Cloud Kit (www.digi.com/xbeewificloudkit) for those who want to try the XBee Wi-Fi (XB2B-WFUT-001) with seamless cloud connectivity. The Cloud Kit brings the Internet of Things (IoT) to the popular XBee platform. Built around Digi’s new XBee Wi-Fi
module, which fully integrates into the Device Cloud by Etherios, the kit is a simple way for anyone with an interest in M2M and the IoT to build a hardware prototype and integrate it into an Internet-based application. This kit is suitable for electronics engineers, software designers, educators, and innovators.

Exclusive Offer: The XBee Wi-Fi Cloud Kit includes an XBee Wi-Fi module; a development board with a variety of sensors and actuators; loose electronic prototyping parts to make circuits of your own; a free subscription to Device Cloud; fully customizable widgets to monitor and control connected devices; an open-source application that enables two-way communication and control with the development board over the Internet; and cables, accessories, and everything needed to connect to the web. The Cloud Kit costs $149.

Low-Cost SBCs Could Revolutionize Robotics Education

For my entire life, my mother has been a technology trainer for various educational institutions, so it’s probably no surprise that I ended up as an engineer with a passion for STEM education. When I heard about the Raspberry Pi, a diminutive $25 computer, my thoughts immediately turned to creating low-cost mobile computing labs. These labs could be easily and quickly loaded with a variety of programming environments, walking students through a step-by-step curriculum to teach them about computer hardware and software.

However, my time in the robotics field has made me realize that this endeavor could be so much more than a traditional computer lab. By adding actuators and sensors, these low-cost SBCs could become fully fledged robotic platforms. Leveraging the common I2C protocol, adding chains of these sensors would be incredibly easy. The SBCs could even be paired with microcontrollers to add more functionality and introduce students to embedded design.

rover_webThere are many ways to introduce students to programming robot-computers, but I believe that a web-based interface is ideal. By setting up each computer as a web server, students can easily access the interface for their robot directly though the computer itself, or remotely from any web-enabled device (e.g., a smartphone or tablet). Through a web browser, these devices provide a uniform interface for remote control and even programming robotic platforms.

A server-side language (e.g., Python or PHP) can handle direct serial/I2C communications with actuators and sensors. It can also wrap more complicated robotic concepts into easily accessible functions. For example, the server-side language could handle PID and odometry control for a small rover, then provide the user functions such as “right, “left,“ and “forward“ to move the robot. These functions could be accessed through an AJAX interface directly controlled through a web browser, enabling the robot to perform simple tasks.

This web-based approach is great for an educational environment, as students can systematically pull back programming layers to learn more. Beginning students would be able to string preprogrammed movements together to make the robot perform simple tasks. Each movement could then be dissected into more basic commands, teaching students how to make their own movements by combining, rearranging, and altering these commands.

By adding more complex commands, students can even introduce autonomous behaviors into their robotic platforms. Eventually, students can be given access to the HTML user interfaces and begin to alter and customize the user interface. This small superficial step can give students insight into what they can do, spurring them ahead into the next phase.
Students can start as end users of this robotic framework, but can eventually graduate to become its developers. By mapping different commands to different functions in the server side code, students can begin to understand the links between the web interface and the code that runs it.

Kyle Granat

Kyle Granat, who wrote this essay for Circuit Cellar,  is a hardware engineer at Trossen Robotics, headquarted in Downers Grove, IL. Kyle graduated from Purdue University with a degree in Computer Engineering. Kyle, who lives in Valparaiso, IN, specializes in embedded system design and is dedicated to STEM education.

Students will delve deeper into the server-side code, eventually directly controlling actuators and sensors. Once students begin to understand the electronics at a much more basic level, they will be able to improve this robotic infrastructure by adding more features and languages. While the Raspberry Pi is one of today’s more popular SBCs, a variety of SBCs (e.g., the BeagleBone and the pcDuino) lend themselves nicely to building educational robotic platforms. As the cost of these platforms decreases, it becomes even more feasible for advanced students to recreate the experience on many platforms.

We’re already seeing web-based interfaces (e.g., ArduinoPi and WebIOPi) lay down the beginnings of a web-based framework to interact with hardware on SBCs. As these frameworks evolve, and as the costs of hardware drops even further, I’m confident we’ll see educational robotic platforms built by the open-source community.