Home > Articles

Getting Started with the BeagleBone Black

📄 Contents

  1. Setting Up and Saying "Hello, World!"
  2. Connecting to Ethernet
In this chapter from The BeagleBone Black Primer, Brian McLaughlin walks you through where to get equipment, how to set up "Hello World," and connecting to Ethernet.
This chapter is from the book

This chapter is from the book

To get started with the BeagleBone Black, you will want to obtain the board itself and some of the basic parts. The board is available from a number of resources. The beagleboard.org website provides some great places to buy the board (see http://beagleboard.org/black). Of course, I have my favorite suppliers, which are both a major part of the Maker community:

  • SparkFun Electronics (http://sparkfun.com)—Boulder, Colorado–based SparkFun Electronics was founded on the idea of open source and open hardware. The company has an extensive catalog of electronics parts and components and consistently supports the community. SparkFun also has excellent tutorials and active forums where you can always find help on your projects. If you live in the Boulder area, be sure to watch for the in-person classes and other events the company sponsors!
  • Adafruit (http://adafruit.com)—Based in New York City, Adafruit was founded by Limor “Ladyada” Fried, a true celebrity in the Maker community. The company is another great source for all the components and parts you might need for your projects and for taking the steps to move your projects beyond the introductory ones in this book. Adafruit also has an extensive tutorial section on its website.

When I am shopping for parts, I am often torn between these two suppliers. They are both excellent companies that have provided great support to me and countless others. Determining which to use, however, shouldn’t be as much of a struggle as I might make it seem. The two companies work well together, participate in events together, and are both friendly. They represent the best of the community because they aren’t there to compete against each other; they support the community and make sure we have what we need to get our projects off the ground. If you have questions on electronics basics or more complicated techniques, you can generally find a tutorial on one of the two sites or find willing support in the forums and via email.

In each chapter, I will outline the parts you will need for that chapter’s project. We will take a practice run with this chapter and look at getting your BeagleBone Black set up and running. First, note some of the parts you’ll need:

  • BeagleBone Black
  • USB cable (USB A to USB Mini B)
  • +5 volt DC power supply (at least 1,000 milliamps)
  • Ethernet cable

The USB cable should come with the BeagleBone Black; if it does not, make sure you inform your supplier. If a friend gave you the board, then just ask nicely. To get started, you also need a way to communicate with the board. In this chapter I’m going to discuss how to connect the BeagleBone Black to another computer and also how to connect remotely via Ethernet. Another option is to connect a monitor, keyboard, and mouse directly.

Setting Up and Saying “Hello, World!”

The big moment has arrived, and it is time to power up your BeagleBone Black and start working! We start with a direct computer connection via USB. This is a simple step. Simply plug the USB cable into the BeagleBone Black and the other end into a USB port on the computer.

As soon as the board is connected to your computer, you should see the lights on the board come to life. Four lights should start blinking on the board. These are four “user” lights, labeled USR0, USR1, USR2, and USR3, as shown in Figure 3.1. There is also a power light labeled PWR. The power light should stay constantly lit. The user lights will blink with different activities. At the default boot on a clean board, you will find the user lights configured as follows:

  • USR0—This light blinks in a heartbeat pattern: two quick flashes, a pause, and then repeat.
  • USR1—This light is configured to blink on activity from the microSD card. Because the board isn’t plugged in a microSD card yet, you shouldn’t see any activity on this light yet.
  • USR2—This light flashes on CPU activity.
  • USR3—This light flashes when the built-in flash memory is accessed. The default operating system should be installed in this embedded Multi-Media Card, or eMMC, memory, so you should see activity as the board is accessing the built-in, default operating system and file system.

FIGURE 3.1 The BeagleBone Black user lights, power light, and USB port highlighted.

Next, you’re going to have to install the drivers necessary for your computer to talk to the BeagleBone Black. On a Windows 7 laptop, you just plug the board in via USB to allow a drive to mount from the board that contains driver files. Use these files directly so that you don’t have to look for them. You also have the option of downloading the drivers from the BeagleBoard organization website (http://beagleboard.org/getting-started). Drivers are available for Windows 32- and 64-bit environments, OS X, and Linux. You should refer to the specific setup instructions for your machine.

Now that you have your BeagleBone Black up and operating and have the drivers installed, what can you do? Your BeagleBone Black is already running a web server! You can use the Chrome or Firefox web browser to navigate to the board’s web server at

Navigate to the BeagleBone Black website at Your browser should present a very colorful and active website, and you should see something like the banner shown in Figure 3.2.


FIGURE 3.2 Banner from the BeagleBone built-in website letting you know everything is working just fine.

This banner gives you information about your BeagleBone Black. First, the banner is green and has a check mark. That must mean everything is good, right? Also, the banner tells you that the board is connected. These are all good indications that all is right with your BeagleBone Black’s world. Table 3.1 explains the other information that is supplied.

TABLE 3.1 Default Website Banner Information

Listed Information


BeagleBone Black

You bought a BeagleBone Black, right? This is a good sign that you bought what you thought you were buying.

Rev 000C

This tells you that, in this case, version 000 of the revision C BeagleBone Black hardware is running.

S/N 2314BBBK0577

This is the serial number of the specific BeagleBone Black.

Running BoneScript 0.2.4

The board runs BoneScript version 0.2.4. BoneScript is a version of JavaScript for the BeagleBone environments.


This is the IP address of the board on the virtualized network over the USB connection. It should match the address you typed into the address bar of the browser.

Congratulations! You’ve now successfully powered up, connected to, and communicated with your board! That was easy, wasn’t it? Let’s make a couple changes and use one of the user lights we discussed before to make it flash. About halfway down the page is a section titled “Cloud9 IDE” (IDE stands for integrated development environment). Click the header, and the Cloud9 IDE will launch in a new browser window or tab (see Figure 3.3). This is a powerful IDE running directly on the BeagleBone Black through a web interface.


FIGURE 3.3 The Cloud9 IDE running on the BeagleBone Black.

So, what is an IDE? In short, an IDE is used as an all-in-one place where you can write software directly on the BeagleBone Black. It includes an editor, a way to execute code, and many other useful features.

When a person is just starting out with a new programming language, there is a tradition that the first program they write simply displays “Hello, World!” in some manner that fits into the environment. In many languages, this is accomplished by simply printing the message, whereas in some Windows environments, an alert message is displayed. That tradition has been extended into the hardware world with a program that makes a light blink once a second.

In our case, we are approaching a board for the first time and trying out a language for the first time, so why don’t we try both displaying a message and blinking a light? Follow these steps to create a new file, write the code to accomplish our task, execute the code, and get blinking:

  1. In the main window of the Cloud9 environment you’ll find a + button. Click this button and select New File. This will open a blank text file where you can enter code. If there are other tabs open, you can close them. Feel free to peruse any “getting started” information on those pages.
  2. Enter the code shown in Listing 3.1 into the document.
  3. Save the file on the board. In this case, the file’s name is blink.js.
  4. In the environment, click the Run button.

LISTING 3.1 blink.js

1:  /*
2:   * blink.js - BoneScript File to blink the USR1 LED on the BeagleBone Black.
3:   *
4:   * Example script for "The BeagleBone Black Primer"
5:   *
6:   */
7:  var bbb = require('bonescript');  // Declare a bbb variable, board h/w object
8:  var state = bbb.LOW;               // Declare a variable to represent LED state
11: bbb.pinMode('USR1', bbb.OUTPUT);  // Set the USR1 LED control to output
12: setInterval(blink, 1000);          // Call blink fn the LED every 1 second
13: console.log('Hello, World!');      // Output the classic introduction
15: /*
16:  * Function - blink
17:  *
18:  * Toggle the value of the state variable between high and low when called.
19:  */
20: function blink() {
21:     if(state == bbb.LOW) {        // If the current state is LOW then...
22:         state = bbb.HIGH;         // ...change the state to HIGH
23:     } else {                       // Otherwise, the state is HIGH...
24:         state = bbb.LOW;          // ...change the state to LOW
25:     }
27:     bbb.digitalWrite('USR1', state); // Update the USR1 state
28: }

It will take a couple of seconds, but the code will start executing. You should see a light just next to the heartbeat light blinking on for a full second and then off for a second. Success!

Let’s step through the code you just blindly put into the environment and executed. Glad you trust me! The source starts with these six lines of code:

1:  /*
2:   * blink.js - BoneScript File to blink the USR1 LED on the BeagleBone Black.
3:   *
4:   * Example script for "The BeagleBone Black Primer"
5:   *
6:   */

These lines look fairly readable to a human and not like source code. That’s because this code is what’s called a comment. A comment starts with /* and ends with the */ and includes everything in between. The extra asterisks at the beginning of the other lines are just to make things look good. There is another way to signify comments in BoneScript/JavaScript, and that is using //. These are used to describe what is occurring on a line of code. Everything from the // to the end of the line is a comment. Comments are not executed or even seen for execution. You will see a couple of different styles of commenting in different languages throughout the book.

Line 7 accesses a shared library of source code, called bonescript, that is provided to you as part of the environment:

7:  var bbb = require('bonescript');  // Declare a bbb variable, board h/w object

This code accomplishes many tasks behind the scene that you don’t need to worry about for now. Access to the library is assigned to variable bbb. This means that we can use the variable bbb to access resources in that special library, as you will see on the following lines:

8:  var state = bbb.LOW;            // Declare a variable to represent LED state

Line 8 declares another variable called state. We are going to use state to track whether we set our signal for the USR1 light to HIGH or LOW. When the state is set to HIGH, the voltage on the electronics attached to that light is set to +5V, and it is set to 0V for LOW. When the voltage is set HIGH at +5V, the electrical potential on the light is increased, which means the light can do work. What happens when a light can do work? It lights up!

Something important to remember here is that setting the state variable to HIGH or LOW doesn’t actually change the power supplied. We do that using a function called digitalWrite, which is a part of the bonescript library we can now access through the bbb variable. More on that function later. Now we hit a line that does something with the electricity on the board:

11: bbb.pinMode('USR1', bbb.OUTPUT);  // Set the USR1 LED control to output

With this line, we are calling a function called pinMode, which is part of the bonescript library, and using another bonescript library constant called OUTPUT. This means we are configuring the USR1 pin to output the voltage rather than sensing a voltage from somewhere else in a circuit. In total, this line says, “Take the pin attached to the light USR1 and get it ready to output, please.”

The next line utilizes a function called setInterval to run the meat of the program:

12: setInterval(blink, 1000);         // Call blink fn the LED every 1 second

This line of code tells the system to execute the function blink once every second. Line 13 has nothing to do with blinking our light. This is a simple statement that prints our classic first-time program announcement out to a console:

13: console.log('Hello, World!');     // Output the classic introduction

In the Cloud9 IDE environment, you will see this printed on a lower tab labeled “/blink.js – Running,” as shown in Figure 3.4.


FIGURE 3.4 The “Hello, World!” statement written to the console log.

The final lines define a function called blink. This function simply checks the status of the state variable and changes it to the opposite state. This function is called once every second by the setInterval function. The real meat of the function is on line 27. The call to digitalWrite makes the actual change to the hardware to change the status of the physical circuit attached to the USR1 light:

27:     bbb.digitalWrite('USR1', state); // Update the USR1 state

That is all the code required to use BoneScript to blink a light and print a message to the console! It is important to remember that BoneScript is defined only by the bonescript library. The underlying syntax and structure is just JavaScript, a scripting language used in many places on the Web. This means that you can use JavaScript tutorial and reference resources to help you understand or to get any clarification.

For simple examples throughout the book, I will stick to BoneScript just to make it easy. For more complex code and functionality, I use other programming languages such as C/C++ and Python. I will comment the code to help with readability if you are not familiar with those languages; however, I highly encourage you to seek out other resources to learn those languages in depth because that is not the focus of this book. The next chapter will delve into some more complex development with BoneScript and the Cloud9 IDE to enable your own explorations. It will also introduce you to the basics of programming with other languages.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020