Serial block component

On nb183 App Inventor version, has been introduced a ‘serial component’
I mean ‘serial component’ a type of rs232 or similar
Then, exactly wich ‘serial peripheral’ can i read/write on Android device like smartphone?

sorry, I do not know, also the documentation does not tell us more
http://ai2.appinventor.mit.edu/reference/components/connectivity.html#Serial
maybe @Diego, the author of the component can shed some light onto this?

Taifun


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

In theory, it should be possible to write to any kind of device. However, make sure that the device uses the proper bit configuration:

It is guaranteed that it will work with Arduino devices.

You must excuse me but I still don’t understand
Can App Inventor be used with Arduino devices?
What models exactly?

With Arduino devices, it is compatible with any board. The only limitation that it presents is that you cannot load code from your smartphone to the Arduino board (as that would require specifying the Arduino version).
It can be used to send and receive data from the USB connection (the “serial”).


In this video you can see a small demo (made with Thunkable, but doesn’t matter), and see the blocks needed around timestamp 0:34:

And here is the respective Instructables:

Note it talks about an “extension”, but its behaviour is like the Serial component.

(added to FAQ)

Is it just the Arduino Uno, which has the ATmega16U2 USB to serial converter chip, that is compatible with the MIT App Inventor Serial component.
The Arduino Nano and ESP8266 have a CH340 chip, which does not appear to be compatible.

support USB-Serial protocols : CDC-ACM, FTDI, Silicon Labs CP210x

You can find more info on supported boards and chips here: https://github.com/ksksue/PhysicaloidLibrary/blob/master/PhysicaloidLibrary/src/com/physicaloid/lib/Boards.java

Hello,
It is a nice component.
I’m (almost successfully) using it with ESP8266 and CP2102 (TTGO board).
It works fine with 9600bps but not with 115200bps. It looks like baud rate is not being set with BaudRate property… just a guess…

Thank you!

Good to read that you connected the ESP8266 with the Serial1 extension
Can you post the blocks you used to connect, please ?

Sure!
I was testing the baud rate setting so it is set in Screen.Initialize. Setting it in design view also works.

Serial.aia (3.3 KB)
Glad to help.

Thanks for sending the aia file.
On attaching the Arduino Uno, access to the app is requested (see screenshot), but not when the ESP8266 is attached. I don’t think that the CH340 chip is accepted by the Serial extension.

2 Likes

Thanks for the information. :slight_smile:

Hi,
Doesnt work for me!
I’m directly looking the output of my usb-otg of my phone with an oscilloscope.
When I press the button in my test app, I have a short notification thad says “Wrinting : TEST” but nothing on any pin of the USB.
Maybe it needs more than Android 4.4 ?

tried a lot - without success - with the nano - now I understand - sad but true :wink:
the uno is bigger than the phone so some mobile applications wont make sense
but I'll try a uno if the programming will work as intended

Another option is an ESP32 dev board, which has Bluetooth to connect to the mobile phone.

With an UNO and an OTG adaptor USB-C -> USB-A the serial blocks works very fine

grafik

Just send some ASCII chars to the arduino e.g. 'A' for set a pin high / 'a' for low thats working perfectly reliable

may to try not an arduino but an RS232 cable with FTDI chip instead:
https://www.adafruit.com/product/4364 but around factor 10x too expansive :wink:

So - some experiments later... :wink:
UNO works fine - all other attempts didn't work - tried several usb/rs232 adapers - and a bare FTDI chip (FT232RL) which all were recognized with the app 'serial USB terminal 1.38' but not with the app inventor projects...

for the FT232RL i get following error message:
'Failed resolution of: Lcom/ftdi/j2xx/D2xxManager;'
which could be interpreted as 'want to work with but cannot work with'

is there a update in pipeline to support more serial devices? would extend the opportunities for so many new (low cost) projects :wink:

Maybe you can try my extension and report if it works for you::

What is the 'set Status . Text' Block? I get that it's purpose is to open the serial communication, but what type of component is 'Status' and what did you chose in Designer to add that in?

THank you!