Read data from an Android USB attachment - android

Is there anyway to read data from an attachment through the USB port on an Android device? In particular, an EKG. Most the work can be done by the hardware of the device to simplify the output to a single number, a voltage reading. If its not possible, what about modifying an accessory that can already communicate with an android device? Thinking of devices that attach to android phones, what about sending the data as an audio signal to be read as the microphone from a headset and then analyzing the audio signal to convert it to a number that can be used to display a value.
Any ideas on how to make this work?

The Android handset can't be used as a "USB Host" (it's in the google android wishlist as a bug/enhancement request). That's what you'd need to connect regular USB devices like your EKG monitor and memory card readers, etc. to it. I wish it could do this too and star'd that enhancement to vote for it...

I'm not sure if this will work for you, but here's something I did recently for a project where I needed a smartphone to communicate with a host PC.
I used ADB on the PC to do port forwarding and then I used sockets to do the communication. Server socket on the phone, client on the PC. I can give you more details if you want.
Of course, the clear requirement here is to be able to install and execute code on the "device" which I don't think is applicable to your problem. Other than that, I found no other way to communicate over a USB connection through Android.

Related

How see data on bluetooth?

I have created an an app on my android, it connect to my PC with bluetooth, this app send data via bluetooth.
How can I see this received data on my pc?
I use dont use a plug module on my pc it's the incorporate bluetooth, so he dont have a serial port
I have try find on google but all speak of transfered file.
Probably the easiest way would be to open up a terminal on the PC that has an open connection to the appropriate COMM port (physical or virtual). If you have this connection open you can then see any data that comes in and accordingly can send data back out.
Basically, on either end you have a bluetooth connection. That is a replacement for a cable in essence. Assuming you are using a serial port profile this will allow bytes of data to be sent back and forth over Bluetooth. I believe you are at that stage.
The port on your PC receives the data but has no means of displaying it. An application such as 'SERIAL' for Mac OS, HyperTerminal or similar for Windows will be what you need to see the data.
Hope this helps. Good luck.
(Another way would be to write an application that interfaces to the serial port on your PC but, I wouldn't think that would be worth your while... the terminal application is what you need) :)
This website has a list of useful applications that will help you.
http://www.usconverters.com/index.php?main_page=page&id=15&zenid=4835fe9edad4ba7966f4cf6533711315

Android communication to external modem

I new to Android embedded technology. I am working on Android device to external modem communication.
There will a external modem connected to Android device with USB.
now need to run modem command on external modem using Android application.
Should i start with http://code.google.com/p/usb-serial-for-android/ or http://source.android.com/accessories/index.html. Is there any other way to achieve it.
Please let me know your comments based that i will go forward.
Thank you.
I work in a project to make a telephone caller blocker using old 56k serial modem connected to an Android TV stick using an usb to serial adapter. I use USb terminal apk to senh Hayes AT commands to the modem, and it works flawlessly. I can configure the modem with AT#CID=1 to retrieve caller id data. The final process must include a self config part to make the modem act as caller id, a database part, that stores calls and compares with black and white list numbers, and a on hook modem command to block the call. I think that a very beginner android developer can reach it easy, but I have no ability in android. In arduino, I have made the same system working flawlessly.

Send file to computer system using USB

I have such requirement in which i have to transfer file on computer system, lets consider windows PC.
What i want to do is i have one screen with specific details,i am writing that values in one text file, now if user clicks on button then that file must be copied to computer at specific location using USB.
I have tried to search about this but didn't get anything useful.I've also refer below link
http://developer.android.com/guide/topics/connectivity/usb/host.html
Is it possible in Android, how do i communicate with windows system ?
Regards
UPDATE :
I am able sopy files to Computer using adb
./adb -s emulator-5554 pull /sdcard/juned.jpg /root/juned/android_usb/
but can i do same thing from android application ?
I think your question is not very specific to be answered. But to explain a bit consider the following:
you have to turn your android device in USB host mode so that it enumerates connected USB devices
establish a connection to your receiving device. Probably this is going to be a storage or drive with a known configuration of endpoints
when established, use a function like bulkTransfer(UsbEndpoint endpoint, byte[] buffer, int offset, int length, int timeout), which is documented as well in the link you provided. Keep in mind to choose the correct endpoint (direction TO your storage / drive)
This is just a sketch to get you started. It's clear that there is a lot more to do..
USB is probably not very suitable for what you want to do.
USB is asymmetrical, that is, a USB connection has a host at one end and a peripheral device at the other end. (For example, when you plug a USB stick into a PC, the PC is the host and the stick is the peripheral.) The host initiates and controls data transfers.
An Android phone generally acts as a peripheral device. As of Android 3.1, the phone can also act as a USB host, though not all phones support this.
In order to accomplish what you have in mind, the PC would need to run a piece of software that changes it from host mode to peripheral mode, and exposes some kind of storage that the Android device could then write to.
Maybe Bluetooth is a better option for you. You could just initiate a file transfer over Bluetooth as soon as the file changes. Inexpensive USB Bluetooth dongles are available for PCs without Bluetooth support. You might still need some software on your PC if you want to automatically accept the file transfer request on the PC.

Sending commands from a PC to an Android phone - via physical connection (USB, Serial, etc)

I'm working on a project to automate some tasks (such as play a song, play a video, receive bluetooth data, etc) on an Android phone from a PC.
Basically the PC will send a notifier to the phone and an app or something on the phone would then process the notifier and do 'something'. The opposite of this really:
http://code.google.com/p/android-notifier/
I've seen some examples showing how to send commands to an Android listener app or service via a network connection, but in this case, I would much rather the transmission be over a physical connection.
USB
Ideally, I'd like the connection to be via the USB port. But I've seen some posts online that suggest that the SDK does not natively support this. (Android apps, communicating with a device plugged in the USB port).
Is there some other SDK/API out there that makes this easier?
I've seen some posts on the ADB, but don't really get it... Would that work?
(http://developer.android.com/guide/developing/tools/adb.html)
Serial over USB
I've also seen some sites that show how to use a breakoutbox to perform bi-directional serial communication, but only with the G1. Is this possible with newer phones?
The Phone
I'm open to really any newish phone. I'm currently looking at the Galaxy S, because it has the video out through the headphone jack. I'm open to rooting if need be.
Implement a HTTP server in your app, then put your phone in USB Tether mode. This will create a local network between your phone and your PC. You should then be able to send HTTP request or create websockets using the phone's ip.
EDIT : I tested it, and it works, see here
What you can do is the phone acting as a server and then use adb to forward ports [1].
In this scenario the pc app would connect to localhost which would be redirected to the app on the phone via the usb cable.
But if you go this way, you might just as well simply connect directly to the phone's ip (without the adb port forwarding)...
[1] http://developer.android.com/guide/developing/tools/adb.html#forwardports

How to get GPS data from Android phone?

Is there a method to tether (USB wired) the GPS data from and Android phone to PC? I am using a GPSTether app currently that is based on the gpsd project.
I am loooking for alternatives that give more control and is less buggy than that app. Also, is there another method of doing this without using any third party apps?
I am working on a location aware software project and want to read the GPS data periodically. The GPSTether app does exactly that on a TCP port over telnet.
The ideal situation here would be to have a serial port over USB connection between your Android phone and your PC, and to stream NMEA across it from the phone. Unfortunately Android doesn't support USB in such a way natively.
GPSTether is a "hack" using the adb forwarding debug bridge in order to create the link between phone and PC, and then reads the NMEA from the location manager and sends it over the TCP/IP link created by adb forwarding.
If you are finding GPSTether too buggy, you really only have two choices either a) implement a version of GPSTether yourself, or b) come up with a different method for doing this. Both will involve quite a bit of coding.
For b), you might want to consider - writing NMEA to a file on the phone while it is connected to the PC as a USB Mass Storage device, and reading updates to the file from the PC regularly.
Or perhaps you could get a bluetooth dongle for your PC and "tether" the phone to the PC over bluetooth, by creating a bluetooth COM port connection for the GPS using something like the Android app BlueNMEA.
Or you could copy an FTP client program, and write the file to an FTP server on your PC over a WiFi connection (which would allow you to have the phone on the other side of the world from the PC).
This can be done using ShareGPS App available in Google Play Market and Franson GPSgate Client. You will have to redirect the android GPS NMEA signal to COM ports using these tools. In addition you will require to download AndroidSDK manager.
For detailed instruction see link below.:
http://sharedroid.jillybunch.com/user.html
Use Blue-NMEA http://max.kellermann.name/projects/blue-nmea/ on your android to send GPS NMEA data on bluetooth or on a local tcp server which can be accessed on PC by usb tethering or on WI-FI connection.
use VSPE (virtual serial port emulator) by eterlogic http://www.eterlogic.com/Products.VSPE.html (look for ur version of windows) and redirect data from tcp port to a com port of your choice and u r done with the settings. now configure 'google earth' ,'see you', 'GPSdata logger' or any other soft to listen to this com port which oftenly they will do by themselves.
http://max.kellermann.name/projects/blue-nmea/
sends nmea via bt com port or on a tcp port. make sure you read the readme to avoid common obstacles.
This is really late, but I have an old LG-P350 and on device manager it shows an NMEA interface. I don't really know how to use it though.

Categories

Resources