Close
0%
0%

heg4all

Fix or improve your brain with the simplest and least intrusive technique currently available, hemoencephalography, DIY style

Similar projects worth following
This project consists of publishing a DIY approach to building a low-cost version of a biofeedback device using the least intrusive technique currently available, hemoencephalography (HEG). HEG is a technique that consists in an indirect measurement of the blood flow on a specific region of the brain, for example the forehead, and turning that measure into a performance score. Increasing the blood flow will consequently increase brain activity and performance on tasks involved with that region of the brain.

This project resorts to the Passive Infrared (pIR) approach in HEG that couples the amount of heat being generated in a brain region, as well as the local blood oxygenation, to cerebral blood flow. For that, an infrared temperature sensor is used with an analog-digital converter to read the temperature and output it over a serial port. Software will then track this temperature and calculate positive rate of change before converting it to feedback to the user.

The challenge the project addresses
The prefrontal cortex (PFC) is the region of the brain that governs what are designated as executive functions (working memory, mental flexibility, and self-control) and overall cognitive performance. Poor functioning of the PFC is associated with many disorders such as anxiety disorders, learning disorders, schizophrenia, attention deficit disorder (ADD) and autism, among others. 

How can this project alleviate or solve the problem described above
Researchers and practitioners are shifting their efforts towards biofeedback techniques as the evidence piles up with good results and positive impact. Hemoencephalography (HEG) is a neurofeedback technique particularly geared to be used with the PFC region that benefits from an easy and simple setup and usage. Unfortunately commercial HEG systems cost hundreds to thousands of US dollars which make them hardly accessible to the general population. This is particularly appalling when you take into account the complexity associated with most of these commercial devices. This project aims to democratize the HEG technique by providing the plans to build a low-cost HEG system (under 40 US dollars) to conveniently use at home.

How can this be world changing
Acording to data from 2015 there are around 51.1 million people with ADD alone in the world. In the US alone, anxiety disorders account for around 40 million people. Migraine is the sixth highest cause of disability worldwide. And I would argue that anyone not performing to their full cognitive potential, could benefit from this technique.

It might not be groundbreaking but it surely can be game-changer, for everyone.

I2Cmaster Library.zip

Arduino IC2 library

x-zip-compressed - 14.78 kB - 09/01/2017 at 00:32

Download

MLX90614_hookup.png

circuit hookup

Portable Network Graphics (PNG) - 39.23 kB - 09/01/2017 at 00:16

Preview

  • 1 × MLX90614 Sensor Digital non-contact infrared thermometer
  • 1 × Arduino UNO

  • Credit's due

    allstargajo09/02/2017 at 23:00 0 comments

    I've struggled quite a bit before creating this project. Ever since I learned about Hackaday Prize I waited patiently for someone to submit something similar so I wouldn't be tempted to submit this myself.

    You see, this endeavor is not mine to claim. In 2016, on another forum, someone proposed to create a low-cost HEG system and then someone else follow through. The nature of the forum has barely anything do to with hardware so it's not a surprise that this contest might have gone unnoticed. But now the deadline for what seems to be the last chance this project has of getting some deserved attention is imminent and I cannot let it pass by.

    I believe neither users would be against this, so I decided to publish the project and submit it to Hackaday Prize but not without acknowledging them rightly first. 

  • HEG and what good is this project for?

    allstargajo09/02/2017 at 00:12 0 comments

    Hemoencephalography (HEG) is a technique based on two main ideas: 

    1) That human beings can consciously alter their brain function, changing the signal generated by their brains; and
    2) There is a correlation between cerebral blood flow and cerebral neural activation.

    HEG offers two approaches, near-infrared and passive infrared, which you can learn more about in the usual place but suffice to say that if you choose the pIR approach you can drastically reduce the complexity of the system and its cost.

    A pIR HEG system is essentially an infrared temperature sensor connected to an ADC that reads the temperature and outputs it. A piece of software tracks this measurement and calculates the upward variation rate in temperature. This score can be directly applied to a source of audio/video feedback informing the user of how much blood is flowing in a particular area of the brain. Over time the brain learns that in order to hear the sound or watch the video or make a LED blink faster or brighter it has to increase blood flow.

    Despite being relatively simple, a typical commercial HEG system costs several hundreds to thousands of US dollars so its price versus its complexity is shocking to say the least. As mentioned in the previous blog entry, the purpose of this project is to raise awareness to the technique while also democratizing the access to that same technique. With a bill-of-materials between 20 to 40 US dollars I believe it does just that.

    And what is this good for? Why bother with any of this? Well, it happens that one of the most suitable areas for using HEG is the forehead. This area is home to the prefrontal cortex (PFC) which is the area that governs the high level executive functions of human beings. Medical conditions like schizophrenia, bipolar disorder, ADHD and major depressive disorder are all associated with a state of decreased cerebral blood flow in the PFC. Then again you don't have to have a medical condition to benefit from this technique, since the PFC is widely believed to play a major role in short-term memory, attention, personality expression, decision making, reasoning among conflicting thoughts and overall cognitive performance, so one could potentially improve all of these by purposely increasing its cerebral blood flow in the PFC region.

    So, give it some thought. The worst that can happen to you, I would argue, is a slight headache from consciously focusing too hard on a particular area of your skull as you will not be doing anything that you couldn't already be doing.

  • Introduction and Motivation

    allstargajo08/31/2017 at 10:26 0 comments

    This project aims to bring attention to what I believe should be our next frontier as a species. Just like Space it can catapult Humanity to a new era but contrary to Space this one is far far closer.

    Most of us will go the extra mile for improving our looks or our muscles but rarely think of our brain in the same way. Maybe because one can't see it or be praised for it as easily as the other two the brain is rarely given a second thought when it comes to improvement and most just accept it as if it was unchangeable. Well, the brain is all BUT unchangeable and although it isn't a muscle it surely displays the same properties that enable it to be trained to be improved.

    We've seen (pharma, hardware, software) tools popping up, not just in the DIY movement, but also as commercial products that are aiming to democratizing the brain-enhancement goal. But tinkering with the brain understandably has something unnerving about it that causes most people to either shy away from it, or worse, to fear it and refuse to learn or acknowledge it.

    Fortunately there's a technique called hemoencephalography (HEG) which we can use to meaningful improve our cognitive functions and confidently know that it cannot cause any sort of damage. Unfortunately the price of most commercial HEG systems is still very high for the general population. That is where this project comes in and hopefully make a difference.

View all 3 project logs

  • 1
    Hardware hookup

    Wiring the MLX90614 with the arduino should be straightforward. Just follow the hookup image file provided in this project.

    In a nutshell, power the sensor using the 3.3V rail, wire up SDA to analog input pin 4 and SCL to analog pin 5, and add 4.7kΩ pull-up resistors to both the data line and the clock line. The sensor datasheet advises the use of a .1uf capacitor between power and ground but I did not use it and the circuit works well without it.

  • 2
    Software

    Before anything else you need to have the ic2master library into your Arduino library folder for any of the code below to work. For convenience I've added the library to this project but you can go download it from where I got it or simply search for "ic2master library".

    Once that is out of the way dive right into the code below. Be advised that initial parameters might have to be adjusted for it to work properly. That is something that is intrinsic to the technique due to the wide variations in blood flow and skull thickness from one person to another.

    #include <i2cmaster.h>
    //Parameters
    int del_noise = 10; //take the average of 10 temp
    float led_sensitivity = 15000; //255...1000000
    float sleep = 20; //read temp every 20ms
    int led_pin = 11; //LED Pin absolute
    int equi_step = 100; //1000ms between each equilibration temperature
    int equi_times = 20; //take 20 steps for equilibration that last *equi_step*
    float norm[10]; //has to be the same as del_noise
    float treshold = 10; ///treshold led analog intensity
    //Variables
    float avrg = 0; //do not change
    float celsius_old = 0;//do not change
    float celsius_old2 = 0;//do not change
    float analog = 0;//do not change
     //Functions
    float i2c(){
      int dev = 0x5A<<1;
      int data_low = 0;
      int data_high = 0;
      int pec = 0;
     
      i2c_start_wait(dev+I2C_WRITE);
      i2c_write(0x07);
     
      // read
      i2c_rep_start(dev+I2C_READ);
      data_low = i2c_readAck(); //Read 1 byte and then send ack
      data_high = i2c_readAck(); //Read 1 byte and then send ack
      pec = i2c_readNak();
      i2c_stop();
     
      //This converts high and low bytes together and processes temperature, MSB is a error bit and is ignored for temps
      double tempFactor = 0.02; // 0.02 degrees per LSB (measurement resolution of the MLX90614)
      double tempData = 0x0000; // zero out the data
      int frac; // data past the decimal point
     
      // This masks the error bit of the high byte, then moves it left 8 bits and adds the low byte.
      tempData = (double)(((data_high & 0x007F) << 8) + data_low);
      tempData = (tempData * tempFactor)-0.01;
     
      float cels = tempData - 273.15;
     
      return cels;
    }
    void setup(){
        pinMode(led_pin, OUTPUT);
        digitalWrite(led_pin, HIGH);
        
        Serial.begin(9600);
        Serial.println("Setup...");
        
        digitalWrite(led_pin, LOW);
        i2c_init(); //Initialise the i2c bus
        PORTC = (1 << PORTC4) | (1 << PORTC5);//enable pullups
        digitalWrite(led_pin, HIGH);
        
      digitalWrite(led_pin, LOW);
      digitalWrite(led_pin, HIGH);
      digitalWrite(led_pin, LOW);
      Serial.println("Equilibrate...");
     
      for (int i = 0; i < equi_times; i++) {
          digitalWrite(led_pin, HIGH);
          delay(equi_step/2);
          digitalWrite(led_pin, LOW);
          delay(equi_step/2);
        }
        
      Serial.println("Norming...");
      for (int i = 0; i < del_noise; i++) {
        norm[i] = i2c();
        delay(sleep);
      }  
    }
    int i = 0;
    void loop(){
      i++;
      float percent = 0;
      float celsius = 0;
      for (int i = 0; i < (del_noise-1); i++) {
          norm[i] = norm[i+1];
          celsius += norm[i];
      }
      norm[del_noise-1]=i2c();
      celsius += norm[del_noise-1];  
      celsius = celsius/del_noise;
      Serial.println("Celsius");
      Serial.println(celsius);
      Serial.println(celsius_old);
      if ((celsius_old != 0) && (celsius_old2 != 0)) {
        percent = (celsius/celsius_old2)-1;
        analog = percent * led_sensitivity;
      }
      celsius_old = celsius;
      celsius_old2 = celsius_old;
      if (i == 10){ //write percent each 10th value to serial port
      Serial.println(percent);
      i = 0;
      }
      if (analog <= treshold) {
        analog = 0;
      }
      if (analog > 255) {
        analog = 255;
      }
      analogWrite(led_pin, analog);
      delay(sleep);
    }

View all instructions

Enjoy this project?

Share

Discussions

freebooks106 wrote 11/15/2019 at 20:37 point

library management system is the very helpful and informative system for those people who wan to become a librarian in the future.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates