Brain waves to Control an Appliance Using Relay Motor
SUMMARY
Till now in the brain waves series, we have undertaken the experiments like GSM and alarm speaker. Now let us try further and move to more real time applications. It will be a good check on the reliability of the Brain wave module.
In this article I am planning to go for some real time applications on Brain wave including Home Automation. This time I have tried to control an appliance using relay. Relay is just a switching device through which we can trigger both AC and DC appliance. Though it also depends on the maximum current that the relay can trigger and the total current our appliance needs. I believe it will be nice to control home appliances just by thought and higher level of concentration. So let’s see more details about it.
Fig. 1: Image Showing Home Appliances Controlled by Brain Wave
DESCRIPTION
As you know that we are getting the values of all the Brain wave types from our Arduino, our task here is just to find the wave which is most affected by alertness or concentration. Alpha waves show us many variations according to our alertness. So, we first check out the values of alpha waves at different alertness levels. I have tried my meditation level and then recorded them for testing purpose. While testing it on myself, I found that values of alpha waves cross 3 Lacs only when my concentration is highest. So I set the level of 3 Lacs in my arduino coding. We found out that alpha waves values from mindflex varies from 1 Lac to 10 Lacs and hence we set a level at 3 Lacs. Whenever the values were more than that we triggered the relay.
Fig. 2: Block Diagram of MindFlex Brainwave Sensor based Home Automation System
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 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 connection with the Mindflex, we just need to connect the relay to the arduino and then the appliance with that of relay. For more details about the Relay, you can check (here). Explaining it briefly, it has 5 pins out of which two are meant for supply of coil and remaining three are -Common pin , Normally connected pin and Normally open pin. When there is no supply to the coil, the common pin is connected to normally connected pin and when there is supply in the coil, the common pin gets connected with the normally open pin instead of normally connected. In our circuit, we have connected PIN12 of our arduino with the supply pin of relay. The other supply pin of relay is grounded.
Softwares : Let us come to 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, the value of the wave is stored in the variable num1 and then it is compared with 309999. When the values go above that, the PIN12 of arduino is triggered.
Serial.print(“Val = “);
Serial.println(num1);
if (num1>309999)
{ if (digitalRead(12)==HIGH)
{
digitalWrite(12,LOW);
}
else if (digitalRead(12)==LOW)
{
digitalWrite(12,HIGH);
}
}
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 much noise in the sensor values. Try this experiment and share your feedback. Stay tuned for our next experiment on operating dancing LEDs through brainwaves.
Project Source Code
###
//Program to// 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();Serial.print("Val = ");Serial.println(num1);if (num1>309999){ if (digitalRead(12)==HIGH){digitalWrite(12,LOW);}else if (digitalRead(12)==LOW){digitalWrite(12,HIGH);}}// analogWrite(12,output)//brain.readCSV().toCharArray(a,200);}}###
Circuit Diagrams
Project Video
Filed Under: Brainwave, Electronic Projects, Tech Articles, Tutorials
Filed Under: Brainwave, Electronic Projects, Tech Articles, Tutorials
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.