Python / Wifi, setting Analog Board Mode shuts off Cyton
Hi,
First of all, its very cool that I can even mess with at home/cheap/open-source eeg headset -- thanks for your guys' efforts, documentation, forum answers, github code, software updates, hardware iterations, etc. I transitioned out of academics leaving behind any access to tools (I have a cog neurosci background doing EEG, fMRI, combined EEG/fMRI, neuroperformance assessment & training, ML algorithms, etc) but am motivated to hack together a consumer prototype. I initially came across systems ranging up to $50k (for a decent channel number and dry electrodes) before coming across your guys' kit. My expertise is more on the cognitive theory/physiological signal side than the CE/EECs side so its a godsend to be able to set something like this up at home.
I am attempting to build a BCI loop in Python using the WiFi shield (for those high sampling rates) + Cyton+Daisy (for the high channel count).
1) Sending analog board mode turns off Cyton in python: I hooked up a photodiode that works reliably with OpenBCI GUI after I turn on the analog read in the GUI (which was cool -- confirmed my screen refresh rate using a flashing stim). However, whenever I use the python libraries to send an analog board mode code:
from openbci import wifi as bci
shield = bci.OpenBCIWiFi(ip_address = '192.168.4.1', log=True, high_speed=True)
shield.wifi_write('/2') #analog mode
which returns:
Success: analog
but consistently and immediately turns off the Cyton board (D4 light) but leaves the Wifi shield on. Writing out other codes via Python doesn't do this (e.g.'v' for version check). Is there a different code or a reason the Python route would turn off the board everytime but the GUI doesn't?
I tried looking through the OpenBCI code but it seems its using a "set_board_mode" function from the cyton library which I couldn't find in the github code for the GUI but did find in the OpenBCIInterface code. But that function looks like it sends a bytes-encoded '2' which is the same I think (I assume the '/' gets added somewhere else)? I'm just trying to find what the difference is or possible reasons the Python library auto-shuts off the Cyton to Wifi Shield connection while the GUI doesn't.
Without sending this analog-board-mode code, I've gotten the Python libraries to stream the aux channels (and the 16 main channels), but without the data from the photodoide (I assume because the board isn't in the right mode -- default mode streams empty values).
2) Used this set up: http://openbci.com/community/measuring-stimulus-timing-with-a-photoresistor/
More of a question than an issue, but is there any updated recommends on the way this circuit is powered (vs the schematics in this photoresistor tutorial)? It seems to work so far using one giant battery through the WiFi shield but maybe you guys know a better way. I initially thought the Cyton card could be powering down from too much draw (??) when connected to this circuit but I get the same problems when I d/c this photoresistor circuit.
Also, while connected, the OpenBCI GUI works fine when it switches over to Analog mode.
3) There's no WiFi --> LSL --> openVibe stream available. (Low priority)
Already covered in these threads, I assume it ended up being a more thorny problem than it first appears:
I spent a couple days trying to modify the serial port functions in the streaming LSL library but the functions from serial to wifi don't map that great (plus, I'm a hackish/fake programmer). Alternatively, I suppose a wifi/tcp/udp driver could be made for OpenVibe at some point? Its not the biggest priority for me since I plan to implement/re-implement everything in Python anyways but it would be nice for prototyping of BCI workflow loops.
Omar
Comments
Seems to be an issue with setting
pinMode(11, INPUT)
This is present in both modes that aren't working (analog and digital) and absent in all the modes that are working.
Removing this line or replacing it in the OpenBCI_32bit_Library_definitions.cpp prevents the Cyton from shutting down (but of course doesn't properly set the mode to read from the AUX channels).
Is this specifically a problem with my board or has anyone else reproduced it?
I'm not even sure which board would be the problem if it were a hardware issues (WiFi shield or Cyton). Again, its weird because however OpenBCI GUI enables analog mode with WiFi tx works just fine.