Ganglion SPI or UART connection to external device
Hi everyone, I have read a lot about the ganglion and the possibility to connect it by a wire connection to an external device.
https://openbci.com/forum/index.php?p=/discussion/2079/serial-wire-connection-cyton-arduino
https://openbci.com/forum/index.php?p=/discussion/1375/ganglion-hardware-connection-to-raspberry-pi-spi-or-uart&
There is a lot been said here, but I don't see any solution. I was wondering if anyone has manged to connect its Ganglion to any external device via SPI or UART in order to receive the data of the ganglion and make something out of it. For example, connect the Ganglion to an Arduino board and the arduino board would play music when we are focused (data from the ganglion).
Could anybody help me with that ?
Comments
Clareto, hi.
There are a number of other threads here on the Forum, discussing music generation. This is most easily done on the laptop with the many music app packages available.
https://www.google.com/search?as_q=music&as_sitesearch=openbci.com
If you need a device that has GPIO / SPI capability, the Raspberry PI models have what is called "usb host mode" ports, into which the dongle can be plugged. Additionally the Raspberry can run programs using the Brainflow library. Unfortunately there is no Brainflow available for Arduino. Once the decoded / detected EEG stream is available on the Raspberry, it can either play audio directly or if you really need GPIO / SPI, Raspberry can do that as well with the digital pins available.
Usb host mode is generally NOT available on Arduino boards, although some of them do have a 'shield' available that can do host mode. In any event there would be no Brainflow library available on the Arduino. Brainflow is needed to decode the dongle stream from the Ganglion.
Regards, William
Thanks William for the quick response.
I would like to be able to get my device on me all the time (Raspberry, kinda big to take on with me). It means my arduino or other microcontroller (I've read about Teensy4.1), would be with me connected to the Ganglion receiving the data. Then, if I am focused, the microcontroller will play some music via an audio shield.
Would it be possible since the Ganglion has SPI and UART pins. Could I use my microcontroller as a slave in the SPI protocol to receive the Ganglion data ? It seems that Tyler manage to do it ?
However, I do not see how and the file he gave are no longer available.
There are small versions of the Raspberry Pi available. Arduino will not be able to talk to the BLED112 dongle used by the Ganglion, and required for Brainflow library interfacing.
https://www.raspberrypi.com/products/raspberry-pi-zero-2-w/
Once you modify your Ganglion firmware, it will no longer be compatible with the OpenBCI_GUI. So this will greatly complicate any testing you may want to do with customer support.
Regards, William
I don't understand why I would have to modify the Ganglion firmware ? Is it to put the SPI or UART pins to send data ?
Another idea that just come up is that I could use an ESP32 with a teensy 4.1 so that the Ganglion could send data over BLE to the ESP32 and then I collect the data on my Teensy4.1 ?
Ganglion is designed to stream the data out using a BLE protocol:
https://docs.openbci.com/Ganglion/GanglionDataFormat/
And this same protocol is received by the BLED112 dongle, which the Brainflow library connects to.
Your previously quoted thread by TylerC would require extensive mods to the Ganglion firmware. Essentially making it incompatible with the default mode of streaming and OpenBCI_GUI.
Ganglion Brainflow is only implemented to talk to the BLED112 dongle, which appears as a usb serial port. So any other Bluetooth connections would require a new implementation of your receiving software. And incompatible with Brainflow existing library.
Regards, William
Ok, but if I don't want to use OpenBCI_GUI? My project would be to have a teensy4.1 or ArduinoMKR connected to an audio shield and the Ganglion. If someone who is wearing the ganglion is focused, then the microcontroller play music in headphones. In a further part, I will try to calibrate the music with brain activity. But it is important that The Ganglion is connected in SPI or UART to my microcontroller. Question then is would it be possible with the ganglion ?
You can do anything you want with the firmware. I am simply trying to point out that your work and time spent is going to be many many times longer / harder if you do not use the default Ganglion firmware and BLED112 dongle.
Did you see some of the previous comments regarding NOT being able to use Brainflow library? Brainflow-Ganglion interface is only available when using the BLED112 dongle connected to a usb serial port. This is possible with the Raspberry Pi Zero, since this Pi and other Pi's can accept the dongle. Brainflow cannot work on Arduino microcontrollers, due to C / C++ library limitations.
https://brainflow.org/
https://brainflow.readthedocs.io/en/stable/Examples.html
I have searched for a solution here, and I can not find one. I do not want to use the dongle or the OpenBCI GUI. I want to get the raw data from the ganglion on my teensy 4.1. I have tried to connect the Rx and TX pins to my board and read the UART incoming byte I receive some data, but it seems to work randomly.
Does anybody have ba int or solution for connecting my ganglion to the teensy board over UART or SPI. Do I need to change the firmware ? I have checked the firmware and I admit that I have no clue what I should change.
The Ganglion firmware is designed to send out the compressed data stream using BLE. This standard firmware DOES NOT send the data stream via serial port.
https://docs.openbci.com/Ganglion/GanglionDataFormat/
Teensy does not support Bluetooth connections, but some workarounds mentioned.
https://www.google.com/search?q=teensy+board+bluetooth
As I mentioned previously on this thread, a small Raspberry Pi Zero would accept the BLED112 dongle and allow use of the Brainflow library and access from many programming languages. This would not be possible with Teensy. Making Teensy development many times harder.
https://brainflow.org/
https://brainflow.readthedocs.io/en/stable/Examples.html
Thank you, William, for the response. I am aware that Teensy does not support BLE connection. That is why I am asking about SPI or UART connection with the ganglion. I do not want to use the BLED112 neither since I am not planning to use any Bluetooth connection. Basically I just need the ganglion to be able to get the data from pins 1, 2, 3 and 4 and then parse it to my teensy board. I have seen that the firware uses the function SendCompressdata to send data with SimbleeBLE.send. So basically i would need to change this, so it would send to the MISO, MOSI and SCLK pins ? Or I can modify the firmware so I can sniff the raw data sent from the MCP to the SimBlee ? So I can still have the OpenBCI GUI and the raw data on my board
I do not believe that you would find modifying the Ganglion firmware very productive or straightforward. As you have already asked, you are not sure where to insert your modifications.
I did see this EEG Hat available for Teensy:
https://www.tindie.com/products/blino/teenaps-eeg-hat-for-teensy-32/