The Neuroscience of Meditation

Using Neurofeedback to track Cognitive State

Manroop Kalsi
8 min readDec 13, 2021

Meditation can be defined as a form of mental training that aims to improve an individual’s core psychological capacities, such as attentional and emotional self-regulation.

Just as when you start going to the gym, you feel a difference, the changes don’t persist unless you stay consistent with working out. Meditation — a form of mental exercise — is similar in this case. Once you begin feeling the changes that meditation propels, many will continue practicing to retain the benefits.

Meditation is known to be used for many varying cases with just a few being: reducing stress, increasing concentration, regulating intense emotions, increasing self-awareness, and much more.

Despite there are many different types of meditation, most have 4 elements in common:

  • Location — a quiet place with limited distractions
  • Posture — a comfortable posture (sitting, lying down, etc.)
  • Focus of Attention — usually a word, set of words, object, or sensations
  • An Open Attitude — a focus on observing thoughts without judgment

For thousands of years, there was no way of testing scientifically whether meditation really worked. It was a purely internal experience discovered and verified by each new practitioner within their own mind. In the last few decades, new technologies have allowed us to objectively measure some of the effects of meditation. We’re far from a complete understanding, but early findings are fascinating.

Everything that we do affects our brain in some way. When we practice a specific skill, the regions of the brain related to the functionality of that skill begin growing bigger. More specifically, the neurons in the region begin to form stronger connections, or the connections may change.

On the contrary, when we don’t use a part of the brain, the region begins to shrink (the individual neural connections began to weaken). The ability of neural networks in the brain to change, grow, and reorganize is known as neuroplasticity, neural plasticity, or brain plasticity.

All this adds up to the question: How does meditation change the physical structure of the brain? Scientists have only touched the surface of beginning to understand the brain but despite this, according to calm some of the most prominent effects of meditation have been discovered as such: increased inter-connectivity, younger brain age, calming the brain, higher pain threshold, and groovy brain waves.

Increased inter-connectivity

In a company, there are different divisions that specialize in different types of work. Similarly, in the brain, there are different regions made out of grey matter that specialize in different things.

To work together, and for the company to smoothly function all the departments need to communicate and stay in sync- this might be done through the use of memos, emails, meetings, etc. The brain does this through white matter, which is like fiber optic cables that connect the different regions of the brain.

Let’s say you practice drawing an elephant once a day, over time while practicing this skill, you would get better at drawing that elephant. In meditation, while practicing it doesn’t only strengthen the specific brain regions that are being used but it also develops more communication channels between them (increased white matter).

More specifically, studies have shown that through meditation the Corpus Callosum, a white matter structure in the brain that connects the left and right side (no corpus callosum = left + right brain have no idea what each other are doing) physically grows bigger. In addition to this, the Superior Longitudinal Fasciculus connecting the front and the back of your brain has also been shown to increase.

Studies show that this increased white matter would mean there is better communication happening in the brain which could potentially be part of the explanation for why meditation results in an increased ability to regulate intense emotions and stress.

Younger brain age:

As we and the brain ages, it tends to lose mass — physically shrinking in the skull. This means that the brain of a 60-year-old would physically be smaller than the brain of a 25-year-old.

A study that compared the brain of mediators vs non-meditators, and recognized that the Cortical thickness (width of grey matter in the brain) of those aged 40–50, was the same as those aged 20–40 showing that meditators seem to maintain their overall brain mass.

In addition, according to neuroplasticity, the more we use certain parts of our brain the larger & stronger they become. Therefore, through meditation certain grey matter areas also tend to increase (those related with attention, sensory & global body awareness, and visual processing).

Calming the brain

We’ve all heard that those who meditate stress less and appear calmer. While increased connectivity of the brain is part of the reason, a study did also relates the amygdala into the explanation.

The amygdala activates the body’s fight or flight response. Through the 8 week study, scientists compared the size of the amygdala from before a person started meditating then after the 8 weeks the person was meditating. Through this, it was shown that the amygdala had reduced size after the meditation period, which may potentially reduce the tendency to freak out during stressful situations.

In addition, there is also evidence that meditation increases the size of brain regions responsible for regulating emotions. For example, those who meditate have been shown to have a larger hippocampus (an area that stops the release of stress hormones).

Increasing pain threshold

A study compared the pain tolerance of long-time meditators vs non-meditators. Scientists continued to up the temperature for participants until they wanted it to stop (no one was hurt!!) Those who meditated were less sensitive to pain in comparison to those who didn’t.

As a follow-up, through brain scans, researchers found that the Dorsal Anterior Cingulate (a key component to pain perception) of the long-term meditators was thicker, which may be why the meditators had decreased sensitivity and were able to tolerate higher temperatures (as they would have been unconsciously regulating their response to pain stimulus).

Groovy Brain Waves

In the brain, we have different frequencies for the different states:

  • Gamma Waves (32–100 Hz) — high degree of concentration
  • Beta Waves (13–32 Hz) — normal cognitive processing
  • Alpha Waves (8–13 Hz) — calm wakefulness
  • Theta Waves (4–8 Hz) — sleep or deep meditative state
  • Delta Waves (0.5–4 Hz) — high degree of synchronicity indicative of sleep

Those who were long-term meditators spent increased time emitting alpha waves (in comparison to those who don’t).

My Project

Note: The following portion of the article will run through my Python code, an understanding of Python is recommended but not necessary.

I created a project that classifies the brainwaves that you are emitting, and provides you a visual and written summary of your meditation session, showing how long you were in each state throughout the entire session.

The Hardware

  • Ganglion Board(basically the BCI equivalent of an Arduino)
  • OpenBCI’s dry electrodes

The Software

To build out the program I used the Brainflow library (learn more by reading Brainflow’s documentation). The Brainflow library consists of:

  • BoardShim- which reads data from a board
  • DataFilter-performs signal processing
  • MLModel-calculates derivative metrics and ability to use machine learning

My Code

Setting up + Connecting to the Ganglion

I used the board’s specific parameters, to connect to the Ganglion, and tell Brainflow how to work with it. I also initialized variables to run the program, track the overall time of the session, and timers to track the time spent in each cognitive state.

Classifying the Frequencies of the Brain Waves

I set up variables that would get the band power of the waves being emitted, and classify it based on the frequency parameters provided. Then I created a dictionary that would allow me to easily iterate over the frequencies (used later) and printed out the frequencies for the user to be aware during the session.

Keep track of Time (in seconds)

Using if statements, I first checked which cognitive state the user was in, and added that time to both the individual cognitive state tracker as well as the overall timer for the session.

Instructions, and stopping the Program

I printed instructions for the user so they know what to do and how to control the problem. I used an if statement that made it that if the space bar is pressed the program would stop, and the results would be released.

Calculating Minutes, and Percentage

As set up for the results I created dictionaries for the time the user spent in seconds, and minutes as well as the percentage of time the user spent in each cognitive state.

Printing Written Session Summary

Here I printed a written summary of the entire session, providing the duration of the session, duration in each cognitive state (in minutes), and the final percentage in each cognitive state.

Creating the Graph

Lastly, I created a graph for a visual representation of the summary of the session and stopped the program.

View the full code on my Github.

Program Demo

Let’s Connect!

If you enjoyed reading this article or learned something new, I’d love to connect on LinkedIn and Twitter. If you’d like to stay updated on my new articles or projects you can subscribe to my newsletter here!