How to use Cyton with Android and Alternatives

GeorgLangeGeorgLange Potsdam
edited February 2021 in Cyton

Hi there,

We want to integrate the Cyton+Daisy sensor into our Android App using Bluetooth Low Energy. Therefor, we found this 3 year old example on Github along with this article.

In this solution, the Cyton was able to send just 2 channels with 250Hz via BLE. As this article is three years old, is there any update, any better solution for BLE? How can we use BLE to send data from 16 channels?

Another idea is to use BLE just for communication not for transferring data. We'd like to save all data on the SD-card and just send commands (via BLE) to the Cyton board like "start recording" or "set sampling Rate to 250Hz".
What do you think about this solution? Do you have other ideas about how to use the Cyton Board with an Android App (stream over Wifi is not an option for us)? What do you think about the effort to realize this idea? Where is a good starting point?

I've found a section about developing firmware here but this section is completely empty. Do you have any suggestions where to find information and how to start?

Thanks for any help,
Georg

Comments

  • wjcroftwjcroft Mount Shasta, CA

    Georg, hi.

    My suggestion is that you obtain a cable for your Android device. An Android device such as a tablet will have a larger battery. This cable is called an "OTG cable", which stands for On The Go. It allows your Cyton dongle to plug into the Android. And then the dongle appears as a usb serial port. You can then use the BrainFlow Java library, to receive the samples.

    https://brainflow.readthedocs.io/en/stable/

    Regards, William

  • Hi William,
    Thank you for your suggestion. Unfortunately we don't want to use an OTG cable as this is not a good user experience and we want to use BLE for all our devices.
    But anyway, we think that in terms of data volume and battery drain it would be better to save all the data on the SD card and just send commands to start and stop recordings as well as set configurations like the sampling rate. What are your thoughts on this? We had a look into the Cyton library but unfortunately, we didn't found any functionality to receive data (just send). Did we missed sth.? Do we have to implement behavior to receive data? Are their any technical barriers that will prevent us from doing so (This introduction to Nordic Gazell states that bi-directional data transfer is possible)?

    Best,
    Georg

  • wjcroftwjcroft Mount Shasta, CA

    You cannot implement Nordic Gazelle protocol, using the Android BLE stack. Gazelle is proprietary to Nordic. Gazelle is used in the Cyton RFduino dongle, and the RFduino radio processor on the Cyton mainboard.

    Why can you not use the Wifi Shield, since all Android devices support Wifi?

    The 2 channel BLE project you referenced,

    https://openbci.com/community/cyton-ble-code-now-in-alpha/

    'Could' possibly work as way to send stop/start commands, to control your 16 channel recording. But I don't believe it ever left alpha testing stages. And interoperation of recordings at various speeds is an open issue / pull, that has not yet been integrated.

    https://github.com/OpenBCI/OpenBCI_Cyton_Library/pull/96

    So you face two different issues: alpha level 2 channel BLE support, and decoupling of serial data stream from recording data rate. These could be straightforward to resolve, or not. Which is why Wifi might be much easier to achieve. Or the OTG cable.

    Regards, William

  • wjcroftwjcroft Mount Shasta, CA

    The other significant downside to AJ Keller's 2 channel BLE alpha release, is that it will completely BREAK your ability to use OpenBCI_GUI with the Cyton. This is relevant, because firmware upgrades of the PIC32 processor on the Cyton, require the stock RFduino firmware to be installed in both RFduinos: dongle and mainboard.

    His alpha tests were also done in 2017, three years ago. So the firmware mods / changes, could very well be out of sync with current firmware improvements. His BLE firmware, predated the availability of the Wifi Shield, which (for many people), would solve the issue of Android connectivity.

  • Andrey1994Andrey1994 Moscow
    edited June 2020

    @wjcroft said:
    Georg, hi.

    My suggestion is that you obtain a cable for your Android device. An Android device such as a tablet will have a larger battery. This cable is called an "OTG cable", which stands for On The Go. It allows your Cyton dongle to plug into the Android. And then the dongle appears as a usb serial port. You can then use the BrainFlow Java library, to receive the samples.

    https://brainflow.readthedocs.io/en/stable/

    Regards, William

    Unfortunately, you can not use java binding for BrainFlow with Android right now. Java binding just calls methods from C\C++ dyn library, so to make it possible we have to build BrainFlow using Android NDK. Its in todo list but so far we even didnt try. And I know for sure that without at least minor changes it will not work

  • Hi Andrey and William, Thanks for your update!

  • New release of brainflow works on Android, so far only wifi shield + cyton/daisy/ganglion officially supported

  • wjcroftwjcroft Mount Shasta, CA

    Karl Semich (Github: xloem) has mentioned on a recent Brainflow Slack thread, that he has the Cyton dongle talking to Brainflow using an OTG cable. It's working for him. A pull request has been submitted to the libusb maintainers. However the libusb project still has to decide how they want to integrate it and possible changes they will add.

    https://github.com/libusb/libusb/pull/874
    https://github.com/xloem/libusb
    https://github.com/xloem/brainflow
    https://github.com/xloem?tab=repositories

    In summary, it's working, but not yet incorporated back into core Brainflow and libusb. That is anticipated to happen soon.

  • mjmcmahonmjmcmahon Dublin Ireland
    edited March 2021

    I have written an OpenBCI OTG Android App for the Cyton to collect EEG and activity recognition data which is then streamed to an AWS EC2 instance using RabbitMQ where it can be made available to any consumer application. I am using it to create labelled datasets as part of my research but it is available as a boilerplate app for anyone who is interested in adapting it for their needs.

    I took the Braindroid App by Florian Friemel as a starting point - it doesn't use brainflow which was not available when I began writing it so it is using the FTDI Android driver directly for communication. The Android targetSdkVersion level is 29.

    The code is available here: https://github.com/michaelmcmahon/BCI_MQ_ACTIVITY and I have included a step-by-step guide for setup and usage. It has been working fine in my testing so far and looks solid but let me know if anybody has issues using it.

  • can Cyton board and Ganglion Board be paired to smartphone through bluetooth?

  • wjcroftwjcroft Mount Shasta, CA

    @victoriadk, hi.

    I merged your new thread into this existing Cyton thread on the same subject. Cyton use requires using an Android OTG cable and the Cyton dongle. See above comments. RFduino dongle / mainboard radio protocol is NOT Bluetooth Low Energy (BLE).

    On the other hand, Ganglion DOES use BLE. But Brainflow (and the OpenBCI_GUI) uses the BLED112 dongle to handle radio communications. BLED112 dongle appears as a usb serial port device to the usb host computer / Android. Similar idea as the Cyton dongle.

    I believe there are some past discussions on the Brainflow Slack regarding direct BLE Android to Ganglion access. Do you have Slack access? There is a 'help' group on the Slack. Signup link on this page,

    https://brainflow.org/

    William

  • Thanks a lot, William! I still have more questions.
    1. I prefer to use smartphone to get streamed data from openBCI board. So I connect Android OTG cable to Android phone and then connect Cyton dongle to Android OTG cable. In this way, data will be streamed to Android phone, right? is there extra work to do instead of just making those connection?
    2. I am more interested in using BLE for data transmission. like pairing, then connected. Ganglion has BLE. To make it work, we just need to develop software, right?
    3. Is it possible that I use iphone to get streamed data from either Ganglion or Cyton? like the way with Android phone by using Android OTG cable.

  • wjcroftwjcroft Mount Shasta, CA
    edited June 2022

    It is not possible to use BLE with Cyton. BLE only works with Ganglion. If you want further tips on using the Cyton dongle with Brainflow, ask questions in the 'help' section of the Brainflow Slack.

    iPhone and iOS are much more restricted than Android. You could ask on the Slack about it. Not sure if iOS supports OTG cables.

    https://brainflow.org/ [link to join Slack]

Sign In or Register to comment.