Usando ondas cerebrais para soar o alarme após atingir um certo nível de meditação (Parte 8/13)

Using brainwaves to sound the alarm after reaching a certain level of meditation (Part 8/13)

Using brain waves to emit alarm

SUMMARY

Previously in the brainwave series, we used GSM with brainwaves to detect whether a person is sleeping. The same experiment can be extended further with a different perspective. Now in this article, I am planning to explore more applications of Brainwaves .
These days I'm trying to meditate to stay calm. Since meditation helps a person in so many ways, I thought of trying it out and it proved to be very helpful. However, as I meditated, I noticed that I couldn't guess how well I was doing in meditation. As a result, I decided to use brainwaves to develop a device that could inform me if I reached a certain level. It may also be useful for practitioners and meditators in the future.
Imagem mostrando o nível de meditação detectado usando o sensor de ondas cerebrais
Fig. 1: Image showing the level of meditation detected using the brainwave sensor
DESCRIPTION
you know we are getting the values ​​of all types of brain waves from our Arduino, here our task is just to find the wave which is most affected by meditation. Now the alpha waves show us again many variations according to our meditation. So, first we check the alpha wave values ​​at different alert levels. I tried my level of meditation and then recorded them for testing purposes.
Imagem mostrando o nível de meditação detectado usando o sensor de ondas cerebrais
Fig. 2: Image showing the level of meditation detected using the brainwave sensor
When testing on myself, I found that the alpha wave values ​​crossed 2 Lacs very rarely and only when my concentration was highest. So I set the level to 2 Lacs in my Arduino coding. This value can be defined from person to person. As the values ​​of mindflex range from 1Lac to 7 Lacs, so we set a level at 2 Lacs and whenever the values ​​were higher than that we started sending signals to the speaker in order to output a sound.
Diagrama de blocos do detector de nível de meditação baseado no sensor de ondas cerebrais MindFlex
Fig. 3: Block diagram of meditation level detector based on MindFlex brainwave sensor

Hardware:

Please find the attached circuit diagram of the connections we need to establish. We take a pin from the T pin of the mindflex sensor and connect this pin to the Rx pin of our Arduino UNO. Additionally, we short-circuited the Sensor and UNO ground by a wire. Take special care when soldering anything to the Mindflex sensor, as the pins are very close to each other. After that, we connect the 11th and 12th pins to a small 4ohm speaker.
Software:
Let's move on to the software part. We have been receiving the values ​​from the sensor to our arduino via T-pin. Once we receive the value at any specific point, we just need to check when the values ​​cross a certain threshold. As soon as the values ​​exceed a certain limit, we trigger the alarm by sending high and low values ​​to pins 11 and 12 of the Arduino. A 100 loop was provided to make a wave which is sent to the speaker to sound the alarm.
if (num1>309999)
{ for(int j=0;j<100;j++)
{
digitalWrite(11,HIGH);
digitalWrite(12,DOWN);
delay(100);
digitalWrite(12,HIGH);
digitalWrite(11,DOWN);
delay(100);
}
Some points to note:
The sensor typically provides 60 to 80% resistance due to its orientation and where we place it. Try to keep the metal sensor exactly above your left eye. I also applied salt water to my forehead for better connectivity with the sensor. The signal strength also messes with how we solder the wire to the T pin. Try shielding this wire and also make sure the reference probes are connected correctly.
If you have any wire connected to the EEG pin of the sensor, disconnect that wire as it will create a lot of disturbances in the sensor values. Try this experience and share your experiences with us. Next, we will work on controlling a device using a relay.

Project source code

###

 //Program to

// Arduino Brain Library - Serial Brain Test
// Description: captures brain data from the RX serial pin and sends CSV via the TX (Half duplex) pin. // More information: https://github.com/kitschpatrol/Arduino-Brain-Library // Author: Eric Mika, 2010 revised 2014 #include // Configure the brain analyzer, pass it the hardware serial object you want to listen to. Brain (Serial); //char a(400); Sequence a,a1; int v = 0; int z=0,output; uint32_t num=0; uint32_t num1=0; empty configuration { // Start the hardware serial. Serial.begin(9600); pinMode(12, OUTPUT); pinMode(11, OUTPUT); } empty loop { // Expect packets about once per second. // The .readCSV function returns a string (well, char*) listing the most recent brain data, in the following format: // "signal strength, attention, meditation, delta, theta, low alpha, high alpha, low beta, high beta, low gamma, high gamma" if (brain.update ) { //Serial.println(brain.readErrors ); //Serial.println(brain.readCSV ); //sprintf(a, "%c",brain.readCSV ); a = brain.readCSV; v = a.indexOf(','); v = a.indexOf(',',v+1); v = a.indexOf(',',v+1); v = a.indexOf(',',v+1); z = a.indexOf(',',v+1); a1 = a.substring(v+1,z); num = a1.toInt ; v = a.indexOf(',',z+1); a = a.substring(z+1,v); num1 = a.toInt; //Serial.println(num); Serial.println(num1); if (num1>309999) { for(int j=0;j<100;j++) { digitalWrite(11,HIGH); digitalWrite(12,DOWN); delay(100); digitalWrite(12,HIGH); digitalWrite(11,DOWN); delay(100); } } // analogWrite(12, output) //brain.readCSV .toCharArray(a,200); } }

###

Circuit diagrams

Circuit-Diagram-MindFlex-Brainwave-Sensor-Meditation-Level-Detector

Project video

Related Content

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.