Como determinar se uma pessoa está dormindo através de ondas cerebrais (Parte 7/13)

How to determine if a person is sleeping through brain waves (Part 7/13)

Determine if a person is sleeping using brain waves

SUMMARY

Previously in brainwave applications, we worked on controlling motor speed using the brain's level of attention. Now, it's time to check our study for some more real-time applications to detect whether brain waves can actually be used in everyday life or not. Currently in this article, I am planning to trigger something related to any type of brain wave. In real life, we may often want to know whether the patient (possibly our neighbor) is sleeping or not. So, I tried to make a device using Brainwave through which I can know if the person is sleeping with the help of a message/call.
Imagem mostrando detecção de sono por sensor de ondas cerebrais
Fig. 1: Image showing sleep detection by the brainwave sensor
DESCRIPTION
The values ​​of all types of brain waves are received by our Arduino with the help of a Mindflex Brainwave sensor. Our task here is just to find the wave that is most affected while the person is sleeping. However, we couldn't sleep during the experiment, so I switched it up a bit and tried using alertness. After all, we are less alert while we sleep and more alert while we are awake. The effect of alertness can be seen in many types of brain waves, but if we talk about a single wave, alpha waves show us many variations according to our alertness. So, first we checked the alpha wave values ​​at different alert levels and found that the alpha wave values ​​in mindflex range from 1 Lac to almost 10 Lacs. After further experiments, it was found that the values ​​rose to more than 3 Lacs when we slept. So we defined a level at 3 Lacs and whenever the values ​​were exceeded, a message was sent to the number written in the code.
Diagrama de blocos do detector de sono baseado no sensor de ondas cerebrais MindFlex
Fig. 2: Block diagram of sleep detector based on MindFlex brainwave sensor

Hardware: 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 it 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. For GSM, I used SIM908 module which has GSM and GPS. I powered the 908 module with 12V and used a sim together with its antenna. The RX TX of the 908 GSM is connected to the Arduino software serial pins.

Software: Let's discuss the software part. We have been receiving values ​​from the sensor to our arduino via T pin. Once we receive the value at some specific point, we can check whether the values ​​are above a certain point or not. Here in the following code, I stored the wave value in the num1 variable and then compared it with 309999. If the values ​​exceed, a serial data is sent to the GSM.
Serial.print(“Val = “);
Serial.println(num1);
if (num1>309999)
{Serial.Write(“ATD 77****0506;”);
}
Some points to note:
The sensor usually provides 60 to 80% resistance due to its orientation and the location 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 suffers depending on how we solder the wire to the T pin. Try shielding this wire and also make sure the reference probes are connected correctly. Make sure the GSM module is picking up the signal and that the SIM has enough power to make a call.
If you have any wires connected to the sensor's EEG pin, disconnect that wire as this will create a lot of noise in the sensor values. Try this experience and share your experience with us. Stay tuned for our next experiment that aims to ring an alarm after reaching a certain level of meditation.

Project source code

###

// Arduino Brain Library - Brain Serial Test
// Description: Grabs brain data from the serial RX pin and sends CSV out over the TX pin (Half duplex.)// More info: https://github.com/kitschpatrol/Arduino-Brain-Library// Author: Eric Mika, 2010 revised in 2014 #include // Set up the brain parser, pass it the hardware serial object you want to listen on.Brain brain(Serial);//char a(400);String a,a1;int v = 0;int z=0,output ;uint32_t num=0;uint32_t num1=0;void setup { // Start the hardware serial. Serial.begin(9600); pinMode(12, OUTPUT); pinMode(11, OUTPUT); digitalWrite(12,HIGH);} void 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; if (num1>309999) { Serial.Write(“ATD 77****0506;”); } }}
//Program to

###

Circuit diagrams

Circuit-Diagram-MindFlex-Brainwave-Sensor-Sleep-Detector

Project video

Related Content

Back to blog

Leave a comment

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