KT88-1016 EEG Drivers for BioEra

KT88-1016 is a 16 channel EEG device produced by Contec Medical Systems in China and is currently one of the most affordable (per channel) EEG machine.

KT88-1016

On the plus side it has 16 channels allowing for (almost) full 10-20 EEG/qEEG recording, multi-channel neurofeedback training, or brain machine interface research. It comes ready to use with contacts, electrodes and rubber mesh cap. On the minus side it lacks 3 center channels (Fz Cz Pz) to do a standard EEG/qEEG recording, sample rate is 100 sps which is lower relative to industry standard, rubber mesh cap is hard to use and from what i read the software is outdated. However despite the shortcomings this device became popular among the eeg and bmi enthusiasts due to the good price relative to the number of channels you get.

The main challenge to overcome in using this device is to get your favorite eeg/bmi/neurofeedback software to talk to it. Thanks to the efforts of Alexandra Elbakyan and others the serial protocol used by device was cracked and several programs that read data from KT88 have been posted on yahoo’s contect88 board. Alexandra also posted an OpenViBE driver however stopped any further development since.

Taking these efforts one step further i wrote a driver for popular BioEra software which can be downloaded from here as well as from contect88 board files section. I have included source code which you are free to use and modify.

Couple of notes regarding the software:

Installation

  • Install windows drivers from Windows_XP_S2K3_Vista_7 Drivers folder
  • Extract contents of BioEra folder into your BioEra installation folder
  • Open KT88-1016 simple filter.bpd design file in BioEra for example of usage

Windows drivers

KT88 uses a CP2102 chip made by Silicon Labs to to communicate with PC. This chip essentially allows micro controller on KT88 to talk to PC as if it was connected using serial port but does it over USB interface. In order to do so Silicon Labs provides to device manufacturers a set of drivers called Virtual COM Port (VCP) that once they are customized with vendor and device ids and installed on client pcs represent themselves to KT88 software as a serial port. See my other post for more details.

BioEra drivers

BioEra drivers are implemented as a CustomElement using Java code. In order to add it to your design go to Element->New, select CustomElement and specify KT88_BioEra in the class name field:

Custom element has 16 outputs for each channel in the following order: Fp1,Fp2,F3,F4,C3,C4,P3,P4,O1,O2,F7,F8,T3,T4,T5,T6. Connections A1 and A2 on the device are used as ground/reference and are not available as an output. There’s one input to the element which accepts COM port number (defaulted to 3).

Code

I used Alexandra Elbakyan’s OpenViBE drivers (written in C) as a base. There are two classes: KT88 represents a device and can perform basic operations – OpenDevice, CloseDevice, ReadPacket. ReadPacket returns array of integers in the -2047 to +2047 range. I believe the maximum value corresponds to 325 micro volts at the contact (see below for more). The second class is KT88_BioEra and it contains BioEra specific code. On the top of the code there are several constants worth mentioning: comPortNo is the default COM port number, maxValue sets what physical voltage value in micro volts corresponds to the maximum value returned from KT88, upSample and upSampleRate enable up-sampling and set up-sampling rate accordingly. Up-sampling uses linear approximation and can be turned on if higher sample rate is required. Obviously this higher sample rate does not contain any extra information but it is useful for compatibility purposes if your software was written for device with higher sampling rate. KT88_BioEra class contains a ReaderThread class which runs in a separate thread and collects samples. KT88_BioEra.processOutputData() then sends this data to BioEra.

As expected there were few problems that I ran into during the code development. I have wasted a lot of time on on of these so now I feel compelled to share it with you in hopes that you would not do the same: KT88 refuses to communicate at low serial speeds. For the longest time I had absolutely no response from device making me go over the code and compare serial port monitor logs countless times. I even rewrote the same driver in .net using direct windows api calls in order to replicate exact settings used by original software. Anyhow, make sure you set serial port communication speed to 921600 baud.

Amplitude and Frequency Response

One piece of information that I was not able to find online was what voltage values did integer values returned by KT88 device corresponded to. In order to determine that as well as the frequency response of KT88-1016 device I’ve conducted an experiment by feeding a sinusoidal signal of known amplitude to the device and noting the integer values returned. I’ve used Visual Analyser sound card signal generator to produce the wave signal which I then measured with oscilloscope and fed to KT88 via the voltage divider with 1:1000 ratio. Comparing input voltage to output digital signal at various frequencies produced following curve:

KT88-1016 Frequency Response

As you can see on the right side, KT88 response sharply declines as frequency approaches 50 Hz. This is to be expected since device is built to suppress 50 Hz line voltage as well as due to the sampling rate of 100 sps setting the highest theoretical frequency device can detect to 50 Hz. On the left side of the chart you can also see a decline, however this time the decline is present in both source voltage as measured by scope and in KT88 response. I believe that decline in source signal is due to sound card not being able to generate very low frequency signal. This decline in source signal amplitude prevented me from measuring frequency response accurately below 2Hz, however I suspected that KT88 has a high-pass filter on inputs filtering out DC component of the signal. In order to test that theory i have connected KT88 to the DC voltage generator and then tested the response to the step function of turning the power supply on and off. Below is the example of such response when the power supply was turned off:

KT88 Step response

From the wave shape and settling time I would estimate that KT88-1016 has a 0.4 Hz high-pass filter on inputs.

In conclusion

This was a fun project and great example of collaborative research and development. Please feel free to contact me with any questions or comments.

Advertisements

Tags: , , , , , , , , , , ,

6 Responses to “KT88-1016 EEG Drivers for BioEra”

  1. William J. Croft Says:

    Aleksey, thanks! Jarek may add this to BioEra if you give him your files.

  2. Jarek Foltynski Says:

    Excellent work! I just added info about this driver to the BioEra manual. I am also planning to extend BioEra CustomSourceIf element to allow set names of the output pipes to use real QEEG electrode locations.

  3. magnelectro Says:

    Thank you! Thank You!! THANK YOU!!!

  4. Alex Says:

    I just saw this paper. doras.dcu.ie/16387/1/graham-paper-HCI.pdf

    Would that not be a solution to the center channels issue you mention.

  5. GrahamHealy Says:

    That was my paper Alex. I wasn’t using the kt88 software provided, I opted to use my own, so it didn’t really matter which way I wired up the channels just once I was consistent and labelled them correctly myself (i.e. Fz, Pz, etc).

    I found the kt88-1016 to be good bang for buck. However, as pointed out there are issues with sampling frequency.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: