Serial Data Transfer via Bluetooth

by AnthonyB » Wed, 17 Mar 2010 04:18:43 GMT

Sponsored Links
 I'm trying to get serial data from a USB Weather Board from Sparkfun
Electronics using one of their SPP Bluetooth Modems.  This device will
be able to send serial data over bluetooth and all I wan't to do is
read and store the data.  I'm pretty sure this is possible but I'm
still not great at writing code for an android device yet. After that
I want to take that data and put it into a human-readable way for
instance for temperature have ("Temperature= 70F"). The value of 70
will come from the serial ascii string of bytes and I'll probably be
able to work with the data after I get it and save it.  So can anyone
give me a little bit of code on how to read and store the ascii string
or give me a good example to look at?  Also the string is 46 bytes and
starts with a # sign and ends with a $ sign and I'd like to use that
to make sure I just get one string of data.  Any help or insight would
be greatly appreciated.



Serial Data Transfer via Bluetooth

by DonFrench » Wed, 17 Mar 2010 09:27:06 GMT

 Look at the Bluetooth Chat example and change the UUID to
"00001101-0000-1000-8000-00805F9B34FB".  That should get you going.


Sponsored Links

Serial Data Transfer via Bluetooth

by BobG » Thu, 18 Mar 2010 03:05:43 GMT

 Hi Don. I think you need 2.0 or higher to run the bluetooth chat
example.. wish it wasnt so... I have a dev phone 2 (Google Ion? Does
it have other names? HTC something? TI something?) with 1.6. Someone
know how to use the bt backport examples? What dir do I put the jar
file in?


Serial Data Transfer via Bluetooth

by DonFrench » Thu, 18 Mar 2010 06:14:21 GMT

 Then we are out of my comfort zone.  You might check this site though,  According to 
Bonifaz Kaufmann, the developer of Amarino, they are communicating via
Bluetooth SPP with   the following devices, all pre 2.0.

    * HTC Dream (aka T-Mobile G1, firmware 1.1, 1.5 and 1.6)
    * HTC Magic (firmware 1.5 and 1.6)
    * HTC Tattoo (firmware 1.6)
    * Huawei U8220 (aka T-Mobile Pulse, firmware 1.5)
    * (partially tested) Samsung Galaxy (firmware 1.5)

You can find the entire source code of Amarino here: 
and it includes all the Bluetooth related stuff as well.  Good luck.


Serial Data Transfer via Bluetooth

by Ben » Fri, 19 Mar 2010 05:43:37 GMT

 I've attempted to use the unofficial Bluetooth API for 1.6, got
through finding the adapter and the remote device, but could not open
an RFCOMM socket.  You should be able to put the Jar anywhere as long
as Eclipse--if that is what you are developing on--points to it.
There are instructions on how to external libraries on the android
developer site: 

Though google advises against using these to future proof your app.


Serial Data Transfer via Bluetooth

by Lovers v. Haters » Fri, 19 Mar 2010 05:44:56 GMT

 I agree-- Amarino is pretty useful.  I'm doing a project that uses
Amarino to transmit strings of data over XMPP.  (Google put the kibosh
on making your own jabber client, but I found a useful JAR to get
around it.)  Put Amarino together with XMPP and your device becomes a
great transmitter for broadcasting microcontroler status anywhere

If you're interested in going that route, check out (in addition to
1) Asmack (Jabber hack for 1.5 and 1.6-- not sure about 2.0) 
2) ChatStar (which I wrote cobbling Amarino and Asmack together) 

Harlo/Lovers v. Haters


Serial Data Transfer via Bluetooth

by BobG » Sun, 21 Mar 2010 03:00:45 GMT

 Thanks Ben... your message was the clue I needed... I put the backport
jar file in a dir in the package, went to the package properties and
added the jar under 'link external jars', and the bt chat compiled
right up. Lots of details need to be right to get this stuff to work,


Serial Data Transfer via Bluetooth

by Ben » Sun, 21 Mar 2010 23:25:15 GMT

 No problem Bob.  Let me know if you are able to open an RFCOMM socket
it never worked for me.  I checked the Amarino source code, and it
looks like I am doing basically the same thing that they are, but for
some reason they can get it open and I can't.  So for now I've
modified my app to use a broadcast receiver to receive data from the
amarino like the examples.  Though I don't have my Bluetooth antenna
hooked up to an Arduino, it's hooked up to a Blackfin DSP, so
hopefully there is nothing about Amarino that actually requires the
thing on the other end of the UART to be an Arduino.  Looking through
the source I can't find anything that would limit it like that, but
I'll see.


Serial Data Transfer via Bluetooth

by Shane » Sat, 27 Mar 2010 04:57:15 GMT

 Hi guys,
Im new to android and im trying to use the bluetooth backport. Could
someone explain what the step "put in to your src directory. "
means? Do i create a file and paste in the code or is there something
im missing. Ive followed the other steps and its not working for me so
i think the problem lies here.



Other Threads

1. installing Android 1.6+ on headless Linux server


I am not sure how to install Android 1.6+ on a headless Linux server.
Our continuous integration build machine is a headless server in the

Following the instructions, I downloaded android-sdk_r3-linux.tgz,
untarred it, added its location to my path, and tried to update. This
what I got:

r...@savendipity:/usr/local/share/android-sdk-linux/tools# android
update sdk

No command line parameters provided, launching UI.
See 'android --help' for operations from the command line.

Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-pi-
gtk-3550 or swt-pi-gtk in swt.library.path, java.library.path or the
jar file

+ stack trace

I don't know whether this message means that it is not possible to
update the SDK without a GUI, that my command line is wrong, or that
my environment is missing something that would allow me to install
from the command line.

Would appreciate instructions on how to install 1.6+ on a headless
linux server.

Thanks in advance for your help.



2. Can't we have multiple instances for root of a task, in the same task?

That is the normal behavior, and something you pretty much don't want to
change.  Why do you want to do this instead of having multiple instances of
an activity in the same task?


3. write to cursor?

4. Android 2.0 on HTC Magic

5. Optional permissions (revisited)

6. Pause game

7. adb cannot find my dev phone