Project tutorial
Internet Of Brain (IoT)

Internet Of Brain (IoT)

  • 29 respects

Components and supplies

NeuroSky MindWave
RN42 Bluetooth Module
Ph a000067 iso (1) wzec989qrf
Arduino Mega 2560

About this project

Hello Guys,

You might have seen about internet of things or internet of useless things etc etc...

Now hereby create an new class of technology called as internet of brains.

its my starting step of uploading my mind to internet.~~transcendence~~

this is my first step towards transcendance..

Step 1: What is Brain? How we hack the data?

Now lets start telling about the basics of the brain and how we hack it to internet:

There are two parameter you need to know one is Brain which is the main part of our body which sends electrical impulse to the parts of the body via nerves..

These signals are called as synapse.. so we use sensors/electrodes to decode those electrical activity over the brain and send it to the device we are going to work called as Electroencephalography

Now i am going to copy paste the wikepedia stuff. you can have a quick read..

Human Brain:

The human brain has the same general structure as the brains of other mammals, but has a more developed cerebral cortex than any other. Large animals such as whales and elephants have larger brains in absolute terms, but when measured using the encephalization quotient, which compensates for body size, the human brain is almost twice as large as the brain of the bottlenose dolphin, and three times as large as the brain of a chimpanzee. Much of the expansion comes from the cerebral cortex, especially the frontal lobes, which are associated with executive functions such as self-control, planning, reasoning, and abstract thought. The portion of the cerebral cortex devoted to vision, the visual cortex, is also greatly enlarged in humans.


Electroencephalography (EEG) is the recording of electrical activity along the scalp. EEG measures voltage fluctuations resulting from ionic current flows within the neurons of the brain.[1] In clinical contexts, EEG refers to the recording of the brain's spontaneous electrical activity over a short period of time, usually 20–40 minutes[citation needed], as recorded from multiple electrodes placed on the scalp. Diagnostic applications generally focus on the spectral content of EEG, that is, the type of neural oscillations that can be observed in EEG signals.

Step 2: What is Arduino?

What is arduino mega??

its is simply the computer brain of the project, it takes control of all the data flow and logical operations taking place.

The Arduino Mega is a microcontroller board based on the ATmega1280 (datasheet). It has 54 digital input/output pins (of which 14 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started. The Mega is compatible with most shields designed for the Arduino Duemilanove or Diecimila.

Step 3: EEG sensor

here is am going to explain the sensor use to record the signal from our mind.

To understand the MindWave and MindWave Mobile, we must first understand what an EEG sensor is. The first recording of the human brain’s electric field was made by Hans Berger, a German psychiatrist, in 1924. Berger gave the recording the name electroencephalogram (EEG). Put simply, the EEG is performed by placing electrodes all over the subject’s scalp, and then reading in the electrical signals for analysis. Fast forward to today, and you have all of this technology packed into a compact form factor that is the MindWave. which sends all the eeg by bluetooth.

The amplitude of the EEG is ~ 100 µV when measured on the scalp, and about 1-2 mV when measured on the surface of the brain. The bandwidth of this signal is from under 1 Hz to about 50 Hz.

Step 4: Bluetooth interface

Now as you know that the mindwave has the eeg sensor which is connected by means of a bluetooth.

now we need an bluetooth module to connect that to our edison and decode the data to make it usefull.

Here is used RN42 bluetooth its ttl module and it can be configured as master

and i m connecting it directly to the arduino tx rx module.

its 5v module so no need of the level converter.

Step 5: Software developement

Actually i taught of using the intel edison for the cloud push.

but it has some issue with serial so unable to interface is directly.

so i used my arduino mega and used my laptop as push mechnism to cloud

i used python code to get serial data and split it and push to thingspeak server

and arduino code to send data serially.

Step 6: Thingspeak Cloud management

It is an freee cloud iot tool. here you can push the data and send the data to the cloud which will create a json on its backend and plots the graph based on it.

and only disadvantage is it can get data only after 15s. thats a bit slow


import serial
import httplib
ser = serial.Serial('/dev/ttyACM0',9600)
while 1:
    ine = ser.readline().rstrip()
    a,b,c = line.split(",")
    print a
    print b
    print c
    conn = httplib.HTTPConnection('')
    conn.request("GET", ("/update?key=API&field1="+a+"&field2="+b+"&field3="+c+"\n"))
int BAUDRATE = 57600;

// checksum variables
byte payloadChecksum = 0;
byte CalculatedChecksum;
byte checksum = 0;              //data type byte stores an 8-bit unsigned number, from 0 to 255
int payloadLength = 0;
byte payloadData[64] = {0};
byte poorQuality = 0;
byte attention = 0;
byte meditation = 0;

// system variables
long lastReceivedPacket = 0;
boolean bigPacket = false;
boolean brainwave = false;
void setup() {
  Serial1.begin(57600);       // Bluetooth
  Serial.begin(9600);      // software serial
 /// Serial.print("Communicating... ");
byte ReadOneByte() {
   int ByteRead;
  // Wait until there is data
  //Get the number of bytes (characters) available for reading from the serial port.
  //This is data that's already arrived and stored in the serial receive buffer (which holds 64 bytes)
  ByteRead =;
  return ByteRead; // read incoming serial data

unsigned int delta_wave = 0;
unsigned int theta_wave = 0;
unsigned int low_alpha_wave = 0;
unsigned int high_alpha_wave = 0;
unsigned int low_beta_wave = 0;
unsigned int high_beta_wave = 0;
unsigned int low_gamma_wave = 0;
unsigned int mid_gamma_wave = 0;

void read_waves(int i) {
  delta_wave = read_3byte_int(i);
  theta_wave = read_3byte_int(i);
  low_alpha_wave = read_3byte_int(i);
  high_alpha_wave = read_3byte_int(i);
  low_beta_wave = read_3byte_int(i);
  high_beta_wave = read_3byte_int(i);
  low_gamma_wave = read_3byte_int(i);
  mid_gamma_wave = read_3byte_int(i);

int read_3byte_int(int i) {
  return ((payloadData[i] << 16) + (payloadData[i+1] << 8) + payloadData[i+2]);

void loop() {
  // Look for sync bytes
  // Byte order: 0xAA, 0xAA, payloadLength, payloadData,
  // Checksum (sum all the bytes of payload, take lowest 8 bits, then bit inverse on lowest
if(ReadOneByte() == 0xAA) {
if(ReadOneByte() == 0xAA) {
payloadLength = ReadOneByte();
if(payloadLength > 169) //Payload length can not be greater than 169
payloadChecksum = 0;
      for(int i = 0; i < payloadLength; i++) {      //loop until payload length is complete
        payloadData[i] = ReadOneByte();             //Read payload
        payloadChecksum += payloadData[i];
      checksum = ReadOneByte();                     //Read checksum byte from stream
      payloadChecksum = 255 - payloadChecksum;      //Take ones compliment of generated checksum
      if(checksum == payloadChecksum) {
        poorQuality = 200;
        attention = 0;
        meditation = 0;
     brainwave = false;
     for(int i = 0; i < payloadLength; i++) { // Parse the payload
          switch (payloadData[i]) {
          case 02:
            poorQuality = payloadData[i];
            bigPacket = true;
          case 04:
            attention = payloadData[i];
          case 05:
            meditation = payloadData[i];
          case 0x80:
            i = i + 3;
          case 0x83:                         // ASIC EEG POWER INT
            brainwave = true;
            byte vlen = payloadData[i];
           // Serial.print(vlen, DEC);
          ///  Serial.println();
            i += vlen; // i = i + vlen
          }                                 // switch
        }                                   // for loop

        if(bigPacket) {
          if(poorQuality == 0){
          else{                             // do nothing

            if(brainwave && attention > 0 && attention < 100) {
            Serial.print(delta_wave, DEC);
            Serial.print(theta_wave, DEC);
            Serial.print(low_alpha_wave, DEC);



Similar projects you might like

Code-Free IoT with Arduino and The Tentacle on Octoblu!

Project tutorial by Aaron Herres

  • 47 respects

IoT Node with STM32F4 Discovery, MKR1000 and Azure IoT Hub

Project tutorial by vincent wong

  • 6 respects

IoT Notes Printer: Your Smartphone Notes on Paper

Project tutorial by Luigi Francesco Cerfeda and Daniele Mazzei

  • 35 respects

IoT Blink - Getting started with IoT

Project showcase by AppShed Support

  • 1 comment
  • 26 respects

IoT Garage Door Monitor/Opener with Finger Print Scanner

Project tutorial by

  • 46 respects

IoT arduino ESP Garage Door opener (UD)

Project in progress by David Smerkous

  • 23 respects
Add projectSign up / Login