How can i communicate Android device with using com port? - android

I am working on Android project using Qt and i need to communicate between mobile phone and computer. I want to make little demo with using Putty.I want to send data mobile phone over USB cable and display on Putty to ensure communication. When i search Serial port on mobile phone const QList<QSerialPortInfo> &info = QSerialPortInfo::availablePorts(); info.count() is equal zero. Application can not find any serial port on mobile phone but i can send or receive data (drag and drop) over USB cable. How can i communicate to Android device with using Serial Port?
Thank you for answers..

Not many mobile phones that come with a native serial port as far as I know.
If what you mean is you have a USB serial port connected to your mobile phone through an OTG cable maybe you need to take a look here. There is also an app on the Play Store based on the same code.

I have discovered what i did wrong. The phone does not support OTG feature, so i could not see serial port by using qt serialport library. If anyone faces this problem, i hope this works for him/her.

Related

Sending serial data from android to a PICAXE microcontroller with usb cable

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

How to deploy arduino ide code to Android app?

I want to make my arduino UNO pin 13 to be high when user clicks on button. I have used arduino blink template .program runs fine from my computer. But I want this program to work on Android phones too. Is there any way to do this?
Thanks in advance
It is not possible this way. You can't run arduino code on Android, However you can code android app to communicate with arduino through USB or Bluetooth.
To do this you will need arduino shield, or USB OTG cable and USB TTL converter.
In my app I use usb, so here is basic example what you have to do:
Download some serial usb library, I use this one:
http://felhr85.net/2014/11/11/usbserial-a-serial-port-driver-library-for-android-v2-0/
You need android device that supports USB OTG and USB OTG cable.
Connect USB to ttl converter using usb otg to android
Connect usb to ttl converter to arduinos serial port(must be hardware serial and must connect GNDs).
Run the app and send some data.
Receive data on arduino and do your action
Edit://
It is probably easier to do with some arduino shield designed to communicate with Android, however I didn't use such shield, because I needed qucik and cheap solution.

How to communicate via modbus RTU on android through micro USB port?

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!

Connect two android devices via USB

I'm trying to figure out how to connect two Android powered devices,
namely a smartphone (Android 4.1.2) and an android developer
board (Android 4.0.4) with apps running on each, via USB and get them
to communicate with each other.
Right now the developer board is running as the host and the phone as
an accessory. The hosts app is searching for connected devices and is
able to identify the phone as a device, but the app running on the
phone isn't able to find the host.
I've searched the web for quite a while now (!!) but I didn't come
up with anything helpful yet that solved my problem.
For my project it is crucial that I use an USB connection, so please
don't propose that I use bluetooth, WiFi, or anything else...
Regards
USB is host initiated, so it's not surprising that this is not working. Your device that is functioning as the USB device should respond to requests initiated from the USB host. You will probably have to create some sort of vendor specific protocol around this. I don't know what you are trying to do with this connection, but if the device needs to know things on the host you will need to bake this in to your protocol definition and send that information directly to the device.
What you could try doing is using both devices as a host and connecting a USB to UART bridge device between them, then you can transmit data generically in any direction by using the serial connection (through USBManager if the USB protocol is available, or some Android Java Serial class if it is not), plus you don't have to worry about the host-device connection. This would look something like this:
[Android 4.1.2 Device]<--USB Connection-->[USB to UART Bridge]<--Serial Connection-->[USB to UART Bridge]<--USB Connection-->[Android 4.0.4 Device].
Use OTG Cable to interact with your board and phone. Its easily available in the market.

Bluetooth serial connection between Android and Ubuntu

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.

Categories

Resources