I am thinking of using the ATmega328 running at 8MHz for the microcontroller on my wireless module. To gather neural data, I am contemplating using an Intan chip, possibly the RHD2216 which can communicate with the ATmega328 using SPI:
I will not be able to send all 16 channels (at 16 bits) at a reasonable sample rate unless I do some compression, however, I think I can send 8 channels reasonably. As proof of principle, I set up an Arduino Pro (ATmega328, 8MHz) getting data via SPI from an MCP3208 and sending via bluetooth.
Aside: I could compress sent data by sending only changes in ADC values, which are likely far smaller than the full 16 bits. If I could get away with sending only 8 bits, then I could send all 16 channels at a reasonable sampling rate.
In any case, I found that on the 8MHz chip, just performing SPI communication was a little slow when using digitalWrite/digitalRead. I started out using code from http://playground.arduino.cc/Code/MCP3208, but it ran too slow. I had make things faster. Here is what I had to do:
- http://www.intantech.com/products_RHD2000.html
- http://www.intantech.com/files/Intan_RHD2000_series_datasheet.pdf
I will not be able to send all 16 channels (at 16 bits) at a reasonable sample rate unless I do some compression, however, I think I can send 8 channels reasonably. As proof of principle, I set up an Arduino Pro (ATmega328, 8MHz) getting data via SPI from an MCP3208 and sending via bluetooth.
Aside: I could compress sent data by sending only changes in ADC values, which are likely far smaller than the full 16 bits. If I could get away with sending only 8 bits, then I could send all 16 channels at a reasonable sampling rate.
In any case, I found that on the 8MHz chip, just performing SPI communication was a little slow when using digitalWrite/digitalRead. I started out using code from http://playground.arduino.cc/Code/MCP3208, but it ran too slow. I had make things faster. Here is what I had to do:
- Use port manipulation where possible (this make the code less portable)
- Remove any loops (e.g. for loops for sending bits)
- Use digitalWriteFast and digitalReadFast available at: https://code.google.com/p/digitalwritefast/
- Cycle the SPI clock with a minimal delay supported by MCP3208 - in case of 8 MHz, a single asm("nop\n") call is enough