Serial communication

Zdroid

Member
Licensed User
Longtime User
Hi all

first off, please be gentle, :sign0013: :sign0104:

ok so now I've been toying with B4A for some time, I started a first project that works great (front end for an access database over internet via ASP)
that's cool.

I have another project and here I don't know what is the good strategy
I tried to find out via reading but still can't see the light
Here it is : I want to adress a serial interface to communicate with a car
this is a project I already built on PC that works great
it uses a KL (VAGCOM) interface
these interfaces comes in serial or USB (actually the same with a FTDI chip)
so now, how can I do this with that green robot ?

I tried the USB way, it looks like a dead end because most (cheap) devices don't do host mode
so would Bluetooth be the way to go ? or will it be the same story here ?
also, any suggestion on a cheap RS232/Bluetooth thingie ? I found some like this one :
BlueSnap Bluetooth RS-232 Dongles
but snap, these are not cheap...

I hope I have been clear enough and that someone can help...

well that's it (for now) guys, thanks a lot in advance for your help !

:)
 

Zdroid

Member
Licensed User
Longtime User
thx for your answer
this is very encouraging !
the vagcom devices are also 9.6k
I did read (in diagonal, honestly) the topic you link to
would you / could you share some sources ?

is it crazy to think about USB via bluetooth ?
I tried to search about it but queries get polluted by the thousands of USB bluetooth dongles...
I see the bluesnap also have USB capacities but again, I'm afraid it would hit the "host mode" wall...or would it ? I'm in Lost island there.
 
Upvote 0

raphaelcno

Active Member
Licensed User
Longtime User
Actually the basis of the code is in the Bluetooth tutorial.

You will probably put some buttons on the layout, and each button will send the appropriate command with AStream.Write(MsgToSend.GetBytes("ISO-8859-1")) or AStream.Write(Conv.HexToBytes(MsgToSendHex)).

Then you have to complete the AStream_NewData Sub in order to check that the received data has the expected length/synthax, and you convert the bytes to "human understandable" data (text or decimal values) before showing them on the screen.
What kind of data you receive and how you want to show them on the screen will vary from application to application.

You will also find many posts if you type "serial" or "bluetooth" in the Search field.
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
ZDroid,
this is my real fight these days because I am working on a project where the heart of it is serial communication.
Now my plan is to use a bluetooth module (a tiny pcb), plug it in another tiny RF radio pcb (500m range), and put the two in a tiny box, so Boss can see it the perfect solution that I came up with. But I think this problem can only be solved by Erel when he manages to provide us with a new Comm4Dummies view that
effortlessly interfaces B4A with H/W IO devices through the phone's USB port.
 
Last edited:
Upvote 0

Zdroid

Member
Licensed User
Longtime User
Raphael, thanks for the answer
I am going to look into it
I plan to use this :
https://serialio.com//store/product...ucts_id=643&osCsid=tipr0tl696pt8h1sopaq75pcu6
I will have my electronics buddy build up a power supply from 12V and wire up the RS232 side, 45$ ain't too bad for a test mule

Beja, I'm not sure I understand what you mean but I don't think Erel can do anything about the devices wich can't handle USB Host...? software can't overcome hardware or system limitations, right ?
and as for plugging bluetooth into a radio module, I don't think you can do that ? maybe you mean antenna signal amplifying ? I thought about this too because it could be cool to get the infos from the car at the pit but it looked chancy at best...but if you have good ideas about this, I'm listening !
 
Upvote 0

Beja

Expert
Licensed User
Longtime User
ZDroid,
It is straightforward thing to do that, may be I didn't explain it enough.
I will do this when I go back to China next week, because there are plenty of
off-the-shelf and cheap to ground bluetooth modules.
these are small PCBs used to interface bluetooth devices, such as smartphones to the real world. they interface with bluetooth comm to the device side, and
with standard serial port (rs232/rs485), USB or TTL, to your external hardware
or microcontroller bus. and it does this completely transparently. What I will do
then is to connect my radio module to the serial port of this serial/bluetooth
module.. this way I will have longer distance and also the ability to talk to
devices that have no bluetooth.
(you may call the module bluetooth to serial adapter).

Erel will not touch the hardware.. I thought since Android OS and devices are
already using USB to connect to PCs, then may be Erel could somehow be
able to wrap the existing functions or APIs to be used as B4A library and free
us to connect to any MCU device.
 
Upvote 0
Top