Android apps via OTG cable, Dongle, and D2xx library

edited February 2015 in Software
I would like to connect a 32 bit-OBCI with Google Nexus 5 through OBCI Dongle plugged-in an USB OTG adapter.

Can anyone please let me know some necessary steps to work ?

I am thinking of 2 steps. First is to get an Android FTDI driver to communicate my OBCI Dongle with my Nexus 5 via VCP. Second is to get an Android App to control my 32bit-OBCI board by sending ASCII character commands via wireless serial connection.

Comments

  • wjcroftwjcroft Mount Shasta, CA
    edited January 2015
    Bh, hi.

    You've likely already found these, but this is what came up for me,

    With Processing you could possibly use pieces of the OPENBCI_GUI. And if you had a tablet instead of a phone, perhaps the entire GUI could be adapted to run there with some screen layout changes.

    https://www.google.com/search?q=processing+sketch+on+android

    FTDI has a slew of tech notes and white papers, all linked from their Android page,

    http://www.ftdichip.com/Android.htm
    http://www.ftdichip.com/Support/Documents/White_Papers/WP_001_Connecting_ Peripherals_to_an_Android_ Platform.pdf
    http://www.ftdichip.com/Support/Documents/TechnicalNotes/TN_132_Adding_FTDI_Devices_VCP_Driver_Support_to_Android.pdf


    Another option might be to work with @jarek , the BioEra creator. He supports Android, OTG, and OpenBCI. In that case the FTDI VCP driver is already included when you load his app.

    http://bioera.net/android.html

    Keep us posted on your progress, sounds like a great project! What kind of app are you looking to develop?

    William


  • BioEra does support some USB (not wireless) ftdi devices which can be connected to Android over OTG. So yes, this would likely also work for OpenBCI, but since OpenBCI can do also Bluetooth, then in my opinion this is a better option.

    Bluetooth is on almost all Android devices. The problem with OTG is that it is only available on some Android tablets and even fewer phones. When you try to use it on a tablet which doesn't support OTG, you will not get any error message, the device will just not be available like it wasn't connected at all. So it could be quite confusing sometimes.

    I will work on supporting OpenBCI in BioEra on Android as soon as the Bluetooth communication is possible.
  • wjcroftwjcroft Mount Shasta, CA
    Jarek, thanks.

    What kind of data rates are you seeing over the mobile Bluetooth links, in terms of bps or numbers of EEG channels?

    The RFduino's (Nordic's nRF51822 SOC with RF Digital's Arduino environment) -- only do two types of radio link: Bluetooth Low Energy, OR Nordic's proprietary Gazelle protocol. The latter is what powers the current dongle and is capable of sufficient bandwidth for 8 or 16 channels.

    BLE data rates are considerably lower, as that protocol was designed to support always-on type wearable devices with low power drain requirements. Nordic implements Bluetooth 4.0 (BLE) in what I guess is called single mode. Other implementations such as from Broadcom implement both low energy and the previous versions (1,2,3) of Bluetooth, which allow for data rates in the range of 2 to 3 Mbps.

    William

  • edited January 2015
    William,

    I have not done any measurement of the data rates over Bluetooth on Android. So I can't tell at this moment. I only worked with biofeedback devices which BioEra supports and those have had no problems with the bandwidth as far as I could observe.

    Yes, Bluetooth is slower. But with customizable data packet size (as proposed here), there should be no problem to transfer several channels which should be the most common use case. The option to have 16 channels is great, but I suspect it will probably be used a lot less often (it takes a long time to put all those electrodes!), especially on Android. If it is needed, the OTG option will be there too.

    Jarek

  • Just this weekend at PennApps, my team developed an Android app using OpenBCI by connecting OpenBCI through the OTG cable and dongle. Of course, the code is fairly messy right now (being that the work was done during the hackathon), but you can see the GitHub and ChallegePost submission if you want to check out how we did it (we used D2XX). We will probably rewrite the OpenBCI service code to be usable outside of our specific app soon as well.
  • wjcroftwjcroft Mount Shasta, CA
    Azur, very cool.

    @conor_obci is likely going to post your link on our https://twitter.com/OpenBCI feed.

    So your D2XX code is in the OpenBCIService.java file? Can you explain a little how D2XX relates to just reading / writing from a virtual COM port? Perhaps Android doesnt provide VCPs so you have to use D2XX?

    https://github.com/el1t/Drift/tree/master/app/src/main/java/com/elmz/drift/openbci

    William
  • William,

    So FTDI has an android library for D2XX communication but not for VCP and its a separate type of interface for their chips. While VCP allows the device to connect via emulating a legacy COM port D2XX is simply a "direct" driver interface. In terms of interfacing with OpenBCI specifically, though, very little is changed as D2XX allows for the same functions as VCP as well as some additional functions. But, the OpenBCI device is not connected by a serial port but by a direct interface through USB. The FTDI library for D2XX allows for the basic communications using with the functions that can be found here.
  • wjcroftwjcroft Mount Shasta, CA
    @jarek , hi.

    I'm curious now about your BioEra interface for various FTDI devices (including our dongle). Are you using this D2XX API to do that? That would make sense, since you now no longer need the VCP interface.

    I see that this D2XX has the same Latency Timer settings as the VCP, but with D2XX it can be set programmatically. Vs. VCP which requires futzing with Windows control panels or Mac plist files. A big advantage.

    Regards,

    William

  • edited January 2015
    Yes, I believe that was the same d2xx API, it's been a while since I did this.

    I will try to find some time and see if BioEra on Android works with OpenBCI dongle. I believe it will without any modification.
  • wjcroftwjcroft Mount Shasta, CA
    edited January 2015
    Azur,

    Conor tweeted your Android Drift app announcement on https://twitter.com/OpenBCI

    Direct links to the tweets (which I thought Vanilla Forums would embed, but apparently not.)





  • Hi, 

    I just put my project on github https://github.com/florian-f/braindroid

    Have a look at how the ftdi (java) drivers are used. 

    The basics are working for me and I managed to successfully write data to file.
    I'm working on a blog post about it that will contain more details.

    tbh the app is rather unfinished right now, but I'm working on making it better and adding the features I want as soon as possible.

    Feel free to message me if you have any questions.

    Also, would you be interested in working together? We'd probably get done a lot more sooner if we organized ourselves (and other people working on OpenBCI on Android).



  • wjcroftwjcroft Mount Shasta, CA
    Thanks Florian, let us know know your blog URL and keep us posted on your app's evolution.

    William
  • So I am student teaching chemistry right now but the biology and physiology teachers here agreed to let me demo the openbci board for their unit on the brain. I was hoping to have some simple code ready so I could scroll through a PowerPoint presentation through some simple signal such as blinking. I currently have an android tablet using this app:https://github.com/OpenBCI/OpenBCI-AndroidApp.

    My question is, does anyone have some simple code to translate an impulse into a click command or some other method of input?

    I haven't had much of a chance to experiment with the board yet so I greatly appreciate the help.
  • wjcroftwjcroft Mount Shasta, CA
    Quiksilver, hi. I merged your post into this Android thread. See some example code on previous posts.

    I don't believe that Github link you provided reflects the current approach on Android. Using the D2XX library with the dongle seems the way to go at the moment. Bluetooth Low Energy (without dongle) support is likely a long ways off.

    If you are just looking to generate some Windows keystrikes, BrainBay can do that, see the Keystrike element block, page 31 in,

    http://www.shifz.org/brainbay/manuals/BrainBay-user_manual.pdf
Sign In or Register to comment.