I have a MR400s taximeter hardware. I want to communicate with this taximeter using RS232 cable and I have already achieved this connection and communication in windows. But I wanted to make connection using android device.
How can I achieve this?
Thanks
Ishan jain
I use the USB to serial library, you can find it here: USB Serial for Android.
It doesn't require any root access. You'll need to check if your Android device supports USB host mode. Then, using a usb OTG cable and a USB to serial adapter cable you can start communicating with your serial device via RS232. There are code examples to get you started on the Github page of the USB to Serial library.
An alternative to a cable connection to the Android device (using the "USB Serial for Android" library, see the other answer) is a converter from RS232 to Bluetooth.
Such a converter will use the serial connection profile of Bluetooth, and ways access such a connection in Android are discussed in this question.
You can build such a converter based on an Arduino by adding a Bluetooth shield and simple code that converts incoming data from the serial port to outgoing data on the Bluetooth connection. (I could not find detailed instructions for this right now.) When you want to connect the Arduino's serial port to a RS232 device you would need another shield for logic level conversion (RS232 is ±12 V, Arduino is 5 V or 3.3 V).
There is also a commercial product implementing this Photologic Text Streamer (ca. 265 USD !!!). It seems that this provides a read-only connection for Android (not totally sure about that, though). A read-only connection is still ok for cases where you only want to read sensor values.
Finally, you could do a similar thing using an Arduino and a wifi shield.
Related
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.
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!
Using Arduino I can get the sensor values logged into the serial monitor over the USB cable...
Is there any way that I can read these values directly on an android tablet by connecting a usb convertor(So that I can tramnsmitt it via GPRS to a server Db)...Please give my some solid directions...
You can do it wired if you use a FT232 or CP2102 converter. Here are a couple apps on the Google Play store that act as a serial monitor.
USB Serial Terminal
Slick USB Serial Terminal
One thing to note is that wired USB communication with Android is not very common, so you may run into some problems depending on the phone you are using. If you want a more guaranteed solution, look into an Arduino Bluetooth module that supports SPP - Serial Port Profile. You can connect the Arduino's RX/TX pins to the Bluetooth module, and have it communicate with the Android device over a wireless Bluetooth serial connection.
Also, here is a similar question on SO, however the answer may have outdated information regarding using the wired solution.
How to make Android and Arduino communicate without a wireless module
i'm trying to communicate with Arduino board (Duemilanove) from Android 3.1 device with USB-host support using Android USB Host API.
The goal is to communicate with the board in the same way as via Serial.
I follow this manual (http://android.serverbox.ch/?p=427) but have few problems (f.e. failed to claim interface) and of coarse dev guide (http://developer.android.com/reference/android/hardware/usb/package-summary.html) but no luck.
The questions are:
how to prepare arduino board (modify firmware) - interruptions or smth?
how to check if it's okay with arduino board (f.e. enumerate USB interfaces and verify that it supports needed. what tools can be used?
how to find needed interface (what are interface class/protocol/subclass)
what can be the reason when interface cannot be claimed? (faced with that)
The arduino Duemilanove board has only a build in FTDI FT232RL USB serial converter. So you don't have to deal with the USB device side. From the AVR controller point of view it is simply an asynchronous serial port. Find out to which UART it is connected to and use it. Maybe you want to implement a simple echo (transmit all received characters again) as a first test.
Use lsusb command under linux to check out the usb device descriptor.
Read about USB in USB in a nutshell or in the official specification to find out how it works (especially chapter 9). Without doing so you can't go on. You would not understand anything.
Then go on and read about CDC class devices in the usb class section.
It might not exist (if you rely on the interface index without checking the device descriptor) or the android kernel has claimed the interface because there is a native driver for that interface. In this case you can call UsbDeviceConnection.claimInterface with true as second argument to disconnect the kernel driver first.
I am doing my final year project and am facing a problem to send data through a mobile device (android) to a AUBTM-23 bluetooth module, which has a RS232 port something similar to this one, which is conected to a 8051 controller serially.
When I try connecting the module to PC and send data from mobile, the data is properly read in hyperterminal with following information:
OK
+CON1:1
data received from mobile device
+DCON:1
OK
+CON1:1-->received when mobile app tries connection with module.
Then the serial data gets transferred, then when the app disconnects I get DCON.
But when I use it with 8051, there is no data transfer.
I searched and found that module is programmed to send these tags(CON, DCON, OK) and also it is designed to be embedded in a host system (which i think 8051 is not) which requires cable replacement function.
SO, is it possible to connect the module to 8051 controller?
does a serial port really requires a host?
Can I make any arrangement for the extra tags (CON, DCON, OK)?
And to connect rs232 port serially, i am making use of only 3 pins and leaving the remaining 6 pins unconnected, could that be a problem?
You can use 8051, UART , just write code for sending AT commands check those on hyperterminal whether they woring or not .. then connect TX RX of 8051 to RX Tx of ur module. Be careful to add a voltage divider with 10kand 15k resistors between Rx line of Module,as it should receive only 3.3 v and max232 will output 5v.
It will work...
8051 can be used as a host for the AUBTM-23
There are several conditions that could be causing problems and additional information is necessary to correctly diagnose and troubleshoot them. That being said, the following information might be of some assistance.
You might need a MAX232 (or other TTL to RS232 level converter) between the 8051 UART pins and the RS232 port on the AUBTM-23 device. Otherwise, you may† be able to bypass the RS232 port and connect the appropriate 8051 UART pins directly to the UART pins on the AUBTM-23 chip. † note that this option depends on the voltages used by both chips and additional circuitry (e.g. level shifter) may be required
The AUBTM-23 datasheet says that flow control can be either RTS/CTS or None and is configured during factory calibration. When you connected the AUBTM-23 to HyperTerminal, what type of flow control was used?
If your AUBTM-23 device uses RTS/CTS (hardware) flow control, you should connect the the RTS and CTS lines to available port pins on the 8051 and add the appropriate code to handle the handshaking.
If your AUBTM-23 device does not use flow control, you should be able to use a minimal 3-wire (TX, RX, GND) RS232 connection.