Determine whether a Person is sleeping through Brain waves
SUMMARY
Previously in the Brain waves applications, we worked on controlling the speed of the motor using the attention level of the brain. Now, it is time to check our study for some more real-time applications to detect if Brain wave can actually be used in day-to-day life or not. Presently in this article, I am planning to trigger something related to any type of Brain wave. In real life, often we may want to know if the patient (possibly our close one) is sleeping or not. So, I have tried to make a device using Brainwave through which I can find out if the person is sleeping with the help of a message/call.

Fig. 1: Image showing Detection of Sleep by Brainwave Sensor
DESCRIPTION
The values of all the Brain wave types are received by our Arduino with the help of a Mindflex Brainwave sensor. Our task here is just to find the wave which is most affected while a person is sleeping. However, we cannot actually sleep in the experiment, so I slightly changed it and tried to use the alertness. After all, we are less alert while sleeping and more alert while being awake. The effect of alertness can be seen in many Brainwave types, but if we talk of one single wave then alpha waves show us many variations according to our alertness. So, first we checked out the values of alpha waves at different alertness levels and found out that alpha waves values on mindflex vary from 1 Lac to nearly 10 Lacs. After further experimentation, it was found that the values rose to more than 3 Lacs when we sleep. So we set a level at 3 Lacs and whenever the values exceeded a message was sent to the number written in the code.

Fig. 2: Block Diagram of MindFlex Brainwave Sensor based Sleep Detector
Hardware: Please find the attached circuit diagram of the connections that we need to establish. We have taken a pin from T pin of the mindflex sensor and connected it to the Rx pin of our Arduino UNO. Also, we have shorted the ground of both the Sensor and UNO by a wire. Please take special care while soldering anything to the Mindflex sensor as pins are very close to each other. For GSM, I have used SIM908 module which has both GSM and GPS. I have powered the 908 module with 12V and used a sim along with its antenna. The RX TX of the 908 GSM is attached with the software serial pins of arduino.
Software: Let us discuss the software part. We have been receiving values from the sensor to our arduino via T pin. Once we have received the value at any particular point, we can check if the values are above a certain point or not. Here in the following code, I stored the value of the wave in the variable num1 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;”);
}
Few points to Note:
The sensor usually gives the strength from 60 – 80% due to its orientation and the spot where we place it. Try to keep the metal sensor exactly above your left eye. I also applied salt water at my forehead for better connectivity to the sensor. The signal strength also disrupts depending as to how we solder the wire to the T pin. Try to shield this wire and also make sure that the references probes are correctly connected. Make sure that the GSM module is catching the signal and the sim has enough balance to make a call.
If you have any wire connected to the EEG pin of the sensor, please disconnect that wire as that will create a lot of noise in the sensor values. Try this experiment and share your experience with us. Stay tuned for our forthcoming experiment that aims at buzzing an alarm after achieving a certain level of meditation.
You may also like:
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
Project Video
Filed Under: Brainwave, Electronic Projects, PIC Microcontroller, Tech Articles, Tutorials
Filed Under: Brainwave, Electronic Projects, PIC Microcontroller, Tech Articles, Tutorials
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.