Intro: BeagleBone : Ubuntu OS & LXDE GUI
Hey all! The last major instructable I posted was the rc glider drone. Major process underway, testing the system in a powered model airplane now. In the meantime, I would like to post the progress I have made with the beaglebone.
I think this project is very cool and has nearly countless applications!! We are going to be setting up our own single board, fanless computer using the beaglebone. We will setup a mini SD card so that we can boot Ubuntu onto the beaglebone, we will setup a a lightweight GUI (graphical user interface - a desktop environment vs terminal) and just for kicks we will install the arduino programming environment.
Even though this board is heavy on linux, I included this in the microcontroller section in the hopes of more arduino fans giving this board a whirl..,
I chose ubuntu because there is already an existing image to format your sd card. Also, I have been running ubuntu on my laptop to program arduino, so it seems natural that you would try and match the os from your board and your computer.
I would recommend joining the group "beagleboard" on google groups. The beagleboard is much more complicated than an 8bit microcontroller.
This instructable is basically an editorialized repost from the linux website: http://elinux.org/BeagleBoardUbuntu
If you have any knowledge or interest with linux, or beagleboard, please sign up and contribute to the beaglebone group on instructables. There is a lot to do here folks!! https://www.instructables.com/group/beaglebone/
At the end I have included how to set up a lightweight GUI so that you can SSH in from your laptop and set up a "virtual desktop." I also show how to install and run the arduino IDE so that you can use the beaglebone to program any arduino NOTE: I HAVE NOT CONFIGURED A DEDICATED SCREEN OR A KEYBOARD TO THE BEAGLEBONE. I JUST WANT TO ILLUSTRATE THAT THE PROCESSING POWER OF THIS BOARD IS MUCH CLOSER TO A COMPUTER THAN TO AN ARDUINO.
A good next step would be to figure out the HDMI cape so that you can run the LXDE desktop on any hdmi monitor.
Step 1: Download the Disk Image
I am going to strongly suggest running some form of linux on your computer. Since the BeagleBone is a linux based development platform (it comes preloaded with Angstrom - linux- and most of the other precompiled images are also linux). It makes sense to run linux on your computer. If you are still anxious about making the switch, you can dual boot a linux OS from a disc or thumbdrive. However, I think it will be most convenient to use "wubi" to dual boot Ubuntu from your laptop.
If you are already running ubuntu on your computer, these next steps ~should~ be very easy. Get ready to copy and paste!
Make sure you are uploading the most recent release
From your computer terminal:
$ wget http://rcn-ee.net/deb/rootfs/precise/ubuntu-12.04-r5-minimal-armhf-2012-07-29.tar.xz
$ wget http://ynezz.ibawizard.net/beagleboard/precise/ubuntu-12.04-r5-minimal-armhf-2012-07-29.tar.xz
This will download the disc image for your SD card straight to your computer. If you are running something other than Ubuntu, the links following the wget command will dowload the image to your computer also.
To verify that the images have downloaded correctly:
$ md5sum ubuntu-12.04-r5-minimal-armhf-2012-07-29.tar.xz
This should return:
Step 2: Unpack the Image
The image file is essentially "zipped." You must unpack the image:
$ tar xJf ubuntu-12.04-r5-minimal-armhf-2012-07-29.tar.xz
Once the image has unpacked (this will take a while), open the directory containing the image file:
$ cd ubuntu-12.04-r5-minimal-armhf-2012-07-29
Step 3: Prepare Your SD Card
Connect your mini SD to your computer. The beaglebone should include a mini SD to SD adapter. in this tutorial I am using an 8Gig SD with a USB to Mini SD adapter. I would recommend removing all peripheral USB devices so taht you don't accidentally reformat them. Use the command:
$ sudo ./setup_sdcard.sh --probe -mmc
It will return something like:
Are you sure? I Don't see [/dev/idontknow], here is what I do see...
Disk /dev/sda: 500.1 GB, 500107862016 bytes <- This is your hard drive!
Disk /dev/mmcblk0: 3957 MB, 3957325824 bytes <- This is likely your SD card. Note that it is not the full size of your available memory
/dev/sda1 on / type ext4 (rw,errors=remount-ro,commit=0) <- This should point to the device you are using to connect to your SD. This will change depending on what you are using to connect.
Remember the location of this drive!!!
Step 4: Install the Disk Image!
Remove all other USB devices! Once you are sure that you have found the correct port for your SD card run this command from the unpack image directory:
$ sudo ./setup_sdcard.sh --mmc /dev/sdX --uboot bone
//where sdX is the location of your drive. Mine was sdb, on the linux site it shows as sda.
It will ask you if you are 100% sure you have selected the drive. Type (y)es to continue!
Step 5: Login -Serially-
Plug your sd card into your board and login, serially :
$ screen /dev/ttyUSB1 115200
You may be running off of a different USB port
Another option is to run your board using minicom. I recently set this up and it works just fine. To get minicom on your computer:
$ sudo apt-get install minicom
Once you have installed minicom configure your serial settings:
$ sudo minicom -s
This will launch minicom. You have to sudo if you want to save your setting changes. Enter the correct location of you beaglebone (if usb its : /dev/ttyUSBX) Make sure your baudrate is at 115200. Turn off all flow control.
Once you are done configuring, save your setup as "bbone" Now you only have to:
$ minicom bbone
to establish your serial connection
First login as root with password "root" and then change your root login password!:
Setup a non-root user "username":
$ sudo adduser username
If you want to run chromium web browser from your beaglebone you will need a non root user.
Ubuntu will take you through a user setup. To setup/change the password:
$ sudo passwd username
Step 6: SSH In!
I find that the best way to work on the bone is through your home network with a secure shell (SSH). This will allow your board internet access for easy downloads, and an ethernet connection is much faster than a serial one!! Plug your board into your router and power (a little box for your board would be a good idea if your router is collecting dust).
Before logging into your board, you may want to loosen your computers networking standards.
cd into .ssh and make a or edit the file "config" to the following:
# Disable host checking for any "local" machines
This will help while you are still developing your board.
To find out what IP the dhcp has assigned run the following:
$ for ip in $(seq 1 254); do ssh email@example.com.$ip -o ConnectTimeout=5; [ $? -eq 0 ] && echo "xxx.xxx.xxx.$ip UP" || : ; done
Change the X's with the first three numbers of your network ip address (probably: 192.168.1)
Login with your root password
Step 7: Configure Your Board
This is a good time to install any tool packages you will need. For example, if you plan on running your board wirelessly, you will need the wireless tools package. Check out the website for the most recent update here http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html
Or just :
$ wget http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/wireless_tools.29.tar.gz
Step 8: Install & Run LXDE Desktop
Get ready for the big download!
LXDE takes up 215 Mb of space, I am using a 8Gig SD card so this is not much of a problem.
$ sudo apt-get install lxde
This will take a long time to download and upack. But once your done you should be able to run a virtual desktop from your laptop.
It took me like 25 minutes to load and setup. Once you have finished the download
when you ssh in this time:
$ ssh firstname.lastname@example.org -X
you may have to try:
$ xhost -X
$ exec startlxde
to get it working :\
When I run this, a taskbar appears at the bottom of my desktop. I can navigate the bbone from there
In order for me to run chromium from the beagle I need to ssh in as a user other than root.
Step 9: Install Arduino IDE?
If you want to install and run the arduino ide off your beaglebone, you can easily do that.
$ sudo apt-get install arduino
once you have installed, simply
in your omap terminal to run the IDE.
You've done it! We've gone from programming a microcontroller to programming a microcomputer capable of programming and troubleshooting all those great arduino projects you have lying around (or still in your head). Regardless, its a lot easier than it should have been- thanks for all the support from element14, google groups beagleboard, and seemingly endless linux forums.
i ordered the 4inch lcd touch screen cape, but I will not get it until September. Maybe it would be possible to set up some kind of diagnostics side kick with the beagle bone? Regardless, I will let you know how the screen works :)
Step 10: Reformat Your SD
If you want to reboot an OS onto your SD card, you'll need to wipe the card. There are a few ways to do this but this is the one that worked for me:
$ sudo shred -vfz -n 100 /dev/sdX
I do not know how many passes this will take