Serial usb connection

Maybe add a \n to the end of the AT command?

1 Like

Thanks Il try.
It didn’t work, the app doesn’t recognize the
Connection and don’t react to OpenSerial.
Other apps that i tried in google play
Work straight away no configuration needed,
Every time I connect the usb a popup appear and i give the permission to connect to the serial USB

Maybe there are other parameters your device needs that AI2 doesn’t provide…

What device are you using? Is there a developer guide for it?

The model is
pci-e 910 telit dw5580
Im communicating with it by AT COMMANDS

This looks like some sort of PCIe LTE card. How are you connecting it to your Android device?

(It also might help to connect your Android device to the computer, run adb logcat, and post the results here. If you don’t have adb, get it here: https://developer.android.com/studio/releases/platform-tools)


You can see that the power is on
The problem is that the app doesn’t recognize serial usb connection

I found a great intro and bibliography for serial USB at https://en.wikibooks.org/wiki/Serial_Programming/USB

1 Like

Since the doc link on the extension at http://extensiondirectory.com/tools/arduino-extension.html asks for the phone to be set for USB media Transfer Protocol, and because the source code has references to file operations, there is a possibility that the data transfer is meant to work one file at a time. Since there are no mentions of file names in the blocks, the simplest case I can think of would be an instream text file. Since text files typically are terminated with hex zero in C, maybe it would be helpful to have some way of adding one to the end of a data stream. Here are some blocks (draggable) to generate a x’00’ character…
hexify HexZero HexZero_test hexZero_test_call

Someone added a random extension to Appinventor and no one knows how to use it :smiley:

It is documented as an A2I component. See: http://ai2.appinventor.mit.edu/reference/components/connectivity.html#Serial

There seem to be a couple of problems though with this component:
1> The read, write, print only handle "text". So there may be a need to "program" around this short-coming if you are receiving/transmitting high/lows/ binary1/0, and hexadecimal characters formed in packets . Ah the challenge.

2> If you are using the OTG port on the Android or Emulator it is difficult to run a client USB device and upload APK's. Patience, patience.

What has been done so far:
The Arduino USB Serial Extension kind-of-worked until it was challenged a bit. The the JAIL compiler "burped" and crashed. So a search was started for alternate solutions. The OTG USB Bridge was found to be highly suspect and unusable.

If you try the Serial.aia, try "enabling" the Textbox entry object and the Button adjacent to it. The enabled Button will "send" a text string message somewhere. As of yet no client device has acknowledge receipt of a transmission from the enabled Button.

The saga continues.

GTKTerm-Receiving Inputs from F310 Gamepad
p054_gtkterm

I don't know if this helps you (or anyone), but I can confirm that the serial component in AI2 does work with an arduino device using an OTG cable. I am able to initialize and open a connection and then send information to the arduino to blink LEDs (HIGH/LOW), etc.

In terms of information transmitted, the arduino (and probably other devices) can convert ascii data into hex/binary/etc upon receiving or before transmission. Not sure about your gamepad if you can't program it.

Re: USB cable occupied, my workflow for this stuff is:

  1. From app inventor, build app to QR code.
  2. Copy the link (it's always the same except for four characters) and download on phone browser and install.
  3. To update, delete app and repeat. USB cable remains attached to serial device.

See this thread for a working .aia:
https://community.appinventor.mit.edu/t/usb-permission-popup-every-time-serial-component/12596

I can provide you with a sample arduino sketch if it interests you, but it seems like you're working with other hardware.

I have not worked with receiving data from serial device yet, only transmitting.

1 Like

Ditto on the TX and confirmed on the RC. But the Extension falls apart if Arduino (mega256) is replaced with a F310. I am looking under the hood to see if a device specific extension for the F310 is required. At the moment it seems so.

My backup plan is to use a "spare" Arduino Uno with a joystick component for direction and a potentiometer for speed control instead of the F310.

same here: the serial extension works fine with arduino MEGA 2560 (RX and TX)
but not with Arduino UNO nor Teensy LC :frowning:

Hi there! This is exactly what I’m trying to do as well. Just transmit serial data from the app to the arduino. I used the serial component, but I don’t see how its possible or how to best include the serial1.open block. Could you share how u set up ur blocks in AI2 ? Thanks alot.

(Sketched are helpful as well!)

Thank you Again

Stephanie, see this thread for actual example code of using the serial blocks to send/receive:

I did all my testing with an UNO and everything was fine. My understanding is that serial ports operate identically on those three platforms (I've interchanged working code between those three exact devices many times).

It might also be a phone specific issue. With my testing, I was using a Moto G Play XT1609 running Android 7.1.1.

Blake

Try with this extension

2 Likes

Can someone upgrade this?

Use this extension. Works perfectly.

Here examples of the SerialOTG extension

Where can I find the aix file?
Thanks