I’ve had my eye on embedded Linux platforms for quite a while now, but wasn’t sure how to get started. When I saw that our own Maker Shed started carrying the BeagleBone I put in a call to get a trial unit. The system reference manual that comes with the board is a bit daunting, and isn’t meant as a getting started guide (despite the fact that there’s plenty of useful reference information in there). After a bit of researching online, I started to get the grasp of using Linux’s virtual file system, sysfs, to read and control the GPIO pins on the BeagleBone. In parallel, I taught myself just enough Python to script these operations. With a basic digitalRead and digitalWrite functions, I had many of the tools I needed to do some cool projects with the board.
However, I spent a lot of time going back and forth between my board, the system reference manual, and my script as I worked towards getting blinking LEDs and buttons. Translating between the physical pin on the header to the pin I’d be referencing in the script meant going through two steps of translation, which quickly became frustrating. I updated my Python functions to do this translation for me and packaged it up into its own module. I didn’t have the intention to make this module available publicly, but I figured it could be a lot of help to anyone who’s getting started. This module, mrBBIO, is available at Github and I welcome anyone to make any improvements to it. If you’re looking for something more advanced, check out PyBBIO, which uses memory registers to do the same thing.
Now that I’ve got a good grasp on this, I’m eager to start using it in a “real” project. I managed to get the lighttpd web server with PHP running and I even wrote a PHP script that could set pins high and low. This will make it so much easier to put my electronics projects online, something that can be quite a challenge to do on less capable microntrollers.

I couldn’t cover every possible detail involved in working with the BeagleBone’s GPIO pins, but I hope this list of resources will fill in any gaps:
- Nathan Dumont’s blog post on Hardware Interfacing on the BeagleBone was a huge breakthrough for me in figuring out how to control GPIO pins with sysfs.
- A lot of my Google searches lead me to The Embedded Linux Wiki at eLinux.org. There are some BeagleBoard and BeagleBone specific pages, but the other pages are a very helpful resource as well.
- Nuno Alves wrote a great post on how to load a new beaglebone OS into a SD card using Mac OS X
- For quick questions, the #beagle IRC channel on Freenode was a big help. You’ll find me lurking there if you need any help with this particular project. Just mention “MattRichardson” and I’ll get an alert.
- Akademii’s blog post on BeagleBone GPIO Testing helped me through a common pin multiplexing pitfall on the BeagleBone.
- GigaMegaBlog has a post about using serial and analog input on the BeagleBone. I haven’t dug into these topics much, but they may be good for people who want to get beyond digitalRead and digitalWrite. Be sure to check out all of the Beagle posts at GigaMegaBlog; there’s a lot of great content there.
- Alexander Hiam’s pyBBIO gave me a good idea of how to make the mrbbio module take a simple setup and loop function, just like Arduino code.
- Mark Lutz’s Learning Python, 3rd Edition helped me figure out how Python works.
Subscribe to How-Tos with Matt Richardson in iTunes, download the m4v video directly, or watch it on YouTube and Vimeo.


Very nice video. good timing to compare with the eventual arrival of the raspberry-pi. please make more that highlight the distinctions.
Wow is this ever an eloquent exposition for why Linux-based ANYTHING just ain’t there yet for most of us. “Just type echo 38 to sys class gps export” Yikes.
I *so badly* wanted to grok this, but there are just too many barriers there for me.
Is the concept of an embedded Linux microcontroller inherently more powerful than Arduino’s friendlier playground? Does this power justify wading through Linux bumpf?
Can someone familiar with both platforms talk about what Beagle can do that justifies all this Linux gibberish? Or is it just a case of use what you’re used to?
Short version: Yes.
Linux takes a while to understand, but it’s actually quite simple for the level of power it provides. Or perhaps not simple, but fairly elegant, given the complexity of a full fledged operating system.
It is vastly more flexible and powerful than Arduino, but then, there are lots of things I’d rather use Arduino for. If it needs just a little brains- Arduino. If you need a webserver that could survive on the actual internet, attached to something with a lot of I/O’s, then the BB looks pretty attractive. (I’ve tried the Arduino webserver, it’s “cute” but not a real server by any means, and I cringe at the idea of having it out on a public address.)
Just depends on how much computing power and software support you need to do the job. The BB is roughly equivalent to a modern low end computer with a huge software library, whereas the Arduino is equivalent to an Apple][, more or less. (I still have one, maybe someday I’ll benchmark them both…)
Great analogy actually. and I did love my apple II.
Two of the most attractive things about the arduino (for me) are the large number shields out there, and the vibrant support community. I guess beagle being linux has real advantages in terms of software library, code integration with bigger projects etc. and I guess once you get past hello world stage you can whip up all kinds of macros and shortcuts that make common basic operations look normal.
I need to find a smoother beagle tutorial environment — the equivalent of the adafruit arduino tutorials would be ideal.
Hi Seth,
Don’t let the jargon prevent you from getting started with Linux. To be fair, Matt said “you type ‘echo 38 to sys class gpio…’” BUT at the same time the video shows:
root@beaglebone:~$ echo 38 > /sys/class/gpio/export
This is a simple way of writing “38″ to a file. In Windows or Mac you can fire up a text editor, enter “38″ and save it to that file. In fact, you could do that in Linux too. And you can use echo on Windows and Mac too. It is worth learning these commands, and Linux will never get rid of them (neither will Mac or Windows) because they make simple things (such as writing a value to a file) quick.
Pingback: Embedded Linux | Boondocks Electronics
Pingback: BeagleBone | Boondocks Electronics
Pingback: Twiddling an LED using the BeagleBone’s embedded Linux - Hack a Day
Pingback: Twiddling an LED using the BeagleBone’s embedded Linux | ro-Stire
Pingback: Twiddling an LED using the BeagleBone’s embedded Linux » Dirty Old Device
Pingback: Twiddling an LED using the BeagleBone’s embedded Linux » Geko Geek
After reading through the article and watching the video I am kind of embarrassed that I have no idea how I would still go around using this board…
And I am coming from Computer Engineering background, currently working as a programmer.
Maybe I should brush up on my Arduino skills. =(
Pingback: Twiddling an LED using the BeagleBone’s embedded Linux | Orange Claymore Red Slime
Pingback: Twiddling an LED using the BeagleBone’s embedded Linux « Hackaday « Cool Internet Projects
Any particular reason you didn’t use node.js and the BoneScript library? For rudimentary stuff, it’s a lot like Arduino. The cloud9 IDE is much better than Wiring (imho).
I noodled around with node.js and BoneScript for quite a while, but had a very hard time wrapping my head around how to use node properly. I concluded (and perhaps incorrectly) that using Python meant that the code would be much easier to understand and much more Arduino-like. Also, when I started trying out BoneScript, digitalRead wasn’t yet implemented.
Pingback: Beaglebone Coding 101: Buttons and PWM | GigaMegaBlog
Pingback: matt richardson: How-To: Get Started with the BeagleBone
“I managed to get the lighttpd web server with PHP running and I even wrote a PHP script that could set pins high and low.”
Can you share how, specifically how to disable the bone.js running (under Angstrom) ?
I decided I didn’t want to dismantle the bone.js server (yet) so I set lighttpd to listen for connections on port 81. (edit /etc/lighttpd.conf so that server.port is uncommented and set to 81)
Thanks for that.
I am currently struggling with opkg errors (unstable feed)
I’m not sure what that could be about. If you have the latest build of Angstrom installed, I would check with the BeagleBone Google Group or #beagle on the freenode IRC network.
I wonder is anyone has attempted to program the BeagleBone without Linux, actually without any OS ? For those of us who like to “program on the metal” all the extra learning simply to flip a bit seems too much.
Besides I bet all that OS overhead reduces the Port IO way down.
That’s a good question, I don’t know if anyone has tried to program the board without Linux. But as I said in the video, using a Linux computer to blink an LED is definitely overkill. The true potential for the device comes out when you need to use complex TCP/IP protocols, file systems, secure remote login, and so on. It could be a lot of work implementing those features “on the metal.”
Hi Matt,
It is a great video! As a beginner to linux and embedded programming, it is the best source on the Internet that one can find. I hope you will post more source and documents for beaglebone.
Thank you
Having a decade+ of Linux sysadmin experience I’m really looking forward to trying out the BeagleBone. Once I get a bit more practical electronics under my belt I’ll probably go ahead and order one.
Glad to hear it! People like you are well poised to take advantage of the platform. Because of all the power that Linux provides “out of the box,” that I think you’ll be doing awesome stuff in no time. Let us know how it goes.
Pingback: » Cracking PDF-file passwords using a BeagleBone board Wunderkammer
Pingback: MAKE | How-To: LCD Controlled by BeagleBone
Thanks, Matt! I’d been looking for a quick getting-started tutorial on Beagleboard, and you did the job perfectly. Now I have the confidence to start on some more complicated projects (cameras, WiFi, OpenCV).
Pingback: Beaglebone(1) « stastaka's Blog
Pingback: Embedded! « Adonis2101's Blog
Pingback: Beaglebone and ExtJs Web App « Isola Software
I appreciate the simple video tutorial and the sample led examples you reference. In your current download file I noticed a mrbbio.pyo file. I assume this calls the pyo audio C-code? Do you have examples using this environment?
The pyo files are a byproduct of the Python compiler. They’re optimized, precompiled files so that the compiler doesn’t have to keep recompiling the modules that don’t change. The Python experts out there can probably give a more exact explanation.
Pingback: MAKE | Innovate The Future With Texas Instruments
Pingback: Getting Started with Beaglebone « Tayken's Blog
I am buying a Beaglebone shortly, I was curious about the boot up sequence of the board, I think the reference manual does not state it clearly, my apologies if I have missed it out in the manual. I am looking for details like, which device it first looks into after power on, is it the EEPROM ? Then after that does it jump to the micro sd card, what is the address range of the micro SD etc.
My objective of working on this board is to understand the Linux device drivers thoroughly. May be write my own I2C drivers instead of the existing one and so on. Thank you.
I’d like to know this too.
Pingback: MAKE | Makey Awards 2012 Nominee 03: BeagleBone, Hackable Gadgets
why would you want a Beagleboard rather than a raspberry pi?
Pingback: So8ra6 - How-To: Get Started with the BeagleBone
Pingback: How-To: Get Started with the BeagleBone | How to Videos, Articles & More |How To - Tips for your phone, tablet, computer, home theater
Pingback: MAKE | New to BeagleBone?
Pingback: New to BeagleBone?
Hi friends, I am new beaglebone user and I obtained PyBBIO from https://github.com/alexanderhiam/PyBBIO/wiki/Using-PyBBIO . I tried to implement the examples there. However there was a problem about “run” command. Could anyone help to me ?
Hello, I´m trying to use the configuration of the PWM like input, can you help me please?
Hello, Can i work without use the Linux system, i mean can i work with the Windows system also?
Pingback: BeagleBone Update 3 Apr 13 | brain.rand()
Pingback: BeagleBone usb console driver Mac OS X | fortune datko
“I managed to get the lighttpd web server with PHP running and I even wrote a PHP script that could set pins high and low.”
How did you get PHP to work with I/O’s??
// What's Trending
Raspberry Pi Design Contest
Ten Tips for Adhesive Tape
Seventeen Sneaky Secret Hides
I Have a (Puzzling) Dream
10 Things to Connect to Your Raspberry Pi
Maker Faire: Day Two
47 Raspberry Pi Projects to Inspire Your Next Build
// What's Shared
A better way to slice a pumpkin
DIY Nerf Darts
100 Dollar Store Organization Ideas for Craft Rooms and Beyond
In the Maker Shed: Minty Boost USB Charger
Mad’s Mouse House
Lace Princess Crowns
I Have a (Puzzling) Dream
Play the Rings of a Tree Trunk Like a Record
// Most Commented
DIY Hacks & How To’s: Get Emergency Power from a Phone Line
Resin Casting: Going from CAD to Engineering-Grade Plastic Parts
Ten Tips for Screws and Screwdrivers
Ten Tips for Better Measurement
Makers on TV: Big Brain Theory
Arduino Announces New Wireless Linux Board
Is it a Hackerspace, Makerspace, TechShop, or FabLab?
Tool Review: BioLite CampStove
Trending Topics
Get our Newsletters
About Maker Media
Subscribe
to MAKE!
Get the print and digital versions when you subscribe