I have developed an app that acts as a usb host reading bulk transfer packets from a usb accessory
If I want to develop unit-tests for that part of the app, is there any way to mock a usb connection and incoming data packets?
It would be very useful to automate testing of the relevant code without actually having to plug in the accessory
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
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.
I was wondering if it is possible to be able to upload data through the usb or audiojack of a phone so that it can then make a call.
Yes, however you would need to create a custom application on the phone that has access to the cellular module. The application would scan the audio jack for commands sent by the arduino and then a built in interpretor would convert the input into data that the phone can understand.
Arduino <--> Custom Application <--> Phone <--> Network
(although I would recommend using an arduino compatible cellular module to keep things simple)
Alternatively you could use a BLE shield and just have a Bluetooth interface (which would free up the usb/headphone ports on the phone at the expense of purchasing a BLE shield)
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