Using serial with FTDI

One problem with the built in serial component is that it does not include d2xx.jar needed for communication with FTDI usb to serial converter. If you connect this device you get an error “Java Lang.NoClassDefFoundError: Failed resolution of Lcom/ftdi/j2xx/D2xxManager”. I guess this is from the PhysicaloidLibrary. It is the same problem with the com.pavitra.5.aix that make use of the PhysicaloidLibrary.

If this is solved, then some of the Arduino clones can be used with App Inventor.

A better solution can bee to use This library seems to allow communication with most of usb-to-serial chips used for Aurduino clones and usb to serial converters.

1 Like

Some more information on serial extension.
I have built a new serial extension with d2xx.jar included. There is two ways to do this, add the library in directory lib/ or make a new physicaloid library from the original and combine this with d2xx. Both ways are possile to use.
This will result in an extension that can be used with CDC-ACM (org UNO), FTDI and according to the documentation CP210x. One problem is that it does not work with ai companion (same problem as above). It seems to be a conflict with the physicaloid library in appinventor. But if you compile and install the app on your device, then it works ok.
But there is one more problem. D2xx is not open source, so you might need permission to use it.
So I will continue with another solution if someone is interested.

I'm not a lawyer, but my interpretation of the license bundled with the D2xx.jar is that we wouldn't be able to include the FTDI driver for distribution as part of App Inventor. If you can find a compaitble library with a license compatible with Apache Software License 2.0 then we might be able to add it to App Inventor to support this in the core system.

Agree! I have found a compatible Physicaloid library with recent updates and Apache Software License 2.0, that handles all common USB-serial chips. During testing I found a problem with some CH34X serial adapters. I have a solution for that, but I just need to verify that it is the correct solution.

...sounds very interesting, especially given the number of people that use App Inventor with microprocessors (and gadgets).

First version of an extension is available on github, rkl099/Appinventor-SerialOTG

EDIT: Here is the link:

It is compatible with the built-in component Serial, extended with settings for parity, rts, dtr and refactored so it can be used with AI Companion. It has been tested with CdcAcm, PL2303, PL2303HX, FTDI, CP210x, CH341, CH341 (“fake”) and several android devices. I hope this will solve some problems discussed in the forum and make new applications possible.

Please return if you have any problems.


Hi again

Would it enable an App Inventor App to move files from a phone to a Windows PC via USB cable?

1 Like

that sounds great... could you please provide a link to your page there?
thank you


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Here is the link:

No, the library Physicaloid supports transfer of files, but not to a PC:

  • supports uploading firmware protocols : STK500, STK500V2, Binary blob ESP8266 OTA

The upload function has not been included in extension.

This extension works with my Arduino UNO with CH340 + cable OTG.

Enable OTG in Android Settings.

It is a pity that there is still no extension to connect to any uart device via usb otg. Something similar to BT, but via USB. It would be great.

I am not sure what you are looking for. With this extension you can use an usb to serial adapter connected to your Android device that allows you to talk to any equipment with a serial port. It works with most common usb-serial adapters and chips. With this connection you can send characters (and string) data. You have to add the protocol. Arduino communication is just a special case, normally with a application specific protocol. I have used it for serial communication with a Pc to test the different adapters. It has been tested with CdcAcm, PL2303, PL2303HX, FTDI, CP210x, CH341, CH341 (“fake”) and several android devices.


Cool! Works perfectly with my adapter! Thanks for the extension. In my humble opinion, a damaged Serial extension from appinventor should be replaced with this extension. We have to apply for it somewhere ...

Glad to hear that! I have made a lot of testing myself, but I want to hear from more users. It can easily be included in AppInventor by replacing an external library (Physicaloid) and some other small changes to add functionality.
There are only some small changes in the library parts now used by AppInventor, so I know already that I don’t add problems and that it is much more useful than the current implementation. When I am sure it is working ok I will release the library as open source and suggest that it is included in AppInventor.

I noticed that the application sends data as text. Is it possible to send binary data somehow? As with BT text or data.

I am asking because the device with which I want to communicate receives data in HEX. For example FF 0E etc. I know that the USB terminal uses the library you were based on and there you can send and receive data in any form.

No problem with the library, but I depends on how ApInventor handles variable types. It is possible to extend read and write to handle int och char types. This is a question that I am interested in so I will have a look at the problem.

Even your example application sends 0 and 1, while your arduino program receives 30 and 31. It would be nice if there was a solution to it.

It is possible that app inventor would have to enter integer variables. Now I guess they're all char. A bit weird for a development environment.