| Author |
Message |
alyver00
Joined: Sep 25, 2007 Posts: 9
|
Posted: Sep 25, 2007 10:02 PM Post subject: Developing a new driver |
|
Hi Jarek i`m an italian student and i start to make my thesis about BCI,i start to build a device similar to openeeg but with another firmware and schema, i can read the input of my board(electrodes) and show they in my pc in a numeric form from 0 to 1023(exactly the value of a converted analog input of 10 bit) but for now i can`t set any kind of protocol(i just read the value of the adc input),i want to interface it in the bioera GPL software, but it`s a little much complex for me study all the source, can you make me a schema of which class and methods i have to go through for implementing my driver? sorry for my bad english ;)
alyver |
|
 |
Jarek Foltynski
Joined: Jan 13, 2005 Posts: 62
|
Posted: Sep 26, 2007 11:05 PM Post subject: |
|
Hi Alyver,
I think you have two choices 1. Build new element - driver in bioera 2. Modify your device so that it uses the same format as existing device, e.g. openeeg
To do the first you could look at ModEEG_P2 java element, and modify it according to your specification.
The second choice would require no java programming, but instead working on your firmware (if you have microcontroller). If you have Atmel, then you might even be able to reuse the code from openeeg.
Hope this helps. Jarek |
|
 |
alyver00
Joined: Sep 25, 2007 Posts: 9
|
Posted: Oct 2, 2007 9:30 AM Post subject: |
|
Thank you Jarek, i think to choose the first choice,and if it don`t work, i choose the second one ;) Very Great work with bioera,i like it very much also for his possibility to be extended.when i finish my device and my driver i put all the schematics on the web and i give you the driver i made if you think it`s useful.
Thanks
Marco |
|
 |
alyver00
Joined: Sep 25, 2007 Posts: 9
|
Posted: Dec 20, 2007 10:35 AM Post subject: |
|
Hi, i change my project, now i have build the soundcardEEG from the openeeg project. This sound card have 2 channel and modulate the eeg signal in AM code (like the radio) to have more quality with the audio A/D interface of the computer. So i have to build the driver,i know the demodulation process, but it's a little difficult understand how works your externalsourceSample. I understand that with read() you fill the buffer array with the samples, in your example with the samples from a sine wave. But i don't understand how is frequency of the call to the read() function ( note that i have a 44100hz of frequency quantization with 16bit), and who use the read call ( which element or which class use this). Thanks
|
|
 |
jarek
Joined: Oct 22, 2007 Posts: 1075
|
Posted: Dec 21, 2007 12:00 AM Post subject: |
|
Hi Alyver,
the read() function is implemented by your driver. This function is periodically called from BioEra. You are supposed to fill the buffer with all data you have at the moment (up to the maximum size of the buffer). If you have no data then return 0, if you have less data then buffer size then fill what you have and return number of values (never wait or block this function).
The values you filled will then sent to the output of ExternalSource element and can be used in any design.
Let me know if that is still not clear.
Jarek
|
|
 |
alyver00
Joined: Sep 25, 2007 Posts: 9
|
Posted: Dec 21, 2007 12:42 PM Post subject: |
|
i understand but how much times in one second the function read is called by bioera? i understand that i have to fill al the buffer, but if i don't know how much is the sample rate of bioera i don't understand what samples put in the buffer: for exemple:
if i have a 44100Hz sampling rate at 8bit i fill the buffer with one byte every 11us -> if the program read the buffer with a low frequency the signal is now the one that i have in input.
1)bioera read the buffer at a fixed rate? 2)have i only to change the rate value ( given by getRate() ) in my externalsource.java for change the rate of how bioera read the buffer?
|
|
 |
jarek
Joined: Oct 22, 2007 Posts: 1075
|
Posted: Dec 21, 2007 5:09 PM Post subject: |
|
Hi Alyver,
1. yes, BioEra reads the buffer at a fixed rate, by default this is 100 times per second (depends on design setting: Sleep time). So you need to have additional (internal) buffer (FIFO) which holds your data until bioera reads it. 2. The getRate() in your case should always return 44100. It describes you signal. So you will be filling buffer with approx. 441 values at a time. But this amount shouldn't be fixed, it should be controlled by the source (amount of data provided from sound card EEG and available in your buffer). So sometimes it can be more or less, but on on average it should be exactly 44100 values per second.
Jarek
|
|