Microcontroller Tutorials

Arduino, Raspberry Pi, PIC, Beaglebone Resources

Beaglebone Black Serial Connection to Arduino

One way to connect a microcontroller to another microcontroller is through the serial port. Here I will show you how to use the Beaglebone Black serial port to connect to the Arduino UNO.

Preliminaries

Beaglebone Black Serial Device Tree Overlay

In order to use the Beaglebone Black's serial port, you need the device tree overlays BB-UART1 and BB-UART2 for the serial port 1 and 2 respectively. I'll be using the BB-UART1-00A0.dts:

The overlay above specifies P9_24 and P9_26 as the transmit and receive pins for the serial port. Open nano and paste the overlay above and save it as BB-UART1-00A0.dts.

Creating Device Tree Binary Object

Next you need to compile it to create the binary object .dtbo. Here's how to do that:

The compiled .dtbo file must be on /lib/firmware so move it there:

You are now ready to move the overlay to the cape manager:

If everything is successful so far, you should see this:

When you try doing:

Note: Other things may be present on your cape manager slots.

Installing Minicom

Alright, the next thing we need is an app that will allow us to communicate with the serial port. Minicom is that app. Connect your BBB to the internet and download the minicom app:

Once minicom is installed, fire it up using:

-b is the command line option for specifying the baud rate which is why it is followed by 9,600 here. -D specifies the device which is in this case, tty01. For more command line options, just type

This is what it would look like in minicom starts:

If the one I encircled showed offline instead even after you start typing, there must be something wrong with your serial port settings.

Anything you will type here will now be sent to the serial port 1 (tty01). You can turn on local echo so that you can see what you are typing on the minicom terminal. To do that, just hit CTRL A then E.

Wiring Diagrams

Connect the BBB to the Arduino UNO just like this:

Beaglebone Black Serial to Arduino 1

This wiring connection will use the Arduino as some sort of TTL to RS-232 converter so that we can see what we type on the minicom on the Arduino IDE's serial monitor.

Here's what my screen looks like:

Everything I type on the minicom screen also appears on the Arduino IDE's serial monitor. I can also send strings from the serial monitor to the minicom terminal.

To exit minicom, hit CTRL A again then X.

The next thing we'll do is issue a command from the BBB to the Arduino via serial. We'll need to rewire the connection to this:

Beaglebone Black Serial to Arduino 2

Moving the serial connection will allow me to still use the serial monitor while the BBB and Arduino are communicating.

Coding the Arduino

Here's the Arduino sketch:

What the sketch does is wait for either a "1" or a "0" from the BBB. If a "1" is received, the on-board LED lits up. If a "0" is received, the on-board LED turns off. You can open the serial monitor and look at the Arduino's response everytime a character is sent from the BBB.

TL, DR:

  • First, create and compile the UART device tree overlay for the Beaglebone Black
  • Second, move the compiled device tree overlay to the cape manager
  • Third, install minicom
  • Fourth, connect the Arduino to the Beaglebone Black
  • Fifth, code the Arduino
  • Finally, fire up minicom

If you have any questions or any project idea on Arduino and Beaglebone Black serial communication, drop a comment below!

One thought on “Beaglebone Black Serial Connection to Arduino

  1. I want to connect 4 nodemcu to beaglebone black via uart protocol at the same time , I don't know if that will work or not. I want beaglebone to work as a master computer who make the decisions depends on the data sent from sensors that connect to nodemcus.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.