multiplexing: clock signal and output pins ?
I am trying to build an external multiplexer and my main task is to determine when to switch on my microcontroller. I am trying to use the clock signal (or other relevant signals) from the OpenBCI to accomplish. I have read that the clock signal oscillates at 2.048 MHz, but the recording frequency is 250 Hz. How are these two values reconciled and how does it relate to the clock signal? Additionally, are the MISO/MOSI pins of any interest for multiplexing applications?
Comments
Can you explain what external devices you are trying to connect to Cyton? What is the application as far as EEG / BCI goes? Do you realize that the radio channel (using two RFduinos), is very bandwidth limited? (250 packets per second of about 33 bytes).
https://docs.openbci.com/Cyton/CytonDataFormat/
Regards, William
I am trying to connect a multiplexer to Cyton so that I can try to retrieve data from more than 8 channels. I understand that a Daisy module exists, but I am trying to expand to even more channels beyond that. Postprocessing of the data is not an issue, but I need to use the clock signal to determine when to switch channels on the multiplexer. In the documentation, I have read that the clock signal has a period of 2.048 MHz, but I'm not sure how this relates to the 250Hz sampling.
There is not enough radio bandwidth "to expand to even more channels". The Bluetooth 'Gazelle' protocol being used can only handle 250 packets per second, each packet 33 bytes. Does that make sense?
Okay, I may have mischaracterized my task in my question. I do not plan on using more than 8 channels on Cyton; this would not be possible because there are only eight recording pins. To rephrase and get a higher level overview: how can I know that Cyton has finalized a sample? Is there some sort of signal outputted by Cyton that indicates that the current sample is done being read? I understand that the module operates at a frequency of 250Hz, but this does not tell us anything about the phase of the sampling. Thanks.
I'm not sure you understood my last comment. There is NO room for additional channels or samples in the EEG data stream coming from Cyton. This is because the radio channel between the Cyton and the dongle is limited by the Bluetooth / Gazelle maximum packet rate of 250 packets per second, each 33 bytes long. Even if you could connect more channels to the Cyton, there is no radio bandwidth to send the additional sample bits.
You stated above: "I am trying to connect a multiplexer to Cyton so that I can try to retrieve data from more than 8 channels." It does not make any difference HOW these additional channels are connected (through a multiplexer or whatever). There is no radio channel bandwidth to add more samples. Does that make sense?
I'm not trying to add more samples into the data stream. Let's take this example. I have a multiplexer with 16 inputs and 8 outputs. At time t=0, I am selecting inputs 1-8 and they are mapping to the 8 outputs (these output pins on the multiplexer are connected to the 8 recording channels on Cyton). Then, at time t=1, I am switching the selection of the inputs and now I am using channels 9-16. Thus, at every point in time, I am not forcing Cyton to use more samples than what is supported. My question surrounds the nature of switching the input channels from one set to another. I would like to switch only when Cyton is completely done processing 1 set of samples (which should take 1/250 = 0.004 seconds). I know I have to switch every 0.004 seconds, but I cannot figure out how to determine the phase of the switching. For simplicity, let's take a sine wave cos(2pi*t + phi). I know the period of this function, but the phase depends on phi. If I want to know the value of time at which this wave equals 1, I must need to know the phase. I hope this analogy makes sense.
The ADS1299 EEG analog to digital converter chip on the Cyton, controls the sample rate and timing. When the next sample has been collected and is ready to read (very 4 ms), the DRDY (data ready) pin goes true on the ADS1299. Schematic on this page:
https://docs.openbci.com/Cyton/CytonSpecs/
This is connected to pin D9 on the PIC32 (chipKIT) main microcontroller. The firmware sees the state change, and then issues commands over the SPI bus to read the samples into the PIC32. The samples have already been latched in the ADS1299, so timing of the read operations is not super critical. The detection of the D9 change is sensed in the control loop of the Arduino code. This firmware is not interrupt based, but instead uses a polling loop. Once the samples are collected from the ADS1299, they are packetized and then sent out through the onboard RFduino radio chip, which is paired with the similar RFduino on the dongle.
The problem with your proposed multiplexing, is that the highly sensitive differential amplifiers in the ADS1299, I believe have a certain 'settle time'. So cannot be multiplexed rapidly like you are proposing. You can try it, but my guess is that every multiplex switch will be accompanied by additional noise, because the ADS1299 cannot slew as rapidly as you assume. In real world applications, the solution is always to chain multiple ADS1299 chips (which all sample at the same exact moment in time.)
https://e2e.ti.com/support/data-converters-group/data-converters/f/data-converters-forum/794628/ads1299-can-i-use-an-external-multiplexer-with-ads1299
Rather than attempt such multiplexing, you may be better off using a wifi microcontroller such as ESP32, and talking to a chained set of your own ADS1299 chips. With the number of chips needed being channels divided by 8.
Regards, William