Bluetooth LE, RFduino vs. Ganglion Simblee, BT 2 addon module

edited March 2016 in Hardware
I was wondering if the BluTooth LE switch will be enabled soon? I am trying to connect the OpenBCI device to an android phone and that would be the only way I see soo far. if there were a code file to put on the RFduino to enable the LE version that would be great?
«1

Comments

  • wjcroftwjcroft Mount Shasta, CA
    BLE support being added to the V3 mainboard may eventually be done as a community contribution. But it's more likely that OpenBCI BLE access will first be available with the Ganglion which uses a newer more capable RF chip, Simblee vs. the current RFduinos.

    Check these posts for info on how you can use an OTG "on the go" adapter on your Android to plug the dongle in there.

    http://openbci.com/forum/index.php?p=/search&Search=otg

    William

  • the problem with the otg solution is the phone will be in a gearVR which does not expose the data connection (only the power connection)
  • wjcroftwjcroft Mount Shasta, CA
    If a laptop or other computer is in the area, perhaps you could setup some kind of gateway that receives on the dongle, and then forwards to your phone via some type of wireless: BLE, BT2, wifi, etc.

    https://www.google.com/search?q=usb+host+serial+port+to+bluetooth+gateway

    The dongle just presents a usb serial COM port. You would read bytes from that serial port and forward out to the other wireless port. BLE on some devices cannot match the OpenBCI data rate. Which is why the custom RFduino dongle was used. BT2 or wifi are plenty fast.
  • is the serial data going to the rfduino that same as the rfrx and rftx tabs on the bottom of the board?
  • wjcroftwjcroft Mount Shasta, CA
    If you look at the schematic, the RFduino is using two serial ports. One for the sample stream data link from the chipKIT. The 2nd, RF_RXD, RF_TXD pads you are looking at are for uploading the firmware to the RFduino. 

    This thread shows an external Bluetooth 2 module connected to the OpenBCI, that then talks to the phone,

  • are D17 and D18 addressable as a serial port? the docs indicate these pins are serial i/o? the links above use an older board with different labeling and i cannot fined the place to connect to or if i need to create a new serial port in the code on the chip or if it piggyback's off the send to the rfduino?
  • wjcroftwjcroft Mount Shasta, CA
    I'm going to mention Joel @biomurph here. I would refer the the chipKIT site for serial IO recommendations with that uC. You have at least 5 GPIO pins exposed on the header.

    The previous links might have used the older 8 bit board. You will need to mod the firmware to send out on your serial port and initialize your Bluetooth module / send the data.  @momennemrat 's email is here,

    http://openbci.com/community/people/momennemrat/

    I think they were going to post their code on Github. If you update their code for the chipKIT, hope you post that on your own repository.

    My impression is that their firmware sent out TWO streams: one to the RFduino and the laptop dongle, the other to their BT 2 addon module. Seems like you could bypass the laptop stream if you wanted to, and just do all IO through your addon module. Maybe Mou'men could comment here on their experience or suggestions.

    William



  • I remember that I was able to easily update the Firmware in the ChipKIT to enable the BLE button and connect my board directly to my phone successfully to both iPhone and Android devices. However, I had an issue to enable both BLE and Rfduino buttons. I didn't have much time to overcome that problem that that time; so I had to enable only the BLE only.

    I'll find sometime soon to work on a firmware code that can enable both modes.

    For now, the application that I was working on was processing the EEG raw data and only send final results (Alpha power, .. Etc) instead of the raw data. If you would like, I can clean up my code and share it with you to enable your BLE only.
  • wjcroftwjcroft Mount Shasta, CA
    Hassan, that's fantastic!

    [Hassan Albalawi is the author of the Wakecap application, featured on our Community page. And winner of the $100,000 prize at the Stars of Science competition.]

    So it sounds like your data stream was much smaller than the full raw stream of 8 channels, 24 bit samples, 250 samples per second. Can you mention what kind of thruput bytes/second you were getting through the BLE link? Do you have any idea of how much data can be pushed through if taken to the maximum? Some of the earlier links above mentioned some possible thruput limitations of the RFduinos in BLE mode.

    Do you have a Github repository where your current mainboard firmware lives? (Perhaps just the BLE enabling portions.)

    Best regards,

    William

  • edited March 2016
    Hi William,

    Thanks for the intro :D. I try very hard to manage my "crazy" schedule these days; so many things going on but I miss working on OpenBCI-based projects.

    My data stream was much much smaller than the full raw stream of the board capabilities. Therefore, I was using the 9600 baud to avoid the known issues. 

    As far as a Github repository, I don't have one yet; I should start one though. I'll work on it in my free time; probably on the weekends.

    Best regards, 

    Hassan
  • If I could just get the pickup points that would give me a serial stream I could tie into that would be great. I believe that two fo the D# points on the board would be accessible as serial1 or are the serial0 would work?
  • biomurphbiomurph Brooklyn, NY
    @qdewolf

    The Serial1 is mappable to the following pins

    TX D11 (PIC pin B0)
    RX D12 (PIC pin B1)

    Serial0 is used by the OpenBCI firmware to communicate with the RFduino
  • do I need to do anything in the ino to setup the pins to be serial1 or will just referring to it automatically set it up?
  • wjcroftwjcroft Mount Shasta, CA
    You are likely going to need to mod the firmware to send out the sample data to the serial port that you select.
  • I did try that by sending data to Serial1 but even calling begin on serial1 causes the board to crash.Serial1 must be not setup correctly somehow?
  • wjcroftwjcroft Mount Shasta, CA
    Is it possible you have a problem with the serial port interrupt?

    http://chipkit.net/forum/viewtopic.php?t=2481

  • I looked through that entire thread and I have all of the correct settings. Even just calling Serial1.begin(115200); causes the board to stop.
  • I figured out that there has to be a second delay between the 2 begins and now the board does not lockup but I still can't get anything to appear using Serial1.println("123"); Serial0 works fine but nothing is coming out of D11 and D12. I even tried swapping them.
  • biomurphbiomurph Brooklyn, NY
    @qdewolf

    try this

    mapPps(11,PPS_OUT_U2TX);
    mapPps(12,PPS_IN_U2RX);
    Serial1.begin(115200);

    The mapPps() function does the Peripheral Pin Select function
  • this did not work. 11 stays low and 12 stays high even if I comment out all of the serial1 references from the ino
  • Let me ask you this because I'm bit confused on what you're trying to achieve here.

    Are you trying to enable both BLE & PC on the same time?

    For BLE situation, are your trying to stream raw EEG reading (how many channels?) or pre-computed results (ex. average power band of a signal) ?
  • biomurphbiomurph Brooklyn, NY
    @qdewolf
    Ok, I've had a chance to dig into this. The correct way to remap pins is to place the remapping after the instantiation of Serial1. 
    Like this

    Serial1.begin(115200);
    mapPps(11,PPS_OUT_U2TX);
    mapPps(12,PPS_IN_U2RX);

    Then you have to comment out the following lines because they also manipulate pins 11 and 12:

    //  pinMode(LED, OUTPUT); digitalWrite(LED,HIGH);    // blue LED
    //  pinMode(PGCpin,OUTPUT); digitalWrite(PGCpin,LOW);

    This actually works. I see data on Serial1 when I do this. However, it also breaks the SPI bus. Something about how the initial call to Serial1.begin() breaks what was established in the OpenBCI library class. So, the way to fix this problem is to go briefly into the chipKIT core and make the change therein the OpenBCI variants file. It's not to hard, or scary. You should have the chipKIT core installed in your Arduino/hardware folder. Here is the file path on my MAC. It should be very similar on a Windows.

    Documents/Arduino/hardware/chipkit-core/pic32/variants/openbci

    In this file, I changed the following lines of code

    #define       _SER1_TX_OUT         PPS_OUT_U2TX     // RPB14R = U2TX = 2
    #define       _SER1_TX_PIN         11  //7                // RB14 CVREF/AN10/C3INB/RPB14/VBUSON/SCK1/CTED5/RB14
    #define       _SER1_RX_IN          PPS_IN_U2RX      // U2RXR = RPA1 = 0
    #define       _SER1_RX_PIN         12  //10               // RA1  PGEC3/VREF-/CVREF-/AN1/RPA1/CTED2/PMD6/RA1 

    Serial1 TX is now pin 11 and Serial1 RX is now 12 from the very get-go. No interference with pins 7 and 10.
    We use 7 as SCLK and 10 as MOSI for the SPI.
  • stunning!! it works the ChipKit file in windows is located C:\Users\#username#\AppData\Local\Arduino15\packages\chipKIT\hardware\pic32\1.1.0\variants\openbci\Board_Defs.h
    I will post here about final setup and performance for Android use
  • actually I spoke prematurely. the line "while (!(OBCI.isDataAvailable())) {}   // wait for DRDY pin..." fails to ever pass when all I turn on is the Serial1.begin line?
  • biomurphbiomurph Brooklyn, NY
    I'm not sure I understand.
    Are you saying that the board does not stream data when you turn on the Serial1?
  • when I enable serial1 with the begin command the serial1 and serial0 writing and printing commands work fine, but when you set the line "while (!(OBCI.isDataAvailable())) {}   // wait for DRDY pin..." it never exits the while loop. if I put a print command in the while loop it just prints over and over. this seems to me that enabling the extra serial port is some how interfering with the communications with the ADC and the either the ADC never receives the command to start or the board is unable to read the DRDY pin.
  • biomurphbiomurph Brooklyn, NY
    @qdewolf
    Could you share your code with us? github or so?
    I just programed my OpenBCI 32bit with code that has this line in the setup()
    Serial1.begin(115200);
    And in the SerialEvent() function, I have this line added
    Serial1.write(inChar);
    right after the line
    char inChar = (char)Serial0.read();

    I connected an FTDI board from Sparkfun to the GND and D11. I was able to see all of the incoming serial commands on a terminal connected to that port. Then I ran our OpenBCI GUI, and was able to start data streaming as well as see the serial echo in another terminal no problem.
  • it is suddenly working. I will post some kind of recipe when I finish making it smooth.
  • wjcroftwjcroft Mount Shasta, CA
    edited May 2016
    Hassan @alfahad has just posted his source code for his mainboard firmware mods (chipKIT and RFduino) that allow direct Bluetooth LE connection to mobiles and other Bluetooth devices using BLE. Thanks so much, Hassan!




  • Hey has anyone been able to activate the Serial1 after it was mapped at output after startup? Like activate the serial port on the fly?
Sign In or Register to comment.