Conecting FTDI UM232H-B to Android tablet and receiving data - android

I am using a PCB having FTDI UM232H-B in it. I am connecting this board to the Android tablet through USB cable. I have some latches to the UM232H-B to change the inputs and I want to receive the output through USB on the Android tablet which I can't able to.
The resources I am using are :
http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_UM232H-B.pdf
http://www.ftdichip.com/Support/Documents/DataSheets/ICs/DS_FT232H.pdf
http://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_147_Java_D2xx_for_Android.pdf
http://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_134_FTDI_Android_D2XX_Driver.pdf
The official android demo application:
http://www.ftdichip.com/Support/SoftwareExamples/Android_JAVA_D2XX_Projects.htm

Finally, I could able to communicate with this IC. I followed these steps :
- Use j2xx library.
- Declare all IO buttons & LEDs.
- Initialize FT_Device object.
- Set in MPSSE Mode.
- Reset Button & LED latches.
- Run a while(true) loop inside a thread (AsyncTask) where, do Enable B/L, Setup B/L, Update B/L operations.
- Whenever a Button is pressed do FT_Device.read() and get the IO_Status and perform your specific action and again call Reset B/L immediately.
- In the meantime, all operations should be done giving some delay (For me 50ms worked just fine)

Related

How to get event for different baudrate?

I am working on native android application. In this application I am connecting hardware devices using usb cable, for this connection I used below library:
https://github.com/felHR85/UsbSerial
I have 3 different hardware devices and each device has different
baudrate.
I have one scan button in app. If user click on it then I need to
check which device is connected and print its information.
To implement this, I create 3 methods. Each method have same code
with different baudrate.
When user click on scan button then it will call 1st method and check
if the hardware is detected or not. If not detected then check with
2nd method.
Now the issue is, I am not getting any event if attached device is not connected with given baudrate. So I am not sure when I need to call 2nd method.
Note :- I am getting success if attached device baudrate is same as baudrate set in 1st method so its working. I need event like failed case. If I get any event if failed then I can call 2nd method in it but I am not getting any event like failed.

Is it possible to use an Arduino accelerometer to rotate an Android screen?

I have installed Android 4.2.2 on a ARM board, Orange Pi (A20). I have also an accelerometer based on Arduino Nano (ATMega328) to communicate with the system, via serial USB (UART).
Is a chance exist (with some work!) to make this accelerometer active to rotate the screen, and better, to play with ?
I managed to receive some datas.
1) Build cp210x.ko in the kernel, and insmod it in Android
2) With the Arduino application on Ubuntu, I have programed the chip with the example "MPU6050_raw" (from here) and adding a delay (and incidentally a sensor value)
If the delay is not set, the Orange freeze. It's the begining of my tests..
// blink LED to indicate activity
blinkState = !blinkState;
digitalWrite(LED_PIN, blinkState);
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
delay(2000); // delay in between reads for stability
}
3) On Android, with the app SerialPort_1.1.apk, set the device /dev/ttyUSB0 and the baudrate to 38400.
Here is the result:
This is a start, now I think the most difficult will be to create my app to treat theses datas...

Android - set pin for Bluetooth

I have been reading the Bluetooth documentation on Android's developer site.
I want to pair a Bluetooth device and then connect to it, but I don't want the request dialog to pop up (or even if it does set the pin using some API to dismiss it). I want to do it in Android 4.3+.
So far I see this involving the following steps:
1) App discovers device : use BroadcastReceiver to get BluetoothDevice
2) App pairs the device : uses BluetoothDevice.createBond(), and registers a BroadcastReceiver to get confirmation of pairing completion
3) App connects to device : uses BluetoothDevice.createRfCommSocketToServiceRecord(UUID)
My understanding is that the pop dialog for pairing will be shown to the user after step 2.
I know there is a setPin() API (now public) in the BluetoothDevice class.
If I call it right after step 2, will the dialog still appear and wait for user input, or will it appear and then dismiss, resulting in pairing success ?
Also does step 3 involve any input from the user ?
Step 3 doesn't involve user input.
I've been trying to do exactly the same, I use setPin() and it works, but the user Input dialogue is still there, there is an option to use cancelPairingUserInput but i'm not sure if this is still valid for API19 (that is the one which uses setPin() as far as I know...) or if there is another way to do it.
Hope this helps...

Reading the values from OBD II Bluetooth adapter in the android application

Can anyone give me an idea on how to read the values from the OBD II Bluetooth adapter in an android application.
I want to start with scanning for the bluetooth devices from my android application, then after bluetooth device is found, how would I interact with it and get the values from it?
You should start by reading this http://developer.android.com/guide/topics/wireless/bluetooth.html
it contains step by step procedure .
add required permissions,
make a bt adapter,
then find paired/unpaired devices
I used the BluetoothChat Application and was able to get some basic communications, I am not moving into data logging. You can use this application to have a sort of instant messenger conversation with your ECM.
What particular dongle are you using?
Do you know what protocols are in use within your vehicle?
Download the BluetoothChat sample application -
They will have already handled the intricacies of the connection for you, you will have to change the UUID in order to connect with your device - 00001101-0000-1000-8000-00805F9B34FB
Read up on your particular dongle, some require the return character to be sentat the end of every command "\r"
This should get you started!
Once you have made the Bluetooth connection using the android bluetooth api, use the transport to send and receive data via the Bluetooth channel.
This is new developer resource document:
https://developer.android.com/guide/topics/connectivity/bluetooth.html
The general workflow of the application functionality should go like this:
1) connect to the OBDII adapter through Bluetooth;
2) initialize OBDII adapter with AT commands;
3) continuously get data from the vehicle through issuing the corresponding PID codes.
This article also may be helpful.
http://blog.lemberg.co.uk/how-guide-obdii-reader-app-development

Bluetooth control signals (DTR, DSR, RTS, CTS) on Android

I would like to remotely reprogram my Arduino via Android over Bluetooth SPP. The first step is to reset the ATMEGA microcontroller. This is accomplished on the Arduino by toggling the DTR line. Is there any API to control the Bluetooth SPP control lines from the Android environment?
Also it is supported by SPP in general to send or receive the control signals (DTR, DSR, RTS, CTS) I do not know any API or library for android right know, but as you just want to reset your controller...
If it is o.k. for you to change your firmware you can also create your own reset-command that can be received on your UART (over SPP).
If you receive that command you could call something like
asm("jmp 0x3800");
where you have to modify the jmp-address to point to your bootloader.
You also might want to change your interrupt vector to point to your bootloader.
Or enable your watchdog and call
while(1);
This will also automatically change the interrupt vector to the bootloader's interrupt vector and reset all SFRs. - But it is a little bit slower and the bootloader's interrupt vector must be choosen in the Fuse Bits.
I realise that this is not what you wanted, but you could always flash a new bootloader with a longer timeout and manually press the reset button before starting programming.
The new Arduino bootloader (optiboot) fits in 512B (versus the 2K of the old one) so you have extra space available to your projects; has smart boot detection, so it only enters the bootloader when the reset button is pressed; and you can extend the timeout by editing the watchdog timeout value in the source (around line 267 in optiboot.c).
// Set up watchdog to trigger after 500ms (changed to 2s!)
watchdogConfig(WATCHDOG_2S);

Categories

Resources