Android Question RS 232 to Android USB

Harris

Expert
Licensed User
Longtime User
Although I have worked successfully with various Bluetooth devices (using SSP), I have yet to hardwire a serial port (PC or other) to the USB on an Android device. What is the pin layout of a micro usb port?

Is the USB side the same as a standard serial port (RX, TX, Gnd - as well power for charging)? Do I use the same setup as serial (Port, Baud, etc)?

What is the port number of the USB on my Android device (Galaxy Tab E 8.0)?

Pairing with a BT dongle is so simple but I may need to hardwire for the next project (using serial port on CAT VIMS).

I see there are two libs that can be used (usbserial and felusbserial).

Thanks for all advice.
 

BillMeyer

Well-Known Member
Licensed User
Longtime User
A Word of Warning !!

Although we refer to the interface as a "Serial" interface they actually differ from device to device. The RS-232 (usually referred to as the Serial Port) usually found on a PC is different from the Serial found on a Microprocessor (usually called TTL Serial) to the "Serial" in the Universal Serial Bus or USB.

The main difference comes in two things:

1. The protocol used to communicate in RS-232 and..
2. The voltages that are on these ports.

An RS-232 port can have anywhere from 3v to as much as 25v running on it, whereas a USB has 5v and Microprocessors can have between 3.3v and 5v.

So my Warning - hot wiring can seriously damage your USB and WILL NOT WORK due to the protocols - hence Erel's advice to use a converter which usually has a MAX232 chip in it that will handle the voltage and protocol differences.

The tutorial found here will probably explain a bit better.
 
Upvote 0

nwhitfield

Active Member
Licensed User
Longtime User
Generally, what you'll need is three things:

1. That your Android phone supports USB host mode (aka USB On The Go, aka USB OTG)
2. A USB OTG adaptor that plugs into your phone and typically has a full size USB socket on it. Some of these are simple cables, others may include a card reader
3. A USB serial adaptor cable that plugs into the OTG adaptor. There are lots of these around, often based on an FTDI chipset. Some come with bare ends, some terminate in a nine pin socket or plug, some in a 3.5m jack.

Plug all those things together, add the UsbSerial library, and you have a solution. Also, often, lots of things dangling out of the bottom of your phone, which is a bit of a pain, and one reason why adding a bluetooth dongle to the device you want to communicate with is often more convenient.

As Bill says above, voltage levels are very important. Some cables will be built to operate at 3.3volts, some at 5 volts, and some at higher levels - most especially older equipment with built in real RS232 ports.

The Max232 will look after level adjustments, but if you have an adaptor that works at the right levels as your device, you may not need one. And, if you're brave, you can adapt between 3.3v and 5v levels just with a couple of resistors (no warranty implied... at your own risk).
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
Thanks guys. I understand now.

Found this adapter:
https://www.amazon.com/StarTech-com-Micro-Serial-Adapter-Android/dp/B00KXQUGXM

It may work but will require a USB 2 to micro adapter so I can power the tablet.
The vehicle power supply has a mico connector for charging the tablet thru the RAM GDS cradle assembly (shown below).

I guess the preferred method will be serial to Bluetooth, since the adaptor handles the serial lines (voltages) and pairing is simple.
The only problem is most adaptors that are externally powered use the 3.5 mm jack whereas a Y cable (shown below) for power splitting uses the micro usb...

RAM-GDS-CHARGE-V4U.jpg


RAM-GDS-DOCK-V2-SAM21U_3.png




s-l500.jpg
 
Upvote 0
Top