GETTING STARTED WITH BEAGLEBONE BLACK PDF

adminComment(0)

Read the step-by-step getting started tutorial below to begin developing with BeagleBone · BeagleBone Black · BeagleBone Black Wireless. tiebuckverpani.ml Please download the . You will get an output similar to the one shown belowname. Grant Root tiebuckverpani.ml BeagleBone Black has faster processor, more memory Getting Started with.


Getting Started With Beaglebone Black Pdf

Author:MILLY CHAUVAUX
Language:English, German, Japanese
Country:Lebanon
Genre:Personal Growth
Pages:528
Published (Last):19.08.2016
ISBN:770-3-23945-398-1
ePub File Size:26.48 MB
PDF File Size:17.23 MB
Distribution:Free* [*Sign up for free]
Downloads:41810
Uploaded by: SALOME

Getting. Started with. BeagleBone. Updated for the latest. BeagleBones running .. When Gerald Coley, the hardware designer of BeagleBone Black and all of. BeagleBone Black is his newest, strongest— and most affordable—tool for . For example: “Getting Started With BeagleBone by Matt Richardson (Maker Media). The Beagle Bone is a great step up from microcontrollers (such as AVR, PIC, Windows and its tougher to install the drives on Win than other OS's we'll start . and Ethernet works, wouldn't it be nice to get rid of that Ethernet cable? This tutorial may not work on beaglebone black or the latest versions of.

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.

Click Ok, then Ok. This button might come in handy if your system locks up. USB Host Port. This will let you attach a slew of hardware—including key- boards, mice, and Wi-Fi adapters—to your board. Onboard LEDs. Next to the power connector, you have an LED to indicate when power is applied to the board. There are also four LEDs next to the reset button that can be programmed by you with software. Expansion Headers.

These two expansion headers, labeled P8 and P9, allow you to integrate your BeagleBone into electronics projects. The major components of the BeagleBone Black 8. Mini USB Port. Your computer will not only pro- vide power to the board over USB, but it also acts as a means of com- municating with it.

You can also access BeagleBone reference informa- tion stored on-board; it will simply appear as a storage device when you plug it in to your computer. MicroSD Card Slot.

On a BeagleBone Black, the operating system is stored on the onboard flash memory see below and can be updated using the MicroSD card slot. Serial Header BeagleBone Black only. While both the original Beagle- Bone and the BeagleBone Black have serial outputs for accessing the terminal, only the BeagleBone Black breaks out one of the serial ports in its own header. In the technical manuals, this memory is referred to as the eMMC. Boot Switch BeagleBone Black only.

Holding down the boot switch when you power on your BeagleBone Black instructs the hardware to boot from the MicroSD card instead of the on-board flash memory. However, having all of these components handy will help you try out the projects in this book: By default, it uses Linux, which is free and open source. While there are many different flavors, or distributions of Linux out there, BeagleBoard.

There was a large software update in April The examples throughout this book will expect that you have at least this version.

Appen- dix A walks you through how to create an up-to-date MicroSD card. Connecting to Your BeagleBone As I mentioned before, there are a lot of ways to get things done with the BeagleBone and especially so when it comes to ways of connecting to its command line terminal.

Most of the time, I prefer having the BeagleBone connected to my home network router via Ethernet. When it comes to troubleshooting issues that cause an unstable network connection, I find connecting to the command line via serial over USB to be handy. Connecting via USB and Installing Drivers The BeagleBone itself is preloaded with documentation and drivers that will help you connect to it from your computer.

In your web browser, go to http: This page is being served by your BeagleBone and has a lot of information about the board, including some interactive examples of Bonescript, a JavaScript library written for the BeagleBone. Open your terminal and connect to the BeagleBone: Enter You can dismiss this message. If you have an original BeagleBone, be sure that the included MicroSD card is inserted into the slot. To avoid this, hold the BeagleBone by its length-side edges as you plug in the cables Figure Connect to it via SSH: The Basics and Getting Set Up 11 www.

You can also use the IP address of the board instead. The first time you connect, your SSH client may warn you that the host is unknown. To get to the terminal, click Applications, System Tools, then Terminal. Some operations, like creating, modifying and moving files around can also be done from the desktop environment if you prefer.

For more information on using the desktop environment, see Chapter 8.

Kurniawan A. BeagleBone Black Programming using Matlab (+source code)

The Basics and Getting Set Up 13 www. Open a terminal window and type: The screen will blank besides a blinking cursor. Hit enter to display the login screen Figure The serial log in screen 5. Log in with the user name root. Download and install PuTTY. Launch PuTTY.

For the Connection Type, choose Serial. Type in the name of the serial port for your connection.

On my system, it was COM7. Click OK. For Speed, type The rest of the defaults should be fine see Figure PuTTY settings for Windows computers 8. Press enter to be taken to the login screen. The Basics and Getting Set Up 15 www. Connect the USB side of a 3.

For now, however, your best bet is to get your BeagleBone on your Ethernet network. The Basics and Getting Set Up 17 www. It comes with a lot of power, customizability, and is heavily influenced by operating systems that date back to the early days of computing.

Besides the price free , the best part of using a Linux OS is the huge community of users, who have contributed their knowledge to the code itself and to help- ing other users.

While there are many different distributions, or flavors, of Linux, the people at BeagleBoard. At this prompt, you can enter commands to start programs, work with files such as create, delete, copy, and move them , compile your own programs, update system settings, and much more.

The user account root is considered the superuser, or administrator of the sys- tem. But with great power comes great responsibility: This is how other computers on your net- work refer to your BeagleBone. If you run a command to create a file without specifying another location, the file will be created in the working directory.

This is the prompt for input. Filesystem Just like in many other operating systems, the Linux filesystem is an organ- ized structure of files within folders, or directories. Within the root of the filesystem, there are a few main directories, most of which are listed in Table Table Directories in the root of the filesystem.

It tells you where you are in the filesystem. You can use the cd command: To be sure, we can always exe- cute pwd again: Getting Around with Linux 21 www. An example directory structure. Use ls to show the contents of your home directory: For more information, see Chapter 8. Creating Files and Directories Use the command mkdir to create a new directory: We use the greater than sign to redirect that output to the file hello.

Getting Around with Linux 23 www. If you want to append text to the end of a file, the command you type will look like this: To see the results, use cat again: What a beautiful day!

In other words, it will take a series of files and appends one after the other. To try that out, first make a few file: See you real soon! All these command line tools can make it fairly easy to work with files, but sometimes you might just want to get inside a file to view and edit its 24 Getting Started With BeagleBone www. For that, I recommend the text editor nano.

Getting Started

To open your file in nano, simply type nano followed by the file you want to open. To save, type Control-O and to exit, type Control-X. Nano can do a lot of stuff including searching, clipboard operations, and spell check. To view the help information within nano, type Control-G.

Of course, you can also create new files with nano. Just type the name of the file you want to create after the nano command and that file will be written when you save within nano. Copying, Moving, and Renaming Files Copying and moving files around from the command line is fairly straight- forward. Date and Time Most computers have a real time clock, a piece of hardware that keeps track of the date and time.

Unfortu- nately, the BeagleBone does not have a real time clock. This means that when you boot up the BeagleBone, it will have no idea what the date and time are.

Getting Started

To prove it, try the date command: The time just needs to be set every time it boots up. First, backup the old localtime file by renaming it localtime. A symbolic link is like a forwarding notice for a file. You can place one in a directory and most software that wants to read or write the file will be redirected to the file in another location.

The shell prompt in the following example is truncated slightly to fit on the screen without wrapping the text. Edit the ntpdate configuration file with nano: Feel free to pick your own NTP server if you wish. Save the file by typing Control-O and exit nano with Control-X.

Now run the ntpdate-sync command to have the BeagleBone fetch the latest time. After a few moments, try executing the date command again: The BeagleBone is also pre-configured by default to synchronize with the NTP server once an hour, so you may have a period of time after booting when the time is incorrect. You can always run ntpdate-sync to force it to synchronize immediately.

See Appendix B for how to set up ntpdate-sync to happen automatically on start up. Software Installation, Updates If your BeagleBone has a connection to the Internet, you can easily install or upgrade software and code libraries. The software comes in packages and Getting Around with Linux 27 www.

To update the list of available packages, simply execute: If you want to update the software, the opkg command upgrade will upgrade all of your installed packages if there are new versions available. To install the version control system git, for instance, you would run: For instance if you only wanted to upgrade Python, you could run: To edit the hostname, execute the following, keeping in mind that the host- name can only contain letters, numbers, or a hyphen.

After you save the file and quit nano, you need to reboot your BeagleBone. After you log in again, you should see your custom hostname in the prompt. To set or change the password, use the command passwd: To shut down the BeagleBone properly, issue the following command: The board will turn back on when you reconnect it to power. If you just want to reboot the board, use the reboot command. Each header has 46 pins and if you look closely you can see that pins 1, 2, 45, and 46 are labeled on each header Figure Header P8 Figure Most pins can even be switched between modes to accommodate dif- ferent possible functions.

GPIO pins have two states: We say such a pin is floating. Other platforms, like the Arduino, may use 5 volts. Use only 3.

Otherwise you can permanently damage the board. Once you get to know how the Linux kernel uses a virtual filesystem to read and write pins, it makes programming the BeagleBone much easier. As long as you can read and write files, you can work with GPIO. First Steps with Digital Electronics 33 www.

Be very careful not to accidentally connect the rail to the 5 volt source on pins 5 and 6. The GPIO pins can only han- dle 3. Place an LED in the breadboard so that the cathode side the shorter wire is connected to the negative rail and the anode side is in one of the rows of the breadboard.

Using a ohm resistor, connect the anode side of the LED to another row on the breadboard. Connect the other side of the ohm resistor to pin 12 on header P8. On a ohm resistor, the color bands printed on it will be brown, black, brown, and then gold or silver.

Your circuit should look like Figure Even if you look at BeagleBoard. Many of the pins default to other modes. First Steps with Digital Electronics 35 www. On the command line, change to the gpio directory: Start typing the first few letters of the directory or file and then hit tab key. If the system has a single file or directory that matches that, it will fill in the rest of the name for you. To do that, use the echo command to write the number 44 to the export file: For example, if you attach a BeagleBone expansion board, or cape, it may request access to a few of these pins for itself.

Change to that directory: Write 1 to the value file: We can then set the pin low and turn off the LED by writing a 0 to the value file: Feel free to experiment with the other pins in Figure Input If you can control an output pin by writing to the value file, it stands to reason that you can read an input pin by reading the value file. By doing this, you can check the state of physical buttons and switches. Place a push button into the breadboard so that it straddles the center channel.

Connect one lead of the button to the positive rail. Connect the other lead of the button to the input pin 11 on header P8. See Figure of BeagleBone wired up. Connect a 10K pulldown resistor from the ground rail to the button lead that connects to the input pin.

That is to say, connected to either 3. The 10K pull- down resistor in the step above ensures that when the button is not pressed and the connection between 3. Using a resistor ensures that when the switch is closed, the 3. Instead, it goes to the input pin. First, export the pin to the user- space and change to its directory. Set the pin direction as an input: This should return 0 for low.

This means that the pin is connected to ground. Now press and hold the button while you execute the cat value command again. If you have the button wired up correctly, you should now see a 1, indicating the pin is high connected to 3.

An easy way to execute a command again is to hit the up arrow key on your keyboard and then hit enter. You can keep hitting up to scroll back through your history of com- mands.

Just hit enter when you get to the command you want. It may seem trivial, but these examples represent the very basic foundation of digital electronics with the BeagleBone. With the right circui- try, these could easily become tilt sensors, blenders, door security sensors, buzzers, motors, and much more.

And since the BeagleBone is already network-enabled, it lets you change the settings of your outlet timer from the comfort of our computer, or even from the other side of the globe. This project will also demonstrate the basics of using shell scripting as one method to programmatically execute commands. Using another strand of hookup wire, connect pin 2 from the Power- Switch Tail to one of the ground pins on the BeagleBone.

Be sure the lamp is switched on. The PowerSwitch Tail is a high voltage relay circuit that has been packaged up for easy use. It lets you use the 3. First Steps with Digital Electronics 41 www. Execute the following commands to actuate the relay and turn the lamp on. Make sure you run the unexport commands shown there before you try this example.

Now unexport the pin. While shell scripts have the potential to be powerful and complex, they can also be very basic and as easy to write as entering the commands onto the command line. This will launch the nano text editor. Type in the following code: Use nano to create another file called lightOff. To make both of those scripts executable, execute the following com- mands: Now when you type.

When you type. You will need to be in the home directory to do this. Add the following lines to the end of the file: The cron scheduler will allow you to execute com- mands as frequently as once a minute or you can even set a command to execute many years in the future. Each crontab entry is on its own line with 5 space-delimited settings sometimes 6, in the case of specifying years followed by another space and then the command that should be executed as you can see in Table See Table for what the entry would look like.

If you want to adjust the timing of the lamp, all you have to do is log into your BeagleBone and edit your crontab. First Steps with Digital Electronics 45 www.

The downside to the flexibility that the BeagleBone affords is that there are many different ways to do the same thing. This chapter will walk you through one way to use code to interact with the pins on the board. However, on an embedded Linux system like the BeagleBone, the compiler or interpreter exists on the board itself. This chapter will show you how to use the Python interpreter on the Beagle- Bone to program the pins to behave the way you want. The code is relatively easy to understand and there are many libraries that help with complex tasks.

However, this would take a long time. Luckily for us, the fine engineers at Adafruit have created an open source Python library for accessing the pins. I especially like this library because it follows a lot of the same conventions as the popular RPi. From the command line, update the package listing. Python 2. Using Python, you can create an infinite loop to turn the LED on and off until you terminate your script.

We are all makers

See Figure Python Pin Control 49 www. This will allow you to easily down- load files to your computer, edit them, and upload them back to the Beagle- Bone. My favorite FTP client, Transmit, even lets me edit the files in a text editor and automatically uploads them to the board whenever I hit save.

See Chapter 8.

Step 1: What Is BeagleBone Black?

Use the code from Example for the contents of your file. Source code for blink. OUT while True: HIGH time. LOW time. Unlike many other languages, the indentation you use for each line of code is important to get right. You can uses spaces or tabs, just as long as you keep it consistent throughout your code. If not, check the errors that are displayed and check your code against the code above.

Python evaluates the code one line at a time, starting at the top of the script.

When it gets to the line that says while True: The while statement can be used to test for conditions as well. Any time the condition evaluates as true, it runs the code beneath it again, which is why while True: This line tells the system the location of the Python interpreter to process your code.

From the command line, use the following command to do that: When executing files, you need to be explicit about their location unless you move the script to a directory that is included in your path.

Read on for more on that. To view directories that are in your path, run the following command sample output is shown: However, the actual directory may not already exist.

Put the code from Example in it. Example Source code for button.

IN while True: Python Pin Control 53 www. Print a message to the terminal. Try it out before we dig into the details of the code: Why is that? For one, you can hold up the Python script until the button is released, like in the code in Example Power-down your board, remove the SD card and apply power again to finish.

Start your Beagle If any step fails, it is recommended to update to the latest software image to use the instructions above.

Power and boot Most Beagles include a USB cable, providing a convenient way to provide both power to your Beagle and connectivity to your computer.

If you provide your own, ensure it is of good quality. Note that BeagleBoard-X15 must always be powered instead by a 12V adapter with a barrel jack. If your Beagle was provided with an SD microSD card , make sure it is inserted ahead of providing power. Most Beagles include programmed on-board flash and therefore do not require an SD card to be inserted. Within a minute or so, you should see the other LEDs blinking in their default configurations.Source code for pwm.

Define a function called loop.

The latest Debian flasher images automatically power down the board upon completion. Hi Jordi, I have done that here under the Errata section e. To avoid this, hold the BeagleBone by its length-side edges as you plug in the cables Figure In addition, the chapter lists accessories that can be very helpful in developing your own Beagle-based projects.

As you start to create your own projects with BeagleBone, a good foundation in Linux will be incredibly helpful.