Matt Richardson is a San Francisco-based creative technologist and Contributing Editor at MAKE. He’s the co-author of Getting Started with Raspberry Pi and the author of Getting Started with BeagleBone.
View more articles by Matt Richardson
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.
106 thoughts on “How-To: Get Started with the BeagleBone”
Comments are closed.
Matt Richardson is a San Francisco-based creative technologist and Contributing Editor at MAKE. He’s the co-author of Getting Started with Raspberry Pi and the author of Getting Started with BeagleBone.
View more articles by Matt Richardson
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.
[…] Geting started with BeagleBone, MAKE Magazine. […]
[…] Geting started with BeagleBone, MAKE Magazine. […]
[…] If you comfortable working with 8-bit microcontrollers, the thought of moving to a hardware platform running embedded Linux may be a bit daunting. After all, there’s a lot going on between you and the chips on a board like the BeagleBone seen above. But [Matt Richardson] shows how easy it can be to get at the pins on this device. He put together a primer on hardware control from the embedded shell. […]
[…] If you comfortable working with 8-bit microcontrollers, the thought of moving to a hardware platform running embedded Linux may be a bit daunting. After all, there’s a lot going on between you and the chips on a board like the BeagleBone seen above. But [Matt Richardson] shows how easy it can be to get at the pins on this device. He put together a primer on hardware control from the embedded shell. […]
[…] If you comfortable working with 8-bit microcontrollers, the thought of moving to a hardware platform running embedded Linux may be a bit daunting. After all, there’s a lot going on between you and the chips on a board like the BeagleBone seen above. But [Matt Richardson] shows how easy it can be to get at the pins on this device. He put together a primer on hardware control from the embedded shell. […]
[…] If you comfortable working with 8-bit microcontrollers, the thought of moving to a hardware platform running embedded Linux may be a bit daunting. After all, there’s a lot going on between you and the chips on a board like the BeagleBone seen above. But [Matt Richardson] shows how easy it can be to get at the pins on this device. He put together a primer on hardware control from the embedded shell. […]
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. =(
[…] If you comfortable working with 8-bit microcontrollers, the thought of moving to a hardware platform running embedded Linux may be a bit daunting. After all, there’s a lot going on between you and the chips on a board like the BeagleBone seen above. But [Matt Richardson] shows how easy it can be to get at the pins on this device. He put together a primer on hardware control from the embedded shell. […]
[…] If you comfortable working with 8-bit microcontrollers, the thought of moving to a hardware platform running embedded Linux may be a bit daunting. After all, there’s a lot going on between you and the chips on a board like the BeagleBone seen above. But [Matt Richardson] shows how easy it can be to get at the pins on this device. He put together a primer on hardware control from the embedded shell. […]
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.
[…] Beaglebone has also popping up on some popular hobbyist sites, like Make Magazine and […]
[…] latest how-to for MAKE is about getting started with BeagleBone, the open embedded Linux platform created by several employees of Texas […]
“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.
[…] embedded system retailing for about $85. For more information I recommend checking out the “Getting Started Guide” by Matt Richardson @ Make magazine, in addition to the official BeagleBone […]
[…] How-To: Get Started with the BeagleBone Share this: Pin ItLike this:LikeBe the first to like this post. Makers in this post:Nuno Alves […]
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).
[…] Make: How-To: Get Started with the BeagleBone http://blog.makezine.com/2012/03/14/how-to-get-started-with-the-beaglebone/ […]
[…] first order of business was to test out IO. Using a multimeter and this great make article, running pyBBIO was trivial. So I decided to write my own library, in […]
[…] Quick start: http://blog.makezine.com/2012/03/14/how-to-get-started-with-the-beaglebone/ […]
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.
[…] We recently covered this promising product, and will continue to do so. It is a powerful, inexpensive, and tiny board that can be set up to run Linux in seconds. There is also a great community of developers creating applications and tools for it. At $89, it is definitely recommended to get you started with embedding Linux in your next project. […]
[…] you want to mess around a little more, Make Magazine has a nice blog post & video about using GPIO pins. Like this:LikeBe the first to like […]
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.
[…] default Angstrom Linux distribution. Sound interesting? Check out our own Matt Richardson’s Getting Started with BeagleBone tutorial, or pick one up in the Maker Shed (you’ll probably want the DVI-D Cape as […]
why would you want a Beagleboard rather than a raspberry pi?
[…] info: http://blog.makezine.com/2012/03/14/how-to-get-started-with-the-beaglebone/ Tags: Beagle, beagleboard, beaglebone, blink, Board, Bone, electronics, ethernet, […]
[…] More info: http://blog.makezine.com/2012/03/14/how-to-get-started-with-the-beaglebone/ […]
[…] giving you a solid foundation. Previous to writing the piece for the magazine, Matt had done a great starter blog post that has a good comment thread you might want to check […]
[…] giving you a solid foundation. Previous to writing the piece for the magazine, Matt had done a great starter blog post that has a good comment thread you might want to check […]
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?
[…] following the Make magazine‘s tutorial on getting started with the BeagleBone, but realized it was much more involved […]
[…] How-To: Get Started with the BeagleBone (makezine.com) […]
“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??
[…] x x x x x x x x x x x x x x x x […]
[…] How-To: Get Started with the BeagleBone Boost Your BeagleBone Black with Breakout Board Programming BeagleBone Black PRUs BeagleBone Black – Working with the PRU-ICSS/PRUSSv2 Embedded Linux Meets FPGA Capes […]