As per our previous Neurosky post, we now have our Neurosky Mindwave Mobile Device connected to our Raspi3B, and are reading data into the device, as can be seen with Picocom (remember to wait for the connection to establish and read data).
Now, we need to do something interesting with the data. For this , we will use the Pisound Pihat, available from Blockas in the UK. The Pisound Pihat provides a button to start our bash script, which will connect to the MindWave headset.
Our C script will now write to a file, which will house the current Mindwave readings.
The bash script will also start a Puredata instance, which reads the file into a puredata array. It’s left to the user to apply a puredata patch apart from a simple oscillator.
The goal is to create Brainwave powered music.
Copy the scripts to the pisound button scripts folder.
Configure the button functionality with
I used a single buton click to start headless mode, which starts puredata without the UI. This is for playing out.
I used a 3 second hold of the button to start regular puredata in order to configure patches.
Add your Bluetooth device ID to the script in place of the current ID using vi or nano.
Place the BW folder on your desktop. The script looks for the folder here, under the Pi user.
Make sure that Puredata is installed as per the Pisound instructions.
Compile the C script as per your needs, or examine it to determine which of the e-sense dat points occur on which line of the Raw data file.
It is currently configured to read the exact place digits of the data, line by line.
Make sure that Puredata is configured to generate sound! There is a puredata config file in the folder that should take care of starting it with the proper settings.
Apply the brainwaves as settings to your favorite Puredata patches!