Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

Sending Data from Beaglebone Black to Arduino Through UART (Part 7/15)

By Ashish Vara August 5, 2016

This tutorial represents communication between Beaglebone black and Arduino through UART.  You don’t need any another peripheral for this tutorial. UART stands for universal asynchronous receiver and transmitter.  It transmits and receives data asynchronously with another device which also supports UART protocol.

Required Tools:

  • Beaglebone Black
  • Arduino
  • Female to Female connectors

Setup of Software environment

Install the latest python version in BBB as explained in tutorial How to make first python program with Beaglebone Black. Install the adafruit python-GPIO library.

Working

Beaglebone transmits the message which is entered from command prompt and Arduino receives the data and displays it on Arduino serial terminal. Run the python script from SSH terminal and at the same time open Arduino serial in PC. Write some message from SSH terminal. BBB transfers the data through UART which is then received by Arduino and displayed on serial terminal.

Description

BBB has on chip five UART ports each containing two pins: RX pin and TX pin  to receive and transmit respectively. In this tutorial, UART1 is used for communication with Arduino. Here, BBB acts as transmitter and Arduino as receiver. Connect the UART1 transmitting pin (24th pin of header P9) of BBB to receiving pin (pin number 10th) of Arduino.  I have used software UART in Arduino that’s why I have connected it with pin number 10th (I declared 10th and 11th pin as RX and TX in program respectively). Make the common ground connection between Arduino and BBB  which is necessary for communication.

Open the command terminal and  access Beaglebone black through SSH as explained in getting started with Beaglebone black. Create a new file using touch command with .py extension (i.e. led.py). Open the file with any text editor (i.e. nano, vim etc.) and write a code in python language.

Connect Arduino with PC through USB cable. Open  it and then write a code for receiving data in C language. For help, you may  refer to the tutorial how to Install and run Arduino in Linux.

UART setup in BBB

You need to import UART in program to make use of I2C device. You can create your own library but that would consume more time. Hence Ad fruit library can be used that provides all kind of python library of BBB.

import Adafruit_BBIO.UART as UART

Also import the serial from python library. It encapsulates access  to serial port.

import serial

Configure UART by following function:

UART.setup(“UART1”)

serial.Serial (port = “/dev/ttyO1”, baudrate=9600)

First function is setup and configuration of UART1. Second function accesses the serial device with defined baud rate. Find the device port attached with UART from  the list below and access it.

Magnetometer interfacing with Beaglebone black

Now, you can transmit and receive data through UART. You can close the port when you don’t want to use it.

Arduino Setup

Write a receiving source code in Arduino and load it  onto Arduino Uno.  After the data is received, it will be displayed on the serial terminal.

Run the script from terminal:

Enter the following command with file name from command prompt:

            python filename.py

i.e. python uart.py

You may also like:


  • LED blinking in Beaglebone Black (Part 3/15)

  • Switch Interfacing with Beaglebone Black ( Part 4/15)

  • DC Motor Interfacing with Beaglebone Black (Part 5/15)

  • Servo Motor Controlling with Beaglebone Black (Part 6/15)

  • Getting started with Beaglebone Black (Part 1/15)

  • LED blinking In Beaglebone Black

Project Source Code

 

Project Source Code

###

// UART.C

#include

 
SoftwareSerial uart(10,11);
 
 
void setup()
{
  Serial.begin(9600);
  uart.begin(9600);
  
}
 
void loop()
{
 
  if(uart.available() > 0)
  {
    Serial.write(uart.read());
  }
 
}
 
//
 
import Adafruit_BBIO.UART as UART
 
import serial
 
UART.setup("UART1")
 
disp = serial.Serial (port = "/dev/ttyO1", baudrate=9600)
 
disp.close()
disp.open()
 
while True:
        if disp.isOpen():
 
                print "Serial is Openn"
                message = raw_input("Enter your message:n")
 
                disp.write(message)
                disp.write("n")
 
                exit = raw_input("You want to exit or not YN:")
 
                while ((exit != 'Y') and (exit != 'N') and (exit != 'y') and (exit != 'n')):
 
                        print "Invalid Input!!!n"
 
                        exit = raw_input("You want to exit or not YN:")
 
 
                if (exit == 'Y') or (exit == 'y'):
                        break
 
                else:
                        print "To be continue....n"
 
 
print "Sorry!!! You not able to do communicate with device"
disp.close()

###

 


Circuit Diagrams

data-from-beaglebone-arduino-using-UART

Project Video


Filed Under: BeagleBone, Electronic Projects

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Reducing "shoot-through" in offline Full Bridge SMPS?
  • How to simulate power electronics converter in PSpice?
  • High Side current sensing
  • Voltage mode pushpull is a nonsense SMPS?
  • Layout IRN reduction in Comparator

RSS Electro-Tech-Online.com Discussions

  • Back to the old BASIC days
  • Parts required for a personal project
  • PIC KIT 3 not able to program dsPIC
  • Failure of polypropylene motor-run capacitors
  • Siemens large industrial PLC parts

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe