Archive for March 2013

It might be surprising but yes we wish to provide a simple guide to perform 8051 development under Linux. For many 8051 might be history but its still relevant for starters.

The amount of study material already available along with a base of example and help available on topics related to this microcontroller architecture makes it a easy choice. Although the same is true for AVR,PIC or the grand ARM, but the simplicity of this controller cant be compared with any one of them. In fact we had this microcontroller is several of our projects and endeavours in the past decade. So we decided to pay our tributes to this grand old microcontroller with the help of this article on how to start and effectively perform development on this controller under linux.

One of our friends recently too up a project of building a CNC router. The idea was to make a Open source router framework that can be used for 3D printer, Cutters, painters etc.
NEMA 17 Bipolar 4-wire Stepper Motor
However he had surplus motors so he wishes to see off the excess motors at reasonable rates. He requested us to put this up so that people can buy these motors, and here we are with the post for the same.

Specifications of this NEMA 17 Bipolar 4wire Stepper motor:
  • Motor Properties:
    • Motor Type: Bipolar Stepper (2 Coils)
    • Step Angle: 1.8 degree
    • Step Accuracy: 5%
    • Holding Torque: 4.0 Kg cm @ 1.7A
    • Rated Torque: 3.4 Kg cm @ 1 A
  • Electrical Characteristics:
    • Motor Coils: 2 Coils
    • Rated Current: 1.7A
    • Recommended Voltage: 12V (Full Stepping), 9V (Micro-stepping)
    • Coil Resistance: 2 Ohm
  • Physical Properties:
    • Mounting Plate: NEMA 17
    • Motor Length: 40mm
    • Shaft Length: 24mm
    • Shaft Diameter: 5mm
Mechanical Dimensions
Coils and Colors
You can contact him through this form and he would be happy to help you out with any details you may need.
We have been searching for a consistent source to obtain a stable releases of AVR tools on Linux. Here is what we came across recently.

This is Atmel's Official link supporting the Linux Tool chain for  AVR-8 and AVR32 architectures:

However the support of AVR32 AP7000 has been removed only thing that remains is the Build Root for AVR32 AP7000:
We wondered if the Linux prompt can be more snazzier that we have it by default dull type.
To something more interesting:
This magic is using the 'PS1' environment variable in Linux.
Here is the command that does this magic:
PS1="\n\[\033[1;37m\]\342\224\214($(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h'; else echo '\[\033[01;34m\]\u@\h'; fi)\[\033[1;37m\])\342\224\200(\[\033[1;34m\]\$?\[\033[1;37m\])\342\224\200(\[\033[1;34m\]\@ \d\[\033[1;37m\])\[\033[1;37m\]\342\224\200(\[\033[1;32m\]\w\[\033[1;37m\])\342\224\200(\[\033[1;32m\]\$(ls -1 | wc -l | sed 's: ::g') files, \$(ls -lah | grep -m 1 total | sed 's/total //')b\[\033[1;37m\])\n\342\224\224\342\206\222> \[\033[0m\]"

There are 3 parts to this magic:
  1. Usage of Special Unicode characters:
    Looking at the beginning of the line you might have noticed the char '┌' which is U+0x250C. This is a UNICODE character to make top left border. In order to find the right string to code the PS1 variable you would need to the octal codes for the special char. To get that we have these commands:
    • If you know the code of the char:
      echo -e "\u250C" | hexdump -v -e '/1 "%03o "' | awk '{print "\\" $1 "\\" $2 "\\" $3 }'
      This is for the top left border char that we are talking here. It would print:
      This is the code you can now use in the PS1 variable definition.
    • In case you know the char it self then:
      echo ┌ | hexdump -v -e '/1 "%03o "' | awk '{print "\\" $1 "\\" $2 "\\" $3 }'
      This gives you the codes again in the same manner as the earlier one.

    In order to get further info you can visit the following links: - Here you get all the charts for Unicode characters
  2. Special formatting for the normal user and the root user:
    The piece of the variable that does this job is -
    ($(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]\h'; else echo '\[\033[01;34m\]\u@\h'; fi)
    This would ensure that if the user is root the only the host is printed else the user name @ host is printed.
  3. Finding the Number of Files and the total size:
    This part is done in two folds -
    First part is the number of files that exist in the current working directory:
    \$(ls -1 | wc -l | sed 's: ::g') files,
    The next part is the total size of all files under the directory(no including sub-directory sizes):
    \$(ls -lah | grep -m 1 total | sed 's/total //')b
This make a nice way to work on Linux with style. The possibilities are only limited by your imagination and few time.
Inspired by the Archlinux wiki:
    We recently stumbled across a good source of concepts related to physics and nature. This has the simplest URL:
    This is a helpful resource to revisit the concepts and understanding of Physics. We found this resource to be really helpful and hope it would be useful for you too.
    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:

    Here is the step by step process to perform the installation:
    [1] Getting the Files
    You need to download the pyserial:
    If this download link is not valid then go to:
    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 build
    4. Install the package
      sudo python install
    Now the package is ready to use and installed.

    [4] Testing the installation

    The pyserial package comes with the 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: -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.
    Welcome to Boseji's Blog

    Popular Post

    Blogger templates


    Creation by Electronics Hobbyists from Bharat(India) to encourage & help people. This blog hosts the numerous innovations, discoveries and projects we provide.
    Our Research Wing Adhar Labs
    Contact Form | Email Address
    We Support Open Source Hardware Definition v1.0
    Creative Commons License
    All works on this blog are licensed under a
    Creative Commons Attribution-ShareAlike 3.0 Unported License.
    Based on a work at and

    Permissions beyond the scope of this license may be available at
    Thank you for all your support.

    © A.D.H.A.R Labs Research 2008-2013 . Powered by Blogger.

    Follow by Email


    PCB Unit Converter


    - Copyright © Electronics for Bharat -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -