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.
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.
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
//Program to
###
Circuit diagrams
Circuit-Diagram-MindFlex-Brainwave-Sensor-Sleep-Detector |