Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe

How to determine whether a Person is sleeping through Brain waves (Part 7/13)

By Arpit jain October 28, 2021

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.   
Image showing Detection of Sleep by Brainwave Sensor
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.
Block Diagram of MindFlex Brainwave Sensor based Sleep Detector
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:


  • What are the components of robotic arms and industrial robots?

  • What are the sensors used in self-driving cars?

  • What is LiDAR and how does it work?

  • What is Light Fidelity (Li-Fi)?

  • What are different types of IoT networks?

  • Motion detectors or motion sensors?

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


Filed Under: Brainwave, Electronic Projects, PIC Microcontroller, Tech Articles, Tutorials

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

EE TECH TOOLBOX

“ee
Tech Toolbox: Internet of Things
Explore practical strategies for minimizing attack surfaces, managing memory efficiently, and securing firmware. Download now to ensure your IoT implementations remain secure, efficient, and future-ready.

EE Learning Center

EE Learning Center
“engineers
EXPAND YOUR KNOWLEDGE AND STAY CONNECTED
Get the latest info on technologies, tools and strategies for EE professionals.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


RSS EDABOARD.com Discussions

  • Reducing "shoot-through" in offline Full Bridge SMPS?
  • High Side current sensing
  • How to simulate power electronics converter in PSpice?
  • Voltage mode pushpull is a nonsense SMPS?
  • Layout IRN reduction in Comparator

RSS Electro-Tech-Online.com Discussions

  • Back to the old BASIC days
  • Parts required for a personal project
  • PIC KIT 3 not able to program dsPIC
  • Failure of polypropylene motor-run capacitors
  • Siemens large industrial PLC parts

Featured – RPi Python Programming (27 Part)

  • RPi Python Programming 21: The SIM900A AT commands
  • RPi Python Programming 22: Calls & SMS using a SIM900A GSM-GPRS modem
  • RPi Python Programming 23: Interfacing a NEO-6MV2 GPS module with Raspberry Pi
  • RPi Python Programming 24: I2C explained
  • RPi Python Programming 25 – Synchronous serial communication in Raspberry Pi using I2C protocol
  • RPi Python Programming 26 – Interfacing ADXL345 accelerometer sensor with Raspberry Pi

Recent Articles

  • What is AWS IoT Core and when should you use it?
  • AC-DC power supply extends voltage range to 800 V DC
  • Infineon’s inductive sensor integrates coil system driver, signal conditioning circuits and DSP
  • Arm Cortex-M23 MCU delivers 87.5 µA/MHz active mode
  • STMicroelectronics releases automotive amplifiers with in-play open-load detection

EE ENGINEERING TRAINING DAYS

engineering

Submit a Guest Post

submit a guest post
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • Battery Power Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • EV Engineering
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • Subscribe to our newsletter
  • About Us
  • Contact Us
  • Advertise

Copyright © 2025 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy

Search Engineers Garage

  • Electronic Projects & Tutorials
    • Electronic Projects
      • Arduino Projects
      • AVR
      • Raspberry pi
      • ESP8266
      • BeagleBone
      • 8051 Microcontroller
      • ARM
      • PIC Microcontroller
      • STM32
    • Tutorials
      • Audio Electronics
      • Battery Management
      • Brainwave
      • Electric Vehicles
      • EMI/EMC/RFI
      • Hardware Filters
      • IoT tutorials
      • Power Tutorials
      • Python
      • Sensors
      • USB
      • VHDL
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Product News
    • Business News
    • Company/Start-up News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • DigiKey Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Learn
    • eBooks/Tech Tips
    • Design Guides
    • Learning Center
    • Tech Toolboxes
    • Webinars & Digital Events
  • Resources
    • Digital Issues
    • EE Training Days
    • LEAP Awards
    • Podcasts
    • Webinars / Digital Events
    • White Papers
    • Engineering Diversity & Inclusion
    • DesignFast
  • Guest Post Guidelines
  • Advertise
  • Subscribe