Design of Embedded Linux Based Voice Calling Device

11 downloads 0 Views 671KB Size Report
Voice Calling Device” is designed using Raspberry Pi .... First, download the Yocto project source tree with command: .... PYTHON BASED NUMBER DIALER.
International Journal of Applied Engineering Research ISSN 0973-4562 Volume 10, Number 15 (2015) pp 35095-35102 © Research India Publications. http://www.ripublication.com

Design of Embedded Linux Based Voice Calling Device Mahendra Swain Student Department of Electronics & Communication Engineering Lovely Professional University Jalandhar, Punjab, India [email protected]

Abhishek Kumar Srivastava Assistant Professor Department of Electronics & Communication Engineering Lovely Professional University Jalandhar, Punjab, India [email protected]

Abstract—The prototype of “Embedded Linux based Voice Calling Device” is designed using Raspberry Pi (Model B), PiTFT (2.8” resistive), GSM Modem (SIM 900A) and python based programming for voice calling purpose. At the core of this prototype, Embedded Linux kernel image have been implemented, which is developed and customized using Yocto Project which is used to achieve reduced memory footprint (both at kernel and package level) and to add selective features as per need. Bitbake (command line interface) and hob (GUI based inteface) are two available ways to customize Linux packages in Yocto project to build optimum sized Image with preferred features. This prototype was successfully tested for voice transmission using ssh. Keywords— Bitbake, Hob, Kernel, Packages, Python, Yocto Introduction Today, Linux is the choice for every Operating System (OS) compatible embedded platform. The Linux has been chosen for its well known advantages like open source, platform independent, much secure environment, and development oriented. The Raspberry Pi board used in this prototype is significantly cost effective in comparison to other available Linux operated boards with optimum specs and a have better community support. Popularity of Raspberry Pi can be estimated that till date 5 million Raspberry Pi boards have been sold as per survey done in Jan 2015.The software platform used to design this prototype is Ubuntu 14.04 (host) and programming language used is Python 2.7. The use of Python programming language makes it more user friendly for voice communication, GUI development and easy to understand. Yocto project have been used to provide Embedded LINUX platform to the prototype such that the configurability at both kernel level and package level could be maintained without compromising the necessary performance. Operating system (OS) footprint and execution time for a “sample program” have been tested across available Embedded Operating system such as Raspbian OS, PiLFS and Yocto based Embedded Linux and results produced are promising for Yocto based Embedded Linux Operating Systems. This Embedded Linux based device gives the prototype to attain flexibility of having minimum memory footprint and optimum speed and multitasking behavior on same platform which makes voice calling possible along with possible inclusions of games or music or web browsing features etc. Successfully voice transmission has

been verified using custom Linux over Raspberry Pi via GSM modem using terminal (without using Pi TFT display).

I. EMBEDDED HARDWARE REQUIREMENTS The hardware requirements to design this prototype are Raspberry Pi (Model B), piTFT 2.8”resistive, GSM modem SIM 900A, micro SD-Card (8 GB) of Class 6 is more preferable with SD-Card Reader, micro USB adapter for power supply to Raspberry Pi, and mini metal speaker and metal microphone for audio interface. A. Raspberry Pi (Model B) The Raspberry Pi is the product from the foundation of Raspberry Pi. It is based on Broadcom BCM2835 system on a chip (SoC), which includes an ARM1176JZF-S 700 MHz processor, VideoCore IV GPU which was originally designed for set-top box and having many more applications in different field. It is a cost effective and multi purposed device. It operates on 700 MHz frequency, with 512 MB of RAM (in Model B). Raspberrypi Model B supports two USB ports, Ethernet port, Audio jack 3.5 mm and SD card slot for installation with any supported OS. It also supports Ethernet and HDMI ports. The 26 GPIO (general purpose input output) provides various functionalities such as SPI, I²C, and serial UART along with 3V3 and 5V power. The pins use a 3V3 logic level is not able to tolerate logic levels of 5V. In comparison to Raspberry Pi, other boards with almost similar capability which are available in market include Beagle Bone, Beagle Board, Panda Board, Odroid Board and many more. The Raspberry Pi has been chosen for this prototype since it encourages the purpose of learning, innovation and experimental studies with vibrant community support and introduces relatively cheaper development cost. For this prototype, Raspberry pi serves our purpose well as of providing Linux based platform where the features like GUI for user friendly approach, Python based games, web browser, music player, and many more could be added as per need, to the final Embedded Linux image.

35095

International Journal of Applied Engineering Research ISSN 0973-4562 Volume 10, Number 15 (2015) pp 35095-35102 © Research India Publications. http://www.ripublication.com

Figure 3. GSM Modem SIM 900A Figure 1. Raspberry Pi Model B B. Pi TFT 2.8” (320x240) The PiTFT 2.8" resistive display comes with 320x240 16-bit color pixels and a resistive touch sensitive. It uses the high speed SPI pins (SCK, MOSI, MISO, CE0, CE1) as well as GPIO #25 and #24 to connect with Raspberry. Thus, this mini display can be used as a console for Raspberrypi. Before using PiTFT for our application the display driver has to be installed to be installed in Linux Kernel and calibration has to be done for better touch response. [11]

D. Power USB Adapter In order to power up the Raspberry Pi board 5 volt and 2 Amp current is required that can be provided through mini-USB power adapter. It is always preferred to take good quality USB power adapter for Raspberry Pi else it would not deliver sufficient current to various components and this may lead to malfunction /no function of some peripherals on board. E. Audio Interface with GSM Modem The mini metal micro-phone interfaced with GSM for audio Input and mini speaker has been used for audio output for the device. The Mini Speaker of low resistance is preferred for audio interface with GSM Modem. II. EMBEDDED SOFTWARES REQUIREMENT

Figure 2. PiTFT 2.8” (320x240) for Raspberry Pi As per system requirement, the display format can be changed from landscape to portrait by changing the angle of rotation to 90 degrees. C. GSM SIM 900 A This GSM Modem SIM 900A can accept any GSM network operator through regular SIM card and provides flexibility to make and receive call and messages with its unique phone number. The SIM900 is a complete Quad-band GSM/GPRS modem particularly used in embedded devices. The SIM900 delivers GSM/GPRS 850/900/1800/1900MHz performance for voice call and SMS applications [9]. It can communicate with controllers via standard AT commands

A. Raspbian Operating System Raspbian OS is a Debian based OS, developed for Raspberry pi. It contains all the packages required for the Raspberry pi basic operations. Raspbian is basically designed to provide the Desktop environment to Raspberrypi. The initial build of Raspbian contains over 35000 packages, which are optimized for best performance on the Raspberry Pi board, was completed in June 2012 [10]. However, Raspbian is still under active development with an emphasis on improving the stability and performance of as many Debian packages as possible. Raspbian is a community funded and supports free software effort [10]. Packages can be customized in Raspbian OS as per our requirement by removing unwanted packages from the build image, which is further explained under methodology. Debian supports two ARM architectures. The armhf (Acorn RISC Machine Hardware Float) and armel (Acorn RISC Machine Emulation Library) are two different architecture supported by ARM family. Armel architecture supports popular ARMv4 instruction set and it handles floating-point computation in compatibility mode with processors without floating point units which makes it a slow performer in comparison to armhf architecture. In contrast, armhf architecture supports modern ARMv7 instruction set and

35096

International Journal of Applied Engineering Research ISSN 0973-4562 Volume 10, Number 15 (2015) pp 35095-35102 © Research India Publications. http://www.ripublication.com provides direct hardware floating-point support but lacks the compatibility with older architectures. B. Yocto Project Yocto project has been used in this paper for building of custom Embedded Linux OS for Raspberry pi. The Yocto Project is an open source collaboration project that provides templates, tools and methods to help you create custom Linuxbased systems for embedded products regardless of the hardware architecture. It was founded in 2010 as collaboration among many hardware manufacturers, open-source OS vendors, and electronics companies to bring some order to the chaos of embedded Linux development. [7]

III. CUSTOM LINUX KERNEL FOR THE PROTOTYPE The Linux Kernel preferred for this prototype has been developed using Yocto Project. A. Customization Approach for YOCTO (NEW_IMAGE) This approach uses the Yocto Project for the development of Linux Kernel for Raspberry Pi, due to its compact and systematic development process. The following flow chart gives a brief idea about creating custom Linux Kernel image with suitable packages for Raspberry Pi. Start

As an open source project, the Yocto Project operates with a hierarchical governance structure based on meritocracy and managed by its chief architect, Richard Purdie, a Linux Foundation fellow. This enables the project to remain independent of any one of its member organizations, who participate in various ways and provide resources to the project.

Download Yocto project for Raspberry Pi

Package selection for custom Linux OS (bitbake)

Yocto Project supported armel architecture till Linux kernel version 3.12, from which they have recently switched to armhf architecture. Yocto project support ranges from complete embedded Linux development environment with tools, metadata, forums and documentation. The free tools are easy to get started, powerful to work with (including emulation environments, debuggers, an Application Toolkit Generator, etc.) and they allow projects to be carried forward over time without causing to lose any optimizations and investments made during the project’s prototype phase. The Yocto Project provides resources and information catering to both new and experienced users, and includes core system component recipes provided by the OpenEmbedded project. The Yocto Project also provides pointers to example code built, demonstrating its capabilities. These community-tested images include the Yocto Project kernel and cover several build profiles across multiple architectures including ARM, PPC, MIPS, x86, and x86-64. Specific platform support takes the form of Board Support Package (BSP) layers for which a standard format has been developed. The project can be developed from command line using “bibake” or it also provides an Eclipse IDE plug-in and a graphical user interface to the build system called “Hob”. C. Python Python 2.7 high level language has been chosen for programming of the proposed prototype. Python is a high level and powerful tool used to design GUI as well as compile complex program or scripts. Python package has been included in the Custom Embedded Linux image such that it makes using application development using python much easy. Python is an easy to learn, powerful programming language due to its efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms [12].

Build Packages and generate Linux image

Is build success?

NO

YES Add Pi-TFT Driver

Flash on SD-Card &Plug in Raspberry pi

Stop

Figure 4. Image Customization using YOCTO (NEW_IMAGE) B. Configuring the Host Here, Ubuntu 12.04 has been used as host platform to develop the custom image for the Raspberry Pi. Following command is needed to install the necessary packages on Ubuntu host that would help for successful building of the Yocto image. The command needed to install the essential Ubuntu packages is: $sudo apt-get install gawk wget git-core diffstat unzip texinfo \build-essential chrpath libsdl1.2-dev xterm

35097

International Journal of Applied Engineering Research ISSN 0973-4562 Volume 10, Number 15 (2015) pp 35095-35102 © Research India Publications. http://www.ripublication.com

Preparing the environment for Raspberry Pi involves following methodology. First, download the Yocto project source tree with command: $git clone git://git.yoctoproject.org/poky Then move into poky directory and download the required layers for Raspberry pi: meta-raspberrypi using following commands: $cd poky $git clone git://git.yoctoproject.org/meta-raspberrypi To create build directory and configuring the system to build the Yocto image for a Raspberry Pi board with the command:

There are two ways to create images, using command line (Bitbake) or using graphical environment (hob). Bitbake is a generic command line interface used to build image which executes tasks according to provided metadata. Metadata is stored in recipe files and related recipe "append" files, configuration files and underlying include files, and in class files. The metadata provides instruction to BitBake about what tasks are supposed to run and the dependencies between those tasks. BitBake includes a fetcher library for obtaining source code from various places such as local files, source control systems, or websites. Some important original goals assigned to BitBake are to handle cross-compilation, handle interpackage dependencies, support running any number of tasks within a given package, including, but not limited to, fetching upstream sources, unpacking them, patching them, configuring them for target systems like Raspberry pi and beagle bone board and few more.

$.oe-init-build-env raspberrypi C. Configuring Linux Kernel Using Bitbake Entire custom Linux development is done in Ubuntu host for Raspberry pi system is created under Raspberry pi directory. In the “conf” directory there are the two configuration files: “local.conf” and “bblayers.conf”. “local.conf” file is one where certain parameters can be selected like selection of target machine, packages to be added to the final image, type of packages needed (debian, rpm, ipk) etc. whereas bblayers.conf helps to select the recipes needed for the final image. The main parameters which are needed to be customized in the “local.conf” are: MACHINE? = "raspberrypi" DL_DIR? = "/home/mahi/downloads" IMAGE_FEATURES += "package-management" MACHINE parameter in “local.conf” file is used to specify the target name for the board. DL_DIR parameter is used to specify the directory where source tarballs are downloaded during the build process. IMAGE_FEATURES is used to install rpm package management tool which adds new rpm packages to custom Linux image. In the “bblayers.conf” file add the path for the new layers which are supposed to be looked during custom Linux development: BBLAYERS? = " \ /home/mahi/yocto/poky/meta \ /home/mahi/yocto/poky/meta-yocto \ /home/mahi/yocto/poky/meta-yocto-bsp \ /home/mahi/yocto/poky/meta-raspberrypi \ /home/mahi/yocto/poky/meta-openembedded \ " In this case, the last line has been added with meta-raspberrypi and meta-openembedded layers. There layers would allow user to include certain packages such as python 2.7, gcc, openssh, tar, libsdl, bash etc. that provide desired features in final custom image.

Figure 5. Custom Image build process using Bitbake To build the custom Linux image, call the bitbake command from the /home/mahi/yocto/poky/raspberrypi/ directory. The command that was used to build a minimal system, without the desktop environment: $ bitbake rpi-hwup-image The building of the image take 10 to 12 hours approximately and also depends on the Host processor configuration and internet speed. The Host machine download all the packages needed for the image, configure and compile as per target machine. During the build make sure there is no internet network interrupt otherwise it ends with error that means again rebuilt the image. Depending on the processor also the build time vary ex in case of i7 processor it takes only 4 to 5 hours whereas in case of i5, i3 it takes 10 to 12 hours. After build process completes, the final custom image is available in directory ~/yocto/poky/raspberrypi/tmp/deploy/images/raspberrypi and its default name is “rpi-hwup-image-raspberrypi.rpi-sdimg”. Now, the image can be pushed to SD-card using dd command

35098

International Journal of Applied Engineering Research ISSN 0973-4562 Volume 10, Number 15 (2015) pp 35095-35102 © Research India Publications. http://www.ripublication.com and plugged to Raspberry pi for testing purpose and perform required tasks. Hob is a graphical user front-end interface for BitBake. Its primary goal is to enable the user to make quick selection of target hardware, layer inclusion, selecting base image type and package selection much convenient and easy, without doing any physical modification in “local.conf” and “bblayers.conf” file. All these selection made using “hob” will automatically make suitable changes in these files.

Figure 7. Selecting suitable packages in Hob IV. PYTHON BASED NUMBER DIALER

Figure 6. Hob interface Creating your own recipes for target hardware is always preferable since it could be tailored to suit the exact target requirements. Recipes can also be created for inclusion of those specific packages which is not included by-default in Yocto project ex: pygame, motion etc. Layers allow us to differentiate different types of target customizations from each other. The Source Directory has its own general layers for the hardware and Board Support Packages layers. It is not mandatory that a layer should begin with the prefix as meta-, which is commonly recommended standard in the Yocto Project. Some of the widely used Layers are “meta-skeleton”, “meta-selftest”, “meta-yocto”, and “meta yocto-bsp”, etc. Board Support Packages play an important role in customization of Linux kernel build for specific target by providing required support for on-board peripherals. In this paper, the target board is Raspberry pi Model B.

Once, the custom Embedded Linux image, built using Yocto Project, which have minimum memory foot print and relatively faster performance, is running on the Raspberry Pi, the next objective is to make voice call. To achieve this, a Graphical User Interface (GUI) is required which can be made using Python 2.7 package, which ia already included in the custom image. Python is an effective high-level programming language used in Raspberry Pi which acts as a bridge between the user and hardware by providing GUI and making hardware behave as directed by user. In this prototype, Python 2.7 version has been used which is supported well in Raspberry pi. Its syntax is simple, standard, and powerful and also its execution, compilation process is comparatively easier from other languages. Pyserial is a python library which provides support for serial communication over different types of devices like RS-232, connection to the GSM Modem, Bluetooth dongles and few more. The script uses AT commands for calling purpose and it runs by invoking the following command in target terminal $python pyserial.py Since the display driver required to interface PiTFT 2.8 resistive could not be placed in custom Linux kernel image developed using Yocto project in proper manner (display support is yet not officially available in meta-raspberrypi inder Yocto project), display remained nonfunctional in this prototype and left for future development. To handle such situation and perform call operation, “pyserial.py” script is used in Raspberry pi via ssh. If PiTFT 2.8 resistive display driver would have been working as expected (as in Raspbian OS), the following flowchart should be followed to get the dialer functional and usable. This following flowchart is tested on Raspbian Os and it is working.

35099

International Journal of Applied Engineering Research ISSN 0973-4562 Volume 10, Number 15 (2015) pp 35095-35102 © Research India Publications. http://www.ripublication.com ser.flush() ser.write('ATD9781503446;\r') time.sleep(10) ser.write('ATH\r') ser.close()

Start

Import Library Functions

IV. HARDWARE INTERCONNECTION

Setting GUI and Serial communication

Initialize pygame, pyserial, modem and loading icons

NO Execute?

YES

Figure 10. Hardware interconnection between Raspberry pi, GSM modem, speaker and microphone

Display Number Dialer

The Raspberry Pi is interfaced with PiTFT 2.8” resistive using SPI protocol via 26 GPIO Pins. The GSM Modem SIM 900A interfaced with Raspberry pi through serial communication using Tx and Rx pin. Tx, Rx pins of Raspberry pi have been connected to the Rx and Tx pins of GSM modem respectively having common ground. The audio input and output are interfaced to mini metal microphone and mini speaker from GSM modem through dedicated pins.

Stop Figure 8. Python Script Execution

V. RESULT AND ANALYSIS The developed prototype gives successful voice transmission via transmitter and receiver end with optimum voice clarity on both ends. The Linux image has been customized at both kernel and package level in order to get small memory footprint and application specific so that it can support more applications as per requirement, in future. A. Performance evaluation parameters

Figure 9. Voice calling setup via ssh The following serial communication program is executed via ssh for successful voice transmission through Tx, Rx pins of Raspberry Pi using GSM SIM 900A.

Elapsed time- It is the time taken from the start of a program till the end as measured by an ordinary clock. It includes I/O time and all other types of waits incurred by the program. Process time -is the amount of time to process all the data Wall time- is the human perception of the passage of time from the start to the completion of a task.

import serial import time ser = serial.Serial("/dev/ttyAMA0", 115200, timeout=0.5)

35100

International Journal of Applied Engineering Research ISSN 0973-4562 Volume 10, Number 15 (2015) pp 35095-35102 © Research India Publications. http://www.ripublication.com

OS FOR RASPBERRY PI

NEW_IMAGE

MEMORY SIZE

538 MB

(USING YOCTO PROJECT)

RASPBIAN

EXECUTION SPEED IN SEC

Elapsed time-0.005

EFFICIENCY

MORE EFFICIENT

Process time0.000258

3.2 GB

Elapsed time-0.010

LESS EFFICIENT Figure 11. Python Program used to test execution Speed

Process time0.000180

PILFS (Base Img)

1.1 GB

Elapsed time-0.029

LESS EFFICIENT

Process time0.000312 Figure 12. Processing and wall time on MY IMAGE Table 1. Execution Speed comparison of different OS on Raspberry pi

The execution time of program has been compared using Python 2.7 since the images having python package available to determine time and space complexity. Here the customized image using Yocto wins. The Snapshots are showing the real, user and system time taken by the OS to execute a program. The figure no 11, 13 and 14 are presenting the execution time in detail on MY IMAGE. The fig 10 explains the percentage of CPU utilization during executing a program. It also represents the real time, user time and system time in seconds, page size, page fault etc.

Figure 13. Execution time in detail (MY IMAGE) The graphs are plotted from above performance parameters like Memory size and execution speed on different OS

35101

International Journal of Applied Engineering Research ISSN 0973-4562 Volume 10, Number 15 (2015) pp 35095-35102 © Research India Publications. http://www.ripublication.com dedicated for Raspberry Pi. It has been seen that Custom Embedded Linux OS created by Yocto performs much better in terms of storage space requirements and execution speed when compared to PiLFS (custom OS for Raspberry pi) and Raspbain OS (Desktop OS) on the basics of Python program.

which is efficient, both in terms of space consumption and execution time, when compared with existing custom Linux OS such as PiLFS or Desktop OS version such as Raspbian OS. This device have successfully made voice calling with optimal clarity at both ends. In future, some extra features can be added to enhance the performance of this prototype such as display, battery, camera, wifi dongle and many more. Since it supports Embedded LINUX, it could be loaded with many useful applications like web browser, games, music player, image processing applications, etc. Other possible areas of use for such devices are home security video surveillance, multifunctional device, digital camcorder, music player, robotics, etc.

Graph 1. Memory Size Occupied by various OS

VII. REFERENCES Hannu Flinck, flinck@saunalahti, Building Linux Kernel for Raspberry Pi, Nokia Solutions and Networkshannu. [2] Chandra Krintz Rich Wolski, Using Phase Behavior in Scientific Application to Guide Linux Operating SystemCustomization, Computer Science Department University of California, Santa Barbara, IEEE computer society, 2011. [3] Porting the Linux Kernel to Arm System-On-Chip and Implementation of RFID BasedSecurity System Using ARM, International Journal of Studying Main Differences between Android & Linux Operating Systems, International [4] Journal of Electrical & Computer Sciences IJECS-IJENS Vol: 12 No: 05. October 2012 [TA6]Android ology I: Architecture http://www.android.com/about/videos.html#video=androidolo gyiarchitecture [5] Wookey and Tak-Shing, Porting the Linux Kernel to a New ARM Platform, Aleph One •www.aleph1.co.uk [1]

Graph 2.

[6] Clinical Study on Acute, Repeated Exposure to Mobile Phone Noise and Audiometric Status of Young Adult Users In a University Community, International Scholarly Research Network [1] ISRN Public Health Volume 2012, Article ID 241967, 7 pages [7] Yocto kernel development manual http://www.yoctoproject.org/docs/1.7.1/dev-manual/dev [8] Raspberry Pi Projects, https://learn.adafruit.com/ raspberry pi projects [9] GSM SIM 900 A datasheet http://www.propox.com/download/docs/SIM900.pdf [10] Teach, learn and make with raspberry pi, https://www.raspberrypi.org/ [11] Adafruit PiTFT - 2.8" Touchscreen Display for Raspberry Pi [12] Python programming,https://docs.python.org/2/tutorial/

Graph 3.

VI. CONCLUSION Embedded Linux development using Yocto Project proves to be a potentially efficient method for custom OS development

35102