Introduction: Getting Started With BeagleBone Black
After using Arduino for a while, I decided to try Beaglebone Black. Seeing the lack of content on Instructables, and having some difficulty getting started myself, I wanted to help other people get set up with BeagleBone Black.
Step 1: What Is BeagleBone Black?
BBB is a single-board computer running embedded Linux. It has 4GB onboard eMMC that contains the Linux OS, as well as a microSD slot to run a different OS, or burn it to the eMMC. It has 512MB of RAM, and a whole lot of I/O pins, including analog-to-digital converter (ADC) and pulse-width-modulation (PWM) pins. It also has an HDMI output, a USB plug (for a camera, keyboard/mouse, etc.) and another USB for connection to a computer, ethernet, on-board LEDs, and a 5V input jack.
This Instructable will cover everything you need to know to get started with your BBB, including SSHing to it from your computer, connecting to the internet from your BBB through your internet connected computer, and getting started using the onboard Linux OS.
Step 2: What You Need
To get started, you will need:
BeagleBone Black (got mine from Digikey, but you can get it elsewhere)
USB cable (should come with the BBB)
microSD (4GB or more)
PuTTY terminal emulator
You may also need a Linux live USB or CD
Step 3: Get PuTTY
You will need PuTTY to SSH to your BBB, or connect through a COM port. Download it here, but make sure it is just PuTTY, nothing extra special. You can choose the installer, or just an .exe file. Place a shortcut somewhere accessible on your computer, as we will be using it a lot.
Step 4: Connect to Computer
Reboot your windows computer to allow unsigned driver installation. In WIndows 10 and 8.1, you can hold shift when pressing the Restart button in the power menu, then click advanced options in the reboot menu. In Windows 7, you need to enter the Advanced Boot Menu and select Disable Driver Signature Verification or something like that. Restart and when the splash screen appears, hit F8, F12, or Delete, whichever it is for your computer. I can't cover all computers, but it should be fairly straight forward.
Next, connect the USB to your BBB, then to your computer. Wait until the BBB shows up as a removable drive or the removable device chime goes off. Open File Explorer and navigate to BeagleBone Getting Started. It may pop up right away, too. Double click on START.htm to open a web page saved to your BBB. Scroll to Step 2, and download the appropriate drivers, probably Windows (64-bit), and open the file. Click yes on the Admin popup. This installer will allow you to connect to your BBB as a local network, necessary for accessing the webpage hosted on it, and SSHing directly to it from your computer. This installer is unsigned, but should work because we disabled driver verification.
After the drivers install, a new local network should show up and automatically connect. To test this, go back to your web browser with START.htm, scroll to Step 3, and launch 192.168.7.2. Use Chrome or Firefox, as Internet Explorer will not work. You should see a big green check mark. If so, Congratulations! You have successfully set up the local network and can now connect to your BBB!
Step 5: SSH
Secure-Shell, or SSH, is a connection technique used to work on network connected servers from anywhere. For our purposes, you will SSH to your BBB when it is connected to your computer, but you can also connect to it remotely, as long as the BBB and your computer are on the same network (it is possible to truly remote connect, but is tricky to set up and may be insecure if done wrong.
With your BBB plugged into your computer, open up PuTTY. You should see the exact image as above. In the main pane, we can select between SSH, Serial, and others. We will be using SSH and Serial. With SSH selected, type in the ip address of your BBB. In our case, it is 192.168.7.2, since it thinks it is connected to a network hosted by our computer. Go ahead and save the connection in the Saved Sessions pane, naming it whatever you like. I named it BBB SSH Local. Hit Save, then Open. A window should popup, and a security warning will appear. Don't worry!. It is just because it is the first time connecting to your BBB. Click Yes, and a login should appear. If not, double check the ip address, and make sure the drivers were installed correctly. To login, enter "root" (without quotes), and hit Enter. There is not password set up yet, but we will do that later. If you see some text with information about Beaglebone, then you have successfully SSHed to your BBB!
Step 6: Serial
Perhaps you may want to connect to your BBB through a Serial port. The process is almost the same, you just have to select the Serial option in PuTTY. Enter the COM port of your BBB (find it in Device Manager in Windows), enter 115200 as the Baud Rate, and click Open. Enter "root" for the user. There is no password unless you set one up. User/password combinations are the same for SSH and Serial, you don't have to set up separate users, they work across both techniques.
Step 7: First Steps in Linux
Unless you have previous experience with Linux and its terminal, it can be overwhelming to see tons of text and no buttons, menus, or other graphics. Don't worry! You will get used to it, and you will learn how to think through the terminal. I won't go through all the commands, but here are some of the basics you will use to get started:
passwd - Used to set new password for the logged in user. Highly recommended as first command to prevent security problems.
pwd - Print Working Directory. Used to print the path of the directory (folder) you are in
ls - Used to list contents of the working directory (folder)
cd - Changes directory. Use like "cd files" if the directory "files" is in the working directory, or "cd /root/files". Use just "cd" to go back to your home directory (now /root), and "cd .." to go up a level.
more - Used to peak at file without opening it. Use "more myFile" to peak at contents of the file "myFile."
ifconfig - Prints off information about the internet connectivity.
These commands will help you explore the terminal and all the directories and files that run the Linux OS. Don't types in random characters, as you never know when you might wreck something. You are logged in as a the root user, the equivalent of Administrator in Windows, but it doesn't prompt you to confirm changes. It just does them. There are many resources online and in books (who reads those anymore) that can help you navigate the terminal. I can't list every command and how to use them (we would be here a while), so if you need to do something, look online to find a command.
Step 8: Connecting to the Internet on You BBB
If you enter the command:
you should get results, with your BBB pinging your computer (which is the gateway on the BBB's little local network). But if you do something like:
pinging the Google DNS server, you will get an error, something like no network connection. This is because your computer isn't passing its internet connection through to the BBB. We need to tell our computer to do that. So, in Windows, go to Network and Sharing center. On the left pane, click Change Adapter Settings. You should see your internet connection, usually Wi-Fi, lan, or Ethernet. You should also see your BBB, for me it is Ethernet 3, Linux Usb Ethernet. We need to allow traffic from the BBB to be sent through our computer's connection. To do this, right click on the internet adapter that has a connection, for me it is the Wi-Fi adapter, and click Properties. You may need Admin rights. Go to the Sharing tab, and check the allow network sharing box. In the drop down menu, select your BBB connection, for me Ethernet 3. Click Ok. Next, we have to change some of the BBB's connection settings. Right click your BBB's connection, and click Properties. Double click Internet Protocol Version 4 (TCP/IPv4), and check the box to obtain IP address and DNS server automatically. Click Ok, then Ok.
If you were connected to your BBB through SSH, then the PuTTY windows may error out due to network changes. Simply close it, then re-open another SSH connection. We can't access the internet quite yet, as there is still some changes needed in the BBB. Login to the root user as before, and enter the following command:
/sbin/route add default gw 192.168.7.1
This route the BBB's internet traffic through the USB network instead of the Ethernet port. You should now be able to ping 22.214.171.124, Google's DNS server. But if you try
it may error out. If so, enter the following:
echo "nameserver 126.96.36.199" >> /etc/resolv.conf
to add the Google DNS server to the list of nameservers on the BBB. You should now be able to ping google.com. If not, enter:
and add "dns-nameservers 188.8.131.52" to the end of the file, making sure there is no tabs before it on the same line.
In case you are worried, you will still be able to plug your BBB into an Ethernet port, as the changes we made are only good until the next reboot. You will have to follow this step again in you reboot or shutdown and unplug from your computer.
For some reason, I have had trouble with the network not working when I reconnect my BBB to my computer at a later date. I just disable and reenable sharing on my computer and reset the IPv4 setting for my BBB's connection. Until I find a solution, if this happens, just redo this step.
Step 9: Not the End
IF you have gotten this far, congratulations! You are well on your way to making awesome projects with BBB. From here on, there are a couple of paths to take:
- Focus on Linux programming with C++, Python, or a multitude of other languages supported by the BBB
- Explore the GPIO (general purpose input/output, the big black headers on the sides of the BBB) and interface with external components
- Work with website hosting and networking to make a web or file server
- Anything else you can think of!
The rest of this Instructable will be troubleshooting if and when you run into problems. I hope to add to it more later, but I'll get a start now. I you have any problems, feel free to comment, and I'll try to help the best I can.
Step 10: Re-Flashing the Onboard EMMC
If you break something in the BBB's file system, you may have to reflash the onboard eMMC, the memory that holds the OS. It is a bit tricky, and I ran into problems the first time around. If you have windows, it is tricky to modify the sd card, so you may need a live Linux USB of CD.
First, download a new image from here. Download the first entry, under Recommended Debian Images, Jessie for BeagleBone. Depending on your connection, the download may take a while; it's quite big. Meanwhile, download 7-zip from here, selecting the proper version from the list. Install it, as you will need it to unzip the Debian image. When the image is done downloading, open it with 7-zip (it will be a .xz file), and extract it somewhere you will find it. Next download SDFormatter here and install, and Win32DiskImager from here, and install (don't you just love all these little tools?). Insert you sd card into your computer and open SDFormatter. Format your sd card, making sure it is actually your sd card in the dropdown box. When that is done, open Win32DiskImager, click the browse button on the right, and find the extracted file. Select the file, select your sd card in the other dropdown box, and click write. This will take a while, so go find a snack, take a nap, and binge-watch your favorite TV show.
When it is done, you will have to shutdown your computer and boot into a live Linux USB or CD (other tutorials are online explaining how to do so). When Linux loads, find your sd card, and open /boot/uEnv.txt, and find the line that says:
##enable BBB: eMMC Flasher:
and change it to:
##enable BBB: eMMC Flasher:
Save it, and then eject the sd card. Plug it into your BBB sd card slot, and power it up, holding the Boot button until you see the LEDs light up. The LEDs should start to blink back and forth. If they are, then the BBB is flashing the new image to the onboard eMMC. Now wait. Find another snack and finish binge-watching your show. Come back when the lights are dark, and remove the sd card. Mark the sd card in some way to remind you that it is a flasher, or edit to line back to the original. Because you can also boot into the sd card without flashing, you don't want to accidentally reflash your BBB.
Another way to edit the flasher line int /boot/uEnv.txt is to boot to the sd card, hold Boot button on power up, and edit the file directly from the BBB. I believe it is on the removable disk partition when you plug it into your computer. I have not done this, but it should work, and you don't have to boot into Linux. If somebody does this and it works, let me know and I'll put it here as the recommended option.
Step 11: Next Steps
If you have any questions, feel free to comment. If you have any problems, I can try to help. I want to post more projects using the BBB, but I am also a bit of a beginner myself. Hopefully this helped you get started, and I can't wait until more BBB projects are posted on Instructables.