Engineers Garage

  • Electronics Projects and 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

Control Motor’s Speed using Meditation and Attention Level of Brain (Part 6/13)

By Arpit jain June 30, 2022

Control Motor Speed using Meditation and Attention Level of Brain

SUMMARY

After controlling the brightness of LED with brain’s meditation and attention level, let’s move on to more applications on Brain Wave. Since the resolution in the earlier experiment was not clear, we will now try a different experiment to get a clearer picture.  
In this article, I am again thinking of changing something which can give us a more clear understanding about the variations, say a DC motor. Here, we will control the speed of a motor using attention and meditation levels of our brain at any particular time.  We will be using Arduino UNO and mindflex sensor to read brain waves and a MOTOR to show the results.  We can also use an amplifier before the DC motor to see more variations in the speed.
DESCRIPTION
It is important to note that the speed of motor is controlled by PWM technique. It is the same technique we have used for the brightness control.
Quick Note: PWM technique is a technique to control analog devices by digital outputs. By digital outputs we are creating a square wave of ON and OFF patterns. This ON and OFF pattern is used to create analog voltage ranging between Low Voltage and High Voltage and we can vary the voltage by changing the duration of ON time with respect to OFF time.
If we pass this ON OFF pattern to the motor at a high speed, an analog voltage is received and the motor’s speed changes accordingly.
First, let us control the motor speed using the attention level.
So, now to control a motor speed, we will measure the attention level from e meters of the TGAM1 chip. Please note that this chip gives us the attention level on a scale of 0 – 100. It is also interesting to know that the chip transmits the meditation signals only when the sensor is accurately connected to the Brain and the sensor module is getting 100% signal strength. The signal strength ranges from 0 – 200.
Image showing speed of DC Motor being controlled by Meditation Level using Brainwave Sensor
Fig. 1: Image showing speed of DC Motor being controlled by Meditation Level using Brainwave Sensor
Dramatically, when the signal strength is 100% then the sensor sends 0 value, and when the sensor sends 200 this means, there is no connection of the metal sensor to our brain. So, after confirming that our signal strength is 100% and our sensor is sending 0 serially for signal strength we can perform this experiment.
Now we know that the PWM has a duty cycle which determines the analog level. The duty cycle is basically the On time divided by total time period. To change the speed of the MOTOR on the basis of attention level, we will change the duty cycle of PWM.
Image showing speed of DC Motor being controlled by Meditation Level using Brainwave Sensor
Fig. 2: Image showing speed of DC Motor being controlled by Meditation Level using Brainwave Sensor
We are getting the meditation value from the sensor on a scale of 0 -100. So we will make the value of duty cycle equals to the meditation value subtracted from 100. For example, if the meditation value from the sensor is 40 than the duty cycle is 100 – 40 = 60. This will make the MOTOR speed parallel to the meditation level. You can check the code and the video for this experiment. 
Now after the meditation level, we will do the same with the attention level. Just to remind you again, please check that the signal strength is coming 100% along with 0 value. We again need to take the attention values from the sensor and change the PWM duty cycle with respect to the attention values. Again make the value of duty cycle equals to the attention value subtracted from 100. For example, if the meditation value from the sensor is 40 than the duty cycle is 100 – 40 = 60. 
Image showing speed of DC Motor being controlled by Meditation Level using Brainwave Sensor.
Fig. 3: Image showing speed of DC Motor being controlled by Meditation Level using Brainwave Sensor
Check out the software section to see how PWM is implemented in the code. We are also done with the speed control using attention values. Check out the code and video to perform the experiment yourself.
Block Diagram of MindFlex Brainwave Sensor based DC Motor Speed Controller
Fig. 4: Block Diagram of MindFlex Brainwave Sensor based DC Motor Speed Controller
Hardware:  Please find the attached circuit diagram of the connections that need to be established. We have taken a pin from T pin of the mindflex sensor and connected that pin 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. After establishing the connections, we have used an amplifier to amplify the output of arduino. Moreover, we have used an l293d to drive the motor. The arduino PINS are connected to the input of l293d and then the motor is attached to it.
Software: The software part is exactly same as the LED brightness experiment. Still I have explained everything again so that you don’t have to go back.
Sensor is sending us the e meters value through the T pin. Once we have received the value at any particular point, we just need to convert that value level to the speed of MOTOR. As discussed previously, we will use PWM techniques.  The “analogWrite” function of arduino is used to implement the PWM technology
For example,
AnalogWrite(13,240);
AnalogWrite in arduino is use to write PWM wave to a pin. In above example, the first parameter is PIN Number and second is PIN value. So, we are writing 240 to pin 13. Now we can calculate the analog voltage at the value 240 easily. Total voltage range is 0v – 5v and value range is 0 – 255.
This means 240 = (5/255)*240 =  ~4.70V.
Now the values we get from e meters are in range 0 – 100.
So let’s say we get evalue = 70.
We will multiply the e value by 2.55 to make it in the range of 0-255.
So it will be analogWrite(pin,evalue*2.55) in a loop.
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 have also applied salt water at my forehead for better connectivity to the sensor.   The signal strength also disrupts about 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.
If you have any wire connected to the EEG pin of the sensor, please disconnect that wire as that will create a lot of disturbance in the sensor values. Try this experiment and let me know about your feedback. Stay tuned for our upcoming experiments that describes sending a message to detect if a person is sleeping. 

You may also like:


  • What are different types of industrial robots?

  • What types of motors are used in electric vehicles?

  • What is Wireless Electric Vehicle Charging System (WEVCS)?

  • What is the role of embedded software in electric vehicles?

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

  • What drone parts you need to build a quadcopter?

Project Source Code

###

//Program to 

#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(9, OUTPUT);
    }
 
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();
        //Serial.println(num);
        Serial.println(num1);
        analogWrite(9,output)
        
        //brain.readCSV().toCharArray(a,200);
    }
}
 

###


Circuit Diagrams

Circuit-Diagram-MindFlex-Brainwave-Sensor-DC-Motor-Speed-Controller

Project Video

​


Filed Under: Brainwave, Tech Articles, Tutorials

 

Next Article

← Previous Article
Next Article →

Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.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

  • How can I get the frequency please help!
  • differential amplifier with active load
  • Battery sensing circuitry for coin cell application
  • I/O constraint for Hold check
  • Question LCD LED IPS display

RSS Electro-Tech-Online.com Discussions

  • 100uF bypass Caps?
  • how to work on pcbs that are thick
  • Fuel Auto Shutoff
  • Actin group needed for effective PCB software tutorials
  • compatible eth ports for laptop

Featured – Designing of Audio Amplifiers part 9 series

  • Basics of Audio Amplifier – 1/9
  • Designing 250 Milli Watt Audio Power Amplifier – 2/9
  • Designing 1 Watt Audio Power Amplifier – 3/9
  • Designing a Bass Boost Amplifier – 4/9
  • Designing a 6 Watt Car Audio Amplifier – 5/9
  • Design a low power amplifier for headphones- 6/9

Recent Articles

  • ITG Electronics releases gate drive transformers with 200 – 450 V DC capability
  • Stackpole introduces HCJ jumpers with 70.7 amp continuous current capability
  • Infineon releases MCU with 128K flash and multi-sense capabilities
  • ST introduces 600V GaN gate drivers with 300 ns start-up time
  • ABLIC releases S-19116 automotive voltage detector with 6.8μs response time

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

  • Electronics Projects and 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