Beaglebone Black aka BBB is a low cost open source development board mainly used by developers and lobbyists. Although it’s quite similar to a Raspberry Pi yet it comes with some additional features. Developed by a non-profit corporation beagleboard.org, this credit card sized board also supports embedded Linux platform. Due to the presence of so many advanced peripherals, it is also considered to be a minicomputer.BBB consists of core architecture of ARM family and houses AM35X ARM cortex A8 (1GHz) processor. It can be powered either through a micro USB port or an external 5V supply that is present as an optional arrangement.
Linux kernel supports modular approach. It supports insertion and removal of code from itself at a routine. Module is loadable kernel object which we can load and unload during run time. Module is single binary image which contains the information of related subroutine, group, data, entry and exit. Device driver is also one type of module which provides the facilities to reload, debugging, and loading new driver on demand in response to hot plugging of new device. It is allowed to access hardware connected to the system. We can build monolithic kernel using module kernel and new functionality in kernel image. Let’s understand how module would be created and work in Linux. Module is like a simple file and we can save it as C file with .c extension but it is somewhat different. It does not need to write code inside main function.
Semaphore is a basic synchronization mechanism and it works as a simple counter which increments on resource allocation and decrements on resource de-allocation. You can refer to the tutorial Semaphore before learning this tutorial. I will explain how to create counting semaphore in Linux. Counting semaphore is non-negative counter. Semaphore count initializes with a number of free resources. Counter value is incremented when resources are added and decremented when resources are released. In C language, semaphore parameter and functions are defined in <semaphore.h> header file. Various operations on semaphore are performed by different functions which are defined in semaphore header file. You can initialize semaphore, lock and unlock, release the semaphore etc.
A semaphore is a synchronization mechanism that controls access by multiple processes to a common resource in parallel programming environment. It is widely used to control access to file and shared memory. In computer system it is a variable whose value indicates the status of common resource. Its purpose is to lock resource being used. They are counter used to provide control access to the shared data structure for multiple processes. Operation allocated with semaphore is tested, set and waited. Test and set process is concerned, uninterruptable and can’t be stopped once started. The result of test and wait process is the current value of the semaphore.
In previous tutorial, I explained about communication between server-client through socket programming. We can also establish server-client communication using UDP/IP. In this tutorial I will explain how communication occurs between server-client through UDP/IP. Before explanation, let’s see some basic view of terminology. Three main things are needed to establish connection between server-client models:1) Transport protocol (TCP or UDP)2) Socket3) IP address and port UDP is a connection-less protocol which stands for user datagram protocol. It is an unreliable protocol but with IP it provides the best communication mechanism
TCP is connection oriented protocol which stands for transfer control protocol. It is a reliable and secured protocol. In TCP, receiver can generate the acknowledgement of received packet so sender (client) does need to wait for acknowledgement and if back response doesn’t come or any packet error is generated, it will resend to the client.Socket is end point connection for communication between two machines. It is like data connectivity path between two wireless terminals. Socket is required at both sides of server and client. You can refer to the tutorial socket and How to create socket in Linux.IP address is a unique numerical address of each computer and device. It plays an important role in networking domain with Internet protocol.
This tutorial will explain about how to create socket programming in C language. Socket is virtual end point communication over the network between two hosts or processes. Refer to the tutorial Socket in Linux before learning this tutorial. You always open the Google page in your web browser but do you know how our web browser accesses the Google page form www.google.com? When you type www.google.com in your web browser, it will open the socket and send the request to server (www.google.com). Server always listens to the request from different hosts. When server receives and accepts the request it sends response back to the host (i.e. Local PC). After establishment of connection, server will send the Google page to our web browser.This tutorial assumes you know about socket in Linux and are aware with C programming language. Linux has standard C library of socket in package named <sys/socket.h> header file. Socket creates file descriptor using the socket ( ) system call.
I explained an Interprocess communication (i.e. Pipe, named pipe) between two applications or process in system. You might be wondering if two applications available in different machines over the network (i.e. local PC or server), pipe or named pipe are communicated or not? Pipe or named pipe can communicate only those processes which are located in the same system. We can communicate with application which is located in different systems through new communication method named Socket.
It is similar to a pipe but created in different ways. Here mkfifo ( ) function creates the file in file system. mkfifo ( ) makes a file named pathname. Pathname is the location of FIFO file where it is created. Once you create the file, you can read or write it as defined in mode user permission what user wants to do with FIFO file.The system call mknod ( ) creates file system node as specified pathname with attribute described in mode and dev. Once you have created the file, you can read or write as defined in mode.which seeks user permission as to what user wants to do with FIFO file. dev define the types of file system node (i.e. file, device file, socket, named pipe). The file type must be one of S_IFREG, S_IFCHR, S_IFBLK, S_IFIFO, or S_IFSOCK to specify a regular file, character file, device block file, named pipe and socket respectively.
I already explained about pipe in tutorial Pipe in Linux. FIFO or unnamed pipe is same as pipe or named pipe expect for one thing. Pipe is a one way communication between process which is related to each other like parent and child processes. Related processes have same file descriptor, so they communicate easily through single pipe but unrelated processes have different file descriptors, so they cannot communicate through single pipe. You can communicate only through creating multiple pipes each for one communication. Communication between multiple processes is not sufficient and hence FIFO or named pipe overcomes this limitation.FIFO (First In First Out) is first out file which is like normal file but doesn’t save the content of file, it should pass data, write or read by first in and first out process. When one process is read or written using FIFO, another process waits to access FIFO. So FIFO can also be used for one-way communication between multiple and unrelated processes instead of single and related process.
This tutorial explains how to interface LM35 Temperature sensor with Beaglebone black to work with sensor interfacing. LM35 is an analog sensor which measures the temperature and linear output given in voltage form. I have interfaced temperature sensor LM35 with 12 bit ADC of BBB where output of LM35 is in analog form and output of ADC is in digital value and later is converted in Celsius and Fahrenheit by formula. LM35 is with 3 terminals- Vcc terminal is connected with 3.3 V supply, Ground is connected with ADC ground of BBB (pin number 34th of header P9) and Output terminal is connected to the input of AIN1 (pin number 40th of header P9). Now you can open the command terminal and take an access of Beaglebone black through SSH as explained in getting started with Beaglebone black.
When you execute python script from SSH command prompt, you need to make BBB connection with PC because you are accessing the BBB through SSH connection. If you wish to run Python Script on BeagleBone Black Boot without connecting it with PC, an external power is needed to be supplied. You can run python script when you power up BBB without any command prompt or command by Crontab. Crontab is a task management tool which is built-in into Debian and then we can add the new Cron Job at which a Python script will run at boot. When script is running, both the LEDs are switched ON and OFF for one second.
How to capture images and video on the beaglebone – I do this using Open Source Computer Vision (OpenCV) image processing. OpenCV image processing captures image and video data on the BBB (Beaglebone Black) with the help of USB webcams by using python script programming. It is simple tutorial where you can also add effects in the form of black and white image, motion detection, sharp picture etc. I have used opencv library which programs functions of real time computer and machine learning. In this project required tools are Webcam and Beaglebone Black.
This tutorial explains how to connect Beaglebone with WI-FI adapter for internet connectivity. Before proceeding, we need some basic configuration as well as an internet connection. First connect the internet through Ethernet. Complete step-by-step guide to get WiFi running for your BeagleBone Black to manually configure the adapter to automatically connect with your network. Before you get started make sure that you are running the latest official Debian image on BeagleBone Black. Here, I have used EDMAX which works with almost any kind of WI FI adapter.
This tutorial explains about the fundamental use of PWM where servo motor is controlled by potentiometer. It is a DC motor which operates on electrical pulse. You can directly interface servo motor with Beaglebone black without any driver IC. For this you have to write a program in python script with adafruit PWM and ADC library.It is a simple learning tutorial in which I have interfaced servo motor and potentiometer with Beaglebone black. When script is being executed, it enters into a continuous loop.
Web cam is needed for image capturing and video streaming applications. You can interface web cam with Beaglebone Black and capture the picture and video as well. In this tutorial I will interface Logitech web camera with BBB. I have explained step by step setup of web cam interfacing with BBB. Before connecting web cam, I will explain about VNC remote connection of Beaglebone Black. If you get SSH access of BBB, it will not display image or video due to insufficient GUI. So you need to take virtual remote access of BBB on desktop.
This tutorial explains how to send mail from Beaglebone black using SMTP protocol. SMTP stands for Simple Mail transfer protocol. The main objective of this tutorial is to obtain mail notification upon certain activity. BBB will send the mail with predefined message to registered email id when some activity takes place.In this tutorial, simple alert notification is sent to specific mail ID. Before running application, you need to establish internet connection with Beaglebone black. You can choose either Ethernet connection or WI-FI device.
This tutorial explains how to work with magnetometer and Beaglebone black. Magnetometer senses the low magnetic field and works as a digital compass. It is used in tracking or navigation application. In this tutorial, HMC5883L magnetometer has been used and interfaced with Beaglebone black through I2C protocol. Program is written in python script with adafruit I2C library.HMC5883L is 3-axis low magnetic sensing and digital compass device. It is supported by I2C interface. It generates sensitive magnetic value during simple measurement. Value and degree of angle are displayed on SSH prompt every one second.
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.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.
Beaglebone – switch interfacingThis tutorial explains how to interface switch with Beaglebone black where switch acts as an input device. It is a simple learning tutorial regarding the use of GPIO pin as an input. Program is written in python script with adafruit GPIO library. It is a not a big deal but it’s necessary to clear fundamental before developing high application. It is a simple learning tutorial of Beaglebone black. Here I connected led and switch with GPIO pin of Beaglebone black. When script is being executed, it enters the end of continuous loop.