Is there some way I can send data from an Android device to a computer over Bluetooth?
Thanks
Yes. Perhaps the most straightforward way to get started would be to use the Bluetooth Chat example, which you will hopefully find in the Samples directory of your SDK installation, or can of course be downloaded from Google.
The Bluetooth Chat demonstrates exchanging bytes of data from one Android device to another over the Bluetooth Serial Port Profile (SPP).
To exchange data between the Android device and your computer, you could use a Bluetooth driver on your computer that provides you with a virtual COM port when a remote Bluetooth SPP device connects. This way, you could simply launch Bluetooth Chat on your Android device, and exchange data with something that reads and writes to a COM port on your computer. For example, on a Windows machine you could simply use HyperTerminal.
The Bluetooth Chat example is then an excellent base upon which to create your own custom Bluetooth Android application.
Related
I am working on a project that including an android phone that sends simple serial messages to a picaxe microcontroller(14m2) like '1','2','a' etc.
I searched alot on the web, and I only found a way that the android smartphone first "connecting" to the device and "discover" it, the problem is that PICAXE microcontroller is NOT a 'USB' device, and it can't be discoverd by the android, that means the android will not be able to send serial messages to the PICAXE.
if theres any way to send simple pulses from android to PICAXE, please let me know about it.
EDIT: There's any way to do that by connecting the AXE027 download cable with OTG?
I do some project with communicating over serial port. You can use chineese bluetooth adapters (see on ebay arduino bluetooth), those communicate with controllers via Usart and connect to phone by bluetooth. There is sample project Bluetooth chat from google about how to use bluetooth on android. On hardware iside, you can use arduino for receiving data by bluetooth and converting it in format of your controller. You wont have to use any wires
For the project i am working on i have a slave device that communicates using modbus protocol. All i need to do is be able to read the holding registers on the device via modbus RTU. The device has an RS485 output. I have already purchased an RS485 to usb converter cable that include an FTDI chip. And also a usb to micro usb cable to connect that to the tablet. So far i have been able to write a simple java program in netbeans to connect through the usb port on my laptop and read data from the holding registers on the device. So i do not have a problem with communicating with modbus.
The problem i am having is with sending the modbus communication through the micro usb port. My tablet is set up as a host, and i have been able to recognize that a device is attached. I am also able to connect to the port that the device is attached to. Im just getting very confused on how to use the micro usb protocol to send modbus communication over. The code i have for modbus on my laptop just needs a port number to communicate through, but i dont think it is that simple with an android tablet. I have been going through this http://developer.android.com/guide/topics/connectivity/usb/host.html and understand for the most part what is going on, but i cant figure out how to use this information to send modbus communication over. any help would be great!
I'm working on an Android application and I have to make a Bluetooth serial communication between an Android device and a Computer with Ubuntu OS. I don't know what to do and how to connect them. I'm looking for good references and someone who can help me.
I made a button which navigates to the Bluetooth settings of our Android device. I don't know what else I should do.
Pair the devices. This has nothing to do with any software, so it has to be done via the phone settings
Once paired, look at 'Bluetooth Chat' example by Google. It has drop in code for connecting two devices. A serial connection is done via Serial Port Profile that is established over RFCOMM. The UUID for SPP is well known, again, you'll find it in the Bluetooth Chat example.
I am working with the Android Bluetooth Chat sample application. I am trying to read serial data from the Android device in Windows 7.
I have been able to pair the Android device to the Bluetooth adapter on my laptop. I replaced the UUID in the sample application with the following per some other discussions:
private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
When I run the Android application I am able to connect to the laptop. In the "Hardware" properties of my Android device there is a "Device Function" entry called "Standards Serial over Bluetooth link (COM10)". When I attempt to connect CoolTerm to COM10 I receive "error 1168" (there is no additional description for the error).
Am I misunderstanding something about the process of sending serial data via Bluetooth to a Windows com port?
Be sure that you are selecting the correct COM. In my last Android application that required SPP (Serial Port Profile) Bluetooth communication, when Windows 7 paired I had several COM's open up.
If COM10 is not working, verify that it is the "incoming" COM (or maybe it's outgoing, I can't remember b/c it's been a few months).
You have to use the proper Bluetooth API from your Windows application to call and connect to your Android device, that is:
do an 'Inquiry' of all nearby devices, discoverable and exposing an SPP service/profile (SPP=Serial Profile Protocole). This profile has the aforementioned GUID {00001101-0000-1000-8000-00805F9B34FB}
once all found, select the one you're searching for (either by Name or MacAdress)
at this point, you can do a 'Discovery' of its Services and check out that it has the proper service exposed (SPP or RFCOMM)
then connect to it, using the Bluetooth socket API...
I need to use Bluetooth for communication with another application which sends data via bluetooth SPP profile. I use the Bluetooth Chat app from Android developer site. I am using real phone (HTC Desire) as there is no Bluetooth API in Android emulator. I use a BlueSoleil bluetooth dongle.
When the other application tries to connect to my phone via Bluetooth and send data via SPP, it is not possible to connect the phone to the application. So I tried Windows Hyperterminal to send data and connect the phone through the dongle. In this situation, I can receive the data and display on the phone.
I would like to know how to find out which bluetooth profile was used when communicating with Hyperterminal.
I have read that bluetooth stack has a buggy implementation in HTC Desire and the SPP profile doesn't work consistently always.
Appreciate any suggestion and time spent on this.
Cheers,
Madhu Nandan
In the case of your Hyperterminal communication - SPP profile that was most likely used.
SPP profile is a generic profile that just establishes the RFCOMM data channel and sets up a virual COM port for applications to open and connect to and send data.
SPP does not specify any data formats or application level communication protocol to be used by application.
So applications at both end should establish the required format/protocol for communication.
Applications sets it selfs up on a virtual COM (over SPP) and advertises itself (on SDP) via a unique UUID (And Service Names)
So I would suggest that you use the chat application as a starting point, and start with connection / reading data etc, then modify it and complete the application that talks to your application on the device.
(The chat example is meant to work with a remote chat of the same type and is not a generic usage for SPP profile application)
Hope this helps you.