Welcome

This blog has permanently moved to
https://boseji.com

Contact Form | Email Address

© 2018 All rights reserved by Boseji

Thank you for all your support.

Sunday, March 10, 2013

Installing pyserial under linux:Serial Begin

As you may know from our earlier post we have completely shifted our developments to Linux. This post is to describe the process of installing the pyserial package into Linux.
You can visit the pyserial page for locating the documentation: http://pyserial.sourceforge.net/

Here is the step by step process to perform the installation:
[1] Getting the Files
You need to download the pyserial: https://pypi.python.org/packages/source/p/pyserial/pyserial-2.6.tar.gz#md5=cde799970b7c1ce1f7d6e9ceebe64c98
If this download link is not valid then go to: https://pypi.python.org/pypi/pyserial
You might observe that the version that we are downloading is the Python 2.6 supported but do not worry - we have tested this and it works for Python 2.7.

[2] Check if you have python installation in Linux
We are using Ubuntu 12.04 version of Linux so our package updater is 'apt-get'.
In Ubuntu we have python 2.7 available by default. However for some other Linux distros that might not be the case, so try to check for online help regarding installation of python v2.7/v2.6 into your specific Linux distribution.
To test if python is present or not type python in the terminal window. you would get a prompt like this:
Python 2.7.3 (default, Aug  1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Next type - exit() - this would exit python interpreter and bring you back to the shell prompt
[3] Extract and install the pyserial package
The pyserial package is a tar.gz type archive so you need first go to the directory where it has been downloaded in the terminal.
Next give the following set of commands:
  1. Extract the Archive
    tar -zxvf pyserial-2.6.tar.gz
  2. Go the pyserial directory
    cd pyserial-2.6
  3. Build the package
    python setup.py build
  4. Install the package
    sudo python setup.py install
Now the package is ready to use and installed.

[4] Testing the installation

The pyserial package comes with the miniterm.py scripted python program. We would use this to test pyserial installation. We have connected a USB to Serial Pl2303 based converter at /dev/ttyUSB0
We can use this miniterm tool to connect to the serial terminal at 9600 baud rate.
Give the following command on the terminal prompt:
miniterm.py -p /dev/ttyUSB0
You would get the following prompt:
--- Miniterm on /dev/ttyUSB0: 9600,8,N,1 ---
--- Quit: Ctrl+]  |  Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

This means that the pyserial is successfully installed and ready for use. Hope this article has been helpful. Let us know your suggestions and feedback.

1 comment:

  1. Thanks for providing this informative information you may also refer.
    http://www.s4techno.com/blog/2016/07/15/write-command-find-files-accessed-within-last-30-days/

    ReplyDelete