Have you ever wondered about controlling things using your thoughts? If you concentrate on lights or TV and think of triggering them ON or OFF with just your thoughts, will you be able to do so? The answer is YES.Â
To achieve this, the brain data corresponding to the level of mental attention needs to be obtained using an EEG sensor. This level is then given a threshold value. When the attention level goes above this threshold value, then lights or other IoT connected appliances (that were thought of) switch on.Â
Sounds highly interesting and quite futuristic as well? So let’s start the project by shopping for the following components.
Bill Of Material Â
PrerequisiteÂ
There are various EEG sensors such as OpenBCI, NeuroSky MindWave etc, available in the market. For this project, the Neurosky MindWave Mobile 2 EEG sensor is being used. So install the Bluez driver into the Raspberry Pi. If you have the latest version of the Raspbian OS, then there is no need to do so as the driver and relevant software is pre-installed.Â
Now open the Bluetooth devices in the settings and pair the EEG sensor via Bluetooth with the Raspberry Pi. On successful connection with serial ports, a message with the serial port name will be displayed. Note it down.Â
Next, retrieve the EEG sensor data over Bluetooth using Python. Note here that different sensors have different Python modules and libraries that read EEG sensor data. Since we have used MidWave 2 here, install its Python module named NeuroPy. Open the terminal and install this module using pip.
sudo pip3 install NeuroPy (for Python 3). Because the library faces some problems with Python 3, Python 2 has been used instead. sudo pip install NeroPy (for python 2)
Because the EEG sensor is already paired with the Raspberry Pi, you can read the connected EEG sensor data. Now wear the EEG sensor on your head. To test the EEG sensor data, clone the library and then run the test example code using following
sudo git clone: https://github.com/lihas/NeuroPy cd NeuroPY/NeuroPy  Python test.pyÂ
The library will help you obtain the following EEG sensor data:Â
- Low theta waves
- High theta wavesÂ
- Low beta wavesÂ
- High beta wavesÂ
- High gamma wavesÂ
- Low gamma waves
- AttentionÂ
- MeditationÂ
- WavesÂ
- Eyeblink
To control the connected IoT devices such as electric lights, fans, etc, use the Attention, Meditation and Eyeblink data.
CodingÂ
First, include the NeuroPy and gpiozero Python modules in the code. Then set the COM port name for the EEG sensor.
After doing so, set the pin number for controlling the electric lights, fans, etc.
Next, create a function that checks the brain signals/waves like alpha waves, beta waves, gamma waves and so on, so that your attention value can be determined. If it exceeds the pre-set threshold value of 80 while thinking of switching ON/OFF the desired electric device (in this case electric lights), then it will occur automatically – like magic.
Connection
TestingÂ
After making the appropriate connections, run the code in an IDE or terminal and concentrate on switching a light bulb ON/OFF with your thoughts. When they meet or exceed the set threshold value, the light bulb will glow instantly.
 Congrats !!!! You have just controlled an electric device using your thoughts
Sir please provide me the link of EEG sensor
You can buy EEG sensor from nay online store Amazon , Flipkat etc
http://neurosky.com/ I have used this eeg sensor but you can also use eeg sensor of MUSE, Open BCI etc