Serial port handler using python | pyAT.py

Welcome back to my crazy experiments!  This will be a little bit long tutorial because I try to explain few basic things first.

Explanation of background

By connecting smartwatch to phone we can see messages, phone-book, music library and few more in the phone.  But generally we use bluetooth for file transferring.  So I decided to create  a software (as same in smartwatch ) to unleash the power of bluetooth connectivity.

Do you ever think why various kinds of bluetooth devices behave their own way.  Such as , when you connect BT hand-free to smartphone your phone shows headphone symbol, but not same as connect with another smartphone.  Bluetooth is pretty much interesting topic to learn.

6090ae12-1f7e-4953-91d0-eef343f34378

Bluetooth use several kinds of ‘profiles’ to communicate between devices.  Different kinds of devices support different kinds of profiles.  So these capabilities work as identifiers also.  Visit wikpedia to learn more. Don’t miss this ; it’s fun.  😉

https://en.wikipedia.org/wiki/List_of_Bluetooth_profiles

Python

Python for everything, right?   Actually it’s flexible and powerful because there are plenty of useful modules for python.  If you want to access and analyze a website, just you need few simple python lines. Want to send e-mail, the same. Serial port handling is directly related with low level programming.  But the beauty of python modules are, you don’t feel even you are working with hardware.

pyAT.py

pyAT.py is a simple tool to handle your smartphone or smartwatch via serial port.  You can connect your device via bluetooth to computer. Open ‘Device Manager’ to see all available COM ports or goto ‘Devices and printers’ in control panel and just right click on the device you need.

4

It will show as COMx (x; x>=0) .  Basically your device communicate with your PC using special commands called ‘AT commands’.  By handling those commands correctly, we can do whatever we like.  The problem is AT commands depend on hardware, means we can’t use same commands to communicate with almost all devices.  I tested this tool with several kinds of devices and handle possible errors.  Open source code and make sure automated commands support with your device.

Example AT commands set:

http://amber.feld.cvut.cz/user/pokorny/bpdp/nokia_at.pdf

[+] Port :

means COMx port that your device connected with.  Main screen is very easy to understand.  You can use 0-3 options and ‘4’ for execute your own commands.

How it works

I used python 3 syntax to develop this, and used pySerial module.

(04)Give me a terminal

option uses pySerial built-in option.

Open the source code and read ! for better understand 🙂  Code here

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: