# Serial OTG Android Mode on PC (Android-Arduino)

**URL:** https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102
**Category:** Processing for Android
**Created:** [December 13, 2021, 9:42pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102 "2021-12-13T21:42:44Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![gab022](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@gab022](https://discourse.processing.org/u/gab022)
#### Post date: [December 13, 2021, 9:42pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/1 "2021-12-13T21:42:44Z")

</div>

Hi, i want to know hot to use the Processing Android mode, serial(OTG) communication with arduino nano! I found an library but it didn’t work for me, just exits without error message! Thanks for the help!

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [December 13, 2021, 10:11pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/2 "2021-12-13T22:11:56Z")

</div>

Hi

> [@APDE USB / OTG communication](https://discourse.processing.org/t/apde-usb-otg-communication/30114):
>
> Last update 2021-05-20T00:00:00Z (UTC) this post will be constantly updated, so someone will be interested, but do not want to scroll through the posts further, they will see and know everything, show what has already been done and where we are now stuck Conditions and purpose: to write a working program on a smartphone using APDE of any version, without touching a personal computer. Connect any smartphone or tablet via OTG cable via serial port to any microcontroller via their RX TX pins. Pl…

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [December 13, 2021, 10:21pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/3 "2021-12-13T22:21:14Z")

</div>

Hi

If you couldn’t do it after reading I can help you

---

<div class="post-metadata">

### Author: ![gab022](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@gab022](https://discourse.processing.org/u/gab022)
#### Post date: [December 13, 2021, 10:23pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/4 "2021-12-13T22:23:10Z")

</div>

hi, thanks for the answer, found your thread earlyer! I’m strugglig for days now with no succes. Now i read that i need to try the speed 57600. I will try it tomorrow. In my example the app just exits with no error message. Thanks again for the fast response! 🙂

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [December 14, 2021, 12:00am UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/5 "2021-12-14T00:00:52Z")

</div>

[![](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/90.png)](https://discourse.processing.org/u/jafal)

[jafal](https://discourse.processing.org/u/jafal)

[May 24](https://discourse.processing.org/t/apde-usb-otg-communication/30114/117)

This is OTG working example

---

<div class="post-metadata">

### Author: ![gab022](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@gab022](https://discourse.processing.org/u/gab022)
#### Post date: [December 14, 2021, 10:43am UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/6 "2021-12-14T10:43:12Z")

</div>

Hi!  
I’ve tried your example code, changed the Manifest file, added the device\_filter.xml in the root/res/xml.  
Uploaded the sketch without any error. Now when i plug my arduino nano to the phone it suggest me the sketch to start, thats seems good, but after that it just exits without any reason or error message. Tried another android device, same issue. Did i miss something?

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [December 14, 2021, 12:45pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/7 "2021-12-14T12:45:05Z")

</div>

Hi

What is your Arduino USB chip?

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [December 14, 2021, 12:48pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/8 "2021-12-14T12:48:03Z")

</div>

Hi

Are you sure that your android support OTG ?

---

<div class="post-metadata">

### Author: ![gab022](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@gab022](https://discourse.processing.org/u/gab022)
#### Post date: [December 14, 2021, 12:49pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/9 "2021-12-14T12:49:23Z")

</div>

the chip is CH340G, my android support otg, tested with a wiresless keyboard with touchpad, and it works well.

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [December 14, 2021, 1:08pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/10 "2021-12-14T13:08:27Z")

</div>

Hi

I have tested it with Atmega16u2 only

Which serial library you used ??

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [December 14, 2021, 1:13pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/11 "2021-12-14T13:13:07Z")

</div>

> [@gab022](#):
>
> tested with a wiresless keyboard with touchpad, and it works well.

Wireless and at the same time has OTG right ?

---

<div class="post-metadata">

### Author: ![gab022](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@gab022](https://discourse.processing.org/u/gab022)
#### Post date: [December 14, 2021, 1:27pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/12 "2021-12-14T13:27:36Z")

</div>

the keyboard i used has an USB receiver plugged to the android device through OTG cable. The arduino chip is ATMEL M328P. [Release 0.1.0-alpha · inventit/processing-android-serial · GitHub](https://github.com/inventit/processing-android-serial/releases/tag/0.1.0-alpha) thats the link to the library.

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [December 14, 2021, 1:35pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/13 "2021-12-14T13:35:20Z")

</div>

> [@gab022](#):
>
> The arduino chip is ATMEL M328P. [Release 0.1.0-alpha · inventit/processing-android-serial · GitHub](https://github.com/inventit/processing-android-serial/releases/tag/0.1.0-alpha) thats the link to the library.

yes The arduino chip is ATMEL M328P. but i used the one with Atmega16u2 usb driver not the CH340G chip

---

<div class="post-metadata">

### Author: ![gab022](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@gab022](https://discourse.processing.org/u/gab022)
#### Post date: [December 14, 2021, 1:40pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/14 "2021-12-14T13:40:46Z")

</div>

thanks unfortunatelly i can’t test that, i don’t have one.

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [December 14, 2021, 1:45pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/15 "2021-12-14T13:45:17Z")

</div>

Ok I have both I am going to test your and reply you tomorrow

---

<div class="post-metadata">

### Author: ![gab022](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@gab022](https://discourse.processing.org/u/gab022)
#### Post date: [December 14, 2021, 1:54pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/16 "2021-12-14T13:54:29Z")

</div>

that would be great!

---

<div class="post-metadata">

### Author: ![gab022](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@gab022](https://discourse.processing.org/u/gab022)
#### Post date: [December 14, 2021, 1:56pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/17 "2021-12-14T13:56:49Z")

</div>

i’ve installed the app ‘serial USB terminal’ on the android device, and it sees the arduino board, so i think the physical connection is working well.

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [December 14, 2021, 2:36pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/18 "2021-12-14T14:36:11Z")

</div>

hi

i have not test yet but for now try to change device\_filter.xml with this and inform what you got

```auto
<?xml version="1.0" encoding="utf-8"?>
<!--
https://github.com/mik3y/usb-serial-for-android/blob/master/usbSerialExamples/src/main/res/xml/device_filter.xml
-->
<resources>
    <!-- 0x0403 / 0x6001: FTDI FT232R UART -->
    <usb-device vendor-id="1027" product-id="24577" />

    <!-- 0x0403 / 0x6015: FTDI FT231X -->
    <usb-device vendor-id="1027" product-id="24597" />

    <!-- 0x2341 / Arduino -->
    <usb-device vendor-id="9025" />

    <!-- 0x16C0 / 0x0483: Teensyduino -->
    <usb-device vendor-id="5824" product-id="1155" />

    <!-- 0x10C4 / 0xEA60: CP210x UART Bridge -->
    <usb-device vendor-id="4292" product-id="60000" />

    <!-- 0x067B / 0x2303: Prolific PL2303 -->
    <usb-device vendor-id="1659" product-id="8963" />

    <!-- 0x1a86 / 0x7523: Qinheng CH340 -->
    <usb-device vendor-id="6790" product-id="29987" />
</resources>

```

---

<div class="post-metadata">

### Author: ![gab022](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@gab022](https://discourse.processing.org/u/gab022)
#### Post date: [December 14, 2021, 3:42pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/19 "2021-12-14T15:42:19Z")

</div>

unfortunatelly it does the same thing :S

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [December 14, 2021, 4:43pm UTC](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102/20 "2021-12-14T16:43:19Z")

</div>

Hi

With Arduino uno works fine but with nano keep crashing

 ![IMG_20211214_183704](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/0/02c2967780c5841189038ebf2ea7a740427eb23d.jpeg)

 ![Screenshot_2021-12-14-18-34-57-167](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/c/cae0e1a7316dc6714a278ac47d2800a6ae597662.jpeg)

 ![Screenshot_2021-12-14-17-23-08-611](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/9/954f1f5c3d2bc819c0bd2a5fd37922ea4c21a632.jpeg)

[Next page](https://discourse.processing.org/t/serial-otg-android-mode-on-pc-android-arduino/34102.md?page=2)
