Saturday, June 22, 2013

Using USB to UART / RS232 modules with Android phones

Installation:

As we compiled the kernel modules needed for USB to UART modules in the previous post, Here I'm going to show how to use them.

You can mount /system partition on the phone with read/write permisions.
su
mount -o rw,remount /system

Then make a directory for kernel modules and copy them to there,
mkdir /system/modules
then copy modules (my compiled modules for 2.6.32.60-Kappa1.6) to /system/modules/

I'm using init.d script to load these modules in the bootup, if not you will have to load them manually each time.
copy my script to /system/etc/init.d/
chmod 755 /system/etc/init.d/usbser

If you like to load modules manually, you can refer this to get an idea,


















Now everything is done and when you plug an USB to UART module, it will be taken as /dev/ttyUSB0. You can use it with any application like on any Linux distribution.

You can do a lsmod to verify whether  the modules are loaded.


















Testing:

These are some dmesg outputs (when I connect the device) for some popular USB to UART devices that I have compiled the drivers for,

PL2303:



















CP2102:

















CH341 (from a USB to RS232 module):

















A loopback test with a Serial terminal app:

















Usage & Applications:

As  I mentioned earlier you can you these devices with any serial communication application for Android. I personally use "android-serialport-api" as a terminal application.


















Reading from a data-logger:


















No comments:

Post a Comment