Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I communicate an Android Accessory with a USB Serial Port?

Hereby the situation: I'm working on a Android Tablet that must work in Accessory mode. Reason why is because the tablet can't provide enough power to perform the communication with a Serial USB microcontroller and remain charging it's battery.

enter image description here

In order to achieve a successful communication, I must be able to set a few serial conditions for Modbus/RTU

  • Serial Port Address (i.e. COM1, COM2...)
  • Baud Rate (19200 bps)
  • Data Bits (8)
  • Stop Bits (1)
  • Parity (None)

An excellent example in Delphi would be Modlink.

A good guidance would be UART https://github.com/ytai/ioio/wiki/UART

Meanwhile, I've found some useful projects but they were intended to work on Host mode.

https://github.com/mik3y/usb-serial-for-android https://github.com/ksksue/Android-USB-Serial-Monitor-Lite

I'm looking for any valuable information, guidance and references on how should I proceed to create an Android Application that can communicate with Serial USB.

How can I achieve this?

Note: I'm using Android Studio.

like image 683
Machado Avatar asked Oct 31 '22 10:10

Machado


1 Answers

There's an excellent source code made by FTDI Chip, so if you ever need to perform USB/ftdi connections with Android try this application:

FTDI UART TERMINAL

Source code: http://www.ftdichip.com/Android.htm

like image 173
Machado Avatar answered Nov 14 '22 02:11

Machado