Menu

Tree [3aed24] master /
 History

HTTPS access


File Date Author Commit
 bin 2013-10-30 Alessander Botti Benevides Alessander Botti Benevides [bcef10] Initial commit
 src 2013-10-30 Alessander Botti Benevides Alessander Botti Benevides [bcef10] Initial commit
 COPYING.txt 2013-10-30 Alessander Botti Benevides Alessander Botti Benevides [bcef10] Initial commit
 README.txt 2013-10-30 Alessander Botti Benevides Alessander Botti Benevides [bcef10] Initial commit

Read Me

This Ethernet sniffer was designed to work together with the medical device for EEG acquisition
BrainNet36® (BNT36), from EMSA Equipamentos Médicos Ltda.

BrainNet36® has 36 channels, A/D converters with 16 bit accuracy, conversion time of 10 µs and Ethernet communication interface.
Being a device for clinical purposes, BrainNet36® does not export data online. This sniffer was developed to allow online processing
by working in promiscuous mode and recording data in a plain text file.

Considerations:
- The data is sent by UDP packets with payload of 1470 Bytes.
- The samples are 16-bit integers and each packet contains 20 samples (2 Bytes) for each channel, in a total of 1440 Bytes.
- Data is placed moment by moment and the order of the channels in the packets is:
  ch-1, ch-2,..., ch-36 = F7,T3,T5,Fp1,F3,C3,P3,O1,F8,T4,T6,Fp2,F4,C4,P4,O2,Fz,Cz,Pz,Oz,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36.
- The use of more or less channels does not alter the packet size, then unused channels are also sent in the packet.
- The sampling frequency of the device can be varied between 100 to 600 Hz, but it does not change the packet size.
  Changing the sampling frequency of the device only increases or slows the emission rate of packets.
- The header of BNT36 packets include information about the packet itself (one of them is a 32-bit integer with the packet number).
- The first sample of the first channel starts at position 71 (72 Byte).
- The destination port is fixed to 11111.

UDP packet:
 [ Ethernet | IP | UDP | BNT36 header | Data [(sample 1: ch-1, ch-2,...,ch-36),(sample 2),...,(sample 20)] | Ethernet trailer]           
<-----------><---><----><------------><-------------------------------------------------------------------><----------------->
      14      20    8        30                                 36*2*20 = 1440                                   4 Bytes                                 
<------------------------------------> 
             72 Bytes                
                        <--------------------------------------------------------------------------------->                   
                                                   UDP payload = 1470 Bytes 
<---------------------------------------------------------------------------------------------------------------------------->  
                                                        1516 Bytes 

User guide on Windows:

    1. Install WinPcap for Windows [1] and extract it under C:. 
       The zip file contains a directory named WpdPack, so, after unpacking, you should have C:\WpdPack.     
    2. Open the terminal, enter the directory where you put BrainNet36Sniffer.c and enter the following command-line:
       BrainNet36Sniffer.exe \\Device\\Tcpip_{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} k1 k2 data
       where Tcpip_{x-x-x-x} is the MAC address of your ethernet board. One can get this MAC address using the function 'getmac' 
       in the terminal (making sure that the Ethernet cable is connected). 'k1' is the number of packets to be monitored and 'k2'
       is the number of packets to be recorded in the same text file. Here 'data' is the name of the text file generated with the
       EEG data. You can replace it. If 'k1' is equal to 'k2', the sniffer writes one text file named 'data0001.txt' with 'k2'
       packets. If 'k1' is larger than 'k2', the sniffer writes several text files with 'k2' packets named: data0001.txt,
       data0002.txt, etc..
    3. Each text file records continuously the concatenated EEG data in the same order that they appear in the UDP packet.
 
[1] http://www.winpcap.org/install/default.htm

    Example, if you use the following command-line:
    BrainNet36Sniffer.exe \\Device\\Tcpip_{put here your ethernet device MAC address} 200 50 data

    You will sniffer 200 packets and write it on 4 text files, each one with 50 packets: data0001.txt, ..., data0004.txt

    data0001.txt will present:
    F7,T3,T5,Fp1,F3,C3,P3,O1,F8,T4,T6,Fp2,F4,C4,P4,O2,Fz,Cz,Pz,Oz,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36 | sample 1  \
    F7,T3,T5,Fp1,F3,C3,P3,O1,F8,T4,T6,Fp2,F4,C4,P4,O2,Fz,Cz,Pz,Oz,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36 | sample 2   \
                                                             .                                                    |    .        \ packet 1
                                                             .                                                    |    .        / 
                                                             .                                                    |    .       /
    F7,T3,T5,Fp1,F3,C3,P3,O1,F8,T4,T6,Fp2,F4,C4,P4,O2,Fz,Cz,Pz,Oz,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36 | sample 20 /
                                                             .                                                    |    .        
                                                             .                                                    |    . 
                                                             .                                                    |    . 
    F7,T3,T5,Fp1,F3,C3,P3,O1,F8,T4,T6,Fp2,F4,C4,P4,O2,Fz,Cz,Pz,Oz,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36 | sample 20 - packet 50

How to compile on Windows:

   1. Install MinGW [1] in order to get gcc.
   2. Install WinPcap for Windows [2]
   3. Download WinPcap Developer's Pack [3] and extract it under C:. The zip file contains a directory
      named WpdPack, so, after unpacking, you should have C:\WpdPack.     
   4. Open the terminal, enter the directory where you put BrainNet36Sniffer.c and enter the following command-line:
      gcc -Wall -I C:\WpdPack\Include -o BrainNet36Sniffer.exe BrainNet36Sniffer.c -L C:\WpdPack\Lib -lwpcap
 
 [1] http://www.mingw.org/wiki/Getting_Started
 [2] http://www.winpcap.org/install/default.htm
 [3] http://www.winpcap.org/devel.htm
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.