Reading brain waves with Espruino #1081
Replies: 27 comments
-
Posted at 2015-04-27 by alexanderbrevig Fantastic! :D |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-27 by d0773d Very, iteresting. I've always wanted to demo/test reading brainwaves, but I have always been skeptical about how well a device could read brainwaves. I wonder how well this device would work: https://www.sparkfun.com/products/12805 Although, I really like your diy approach and would probably feel less bulky than the unit that sparkfun sells and less $$$! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-27 by @gfwilliams Wow, looks awesome! I love the idea of detecting dreams and playing audio to prompt people! Just pulled the module in - I'll stick it online next time I update the website. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-27 by Dennis @d0773d, the NeuroSky Mindwave Mobile (sold by sparkfun) uses the exact same ASIC module (TGAM) and is actually made by the company who developed that chip. I know this headset because I have that one as well. The idea behind the product is that anybody should be able to develop EEG applications without having to care about hardware or interfacing a board. Besides the TGAM, the headset includes a Bluetooth module which can be paired with a computer or a smartphone. It also comes with a driver for PC and Mac which can be used from your own applications so you don't have to mess with the low level protocol. That product makes sense (this is why I bought it) and you can easily develop computer or mobile applications which use it. However, for my lucidity project, I want to make an integrated self-contained device. I don't want to stream data over bluetooth, I want to have my Espruino directly in the unit. Furthermore I wouldn't want to sleep with that headset on, I'll rater make my own which should be more comfortable. A good thing about the headset is that it has great signal quality through the integrated electrodes. My own design with the penny electrodes still triggers a "poor signal" message and the chip refuses to calculate attention and meditation values if "poor signal" is greater than 0. I need to keep working on my electrodes. If you're interested in the headset, I'd sell mine for a good price. I'm in Germany. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-05-03 by d0773d @dennis Thank you for wanting to sell the headset a good price. Right now I have so many projects that I am working on that need to get finished at some point before I take on another. Thank you, though. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-13 by psc1988 Are someone still working with brainwaves and Espruino? I have a Neurosky Mindwave Mobile 2 Headset and would like to read the meditation and attention data. Can someone help? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-15 by @gfwilliams I'm not sure if anyone is currently doing anything, but there is a module to allow communications between Neurosky devices and Espruino: http://www.espruino.com/Brain |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-15 by psc1988 Hi Gordon, thanks. So without that module do you think its not possible to get a bluetooth connection + reading out data from the NeuroSky Headset directly on a MDBT42Q or Puck? Greetings |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-15 by psc1988 I see thats the module which is integrated in the headset. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-15 by psc1988 Is there a possibility to install the module onto MDBT42Q. Its my first time, working with modules on espruino. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-15 by BenJabituya Interesting project, I have a Muse S headband, which seems to work well for sleep tracking and brainwave data. On the subject of tracking sleep and general hypnogram cycles I do think indirect data points such as changes in heartrate and movement provide decent info when I benchmark against the Muse - it's not 100% of course but I find it's more practical for regular use. I've been working on a sleeptracker for the Bangle.JS that takes HRM data and movement to attempt charting sleep cycles, it wouldn't take all that much more to put in a smart alarm feature as well as possibly a REM alarm in theory - REM and wakefulness would be towards the peaks of these cycles so you just need to detect peaks and trigger an alarm soon after the descent. A REM alarm on this would probably need to be via bluetooth to another device as the sound wouldn't be loud enough on the Bangle, and I suspect the motor wouldn't have much effect because of sleep paralysis in REM.Attachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-16 by @gfwilliams Ahh - so that code is there to talk to this hardware by the look of it: https://store.neurosky.com/products/eeg-tgam If you had that hardware there's no need to mess around with GitHub, you just copy/paste the code from that page into the right hand side of the Web IDE, wire up as suggested, and it'd work. However it seems the Neurosky Mindwave Mobile 2 is a completely wireless solution - so realistically I don't think that code is going to work for you. What you'd need to do is either find some information on the Bluetooth protocol used online and try and implement it in Espruino (we could help with that), or to actually connect with an app like 'NRF Connect' on your phone and see if you can figure out how it works yourself. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-16 by psc1988 Hi Gordon, thanks for your answer. I have been able to establish a Bluetooth connection with the device. Found a service and characteristics UUID in an Arduino forum. However, how I should read the data now (with what code), I'm stumped. Had tried it with the combination of the module suggested by you and about the known to me BLE connection setup in the WEB IDE.
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-16 by @gfwilliams Hi, that's great. What I'd suggest is to maybe try this and see if it works:
At least then you should get a hex dump whenever the data changes. Maybe you could post the results up here and it might give us some idea of how to pull the data out. Do you have a link to the Arduino forum? Did they give any hints about how to decode the data? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-16 by psc1988 Hey, sure I will try it. Yes, please find here the link, its Post#5 in the forum: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-16 by psc1988 So the connection works but I don´t get any data. Found |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-17 by @gfwilliams Ok, thanks! It looks like there are some other characteristics reported there:
I can't remember offhand what the properties mean, but it might be worth trying some of those and seeing if you get data from them? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-17 by psc1988 Hi Gordon, so I just get zeros as values. I tried it with the hex code 0x04 (attention level). I added var buf = 0x04 in the code. Found this documentation on the thinkgear website with the codes:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-18 by @gfwilliams So did you try any other characteristics, or just To write data, you'd need to do something like :
But as they have developer docs, I wonder whether you could actually just get in touch with them and ask them if they have an explanation of their Bluetooth protocol? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-19 by psc1988 I've asked about it, but I'm still waiting to hear back. You can read the hex addresses from the documentation. Do you think I could try it via a module? However, I have not really understood how this works with the modules on a local storage location. I know your documentation but don't know how it is meant to put the module in when you have created a new empty folder via Settings >>> Projects. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-03-19 by @gfwilliams
I'm not sure I understand the question? If you were getting actual data over Bluetooth then maybe you could have pushed it into the software module and got something useful, but you say you're just getting all zeros?
Honestly, there's no need. You just do All you need to do is copy the few lines on http://www.espruino.com/Brain and everything will work automatically. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-05-31 by dirkenstein Bit more information for everyone on the mindwave mobile/mobile+/mobile 2 and the myndplay myndband and BLE. I think all of these TGAM-based wireless headsets with BLE use the Silicon Labs BT121 module. The non-BLE bluetooth SPP on these sends raw TGAM data collected at 56Kbit. This data corresponds to the protocol implemented by the Brain module in Espruino. However, the BLE characteristics don't seem to implement raw data transmission, even though a characteristic (039afff4-2c94-11e3-9e06-0002a5d5c51b) is definied for raw EEG data. The 039afff8-2c94-11e3-9e06-0002a5d5c51b characteristic does not send data in any publicly-documented format. I believe it's a series of integers representing the computed values generated by TGAM (poor signal, EEG power bands, attention and meditation values), but the exact data breakdown is not clear. I can't even find the poor signal quality signal value. Basically, I think these headsets are not useable from Bangle.js unless somebody reflashes the BT121 firmware to support raw data transmission. That should be feasible, but rather alot of work unless NeuroSky would be willing to release the original BT121 project files. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-06-09 by @gfwilliams Argh, that's a bit of a pain. Did you have any luck contacting NeuroSky? Based on their other developer docs they seem pretty developer friendly, and may be willing to document the protocol? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-06-09 by dirkenstein Sorry, never did get a reply from them through their developer enquiries form. The question may have gotten lost, though. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-07-30 by Abhigkar Found some interesting product : https://www.nordicsemi.com/News/2020/07/MDCN-Technologies-employs-nRF52832-SoC?utm_campaign=SoMe%20promotion&utm_source=facebook&utm_medium=social&utm_content=News%20release:%20MDCN%20Technologies |
Beta Was this translation helpful? Give feedback.
-
Posted at 2021-08-17 by SpacecadetShep I'm also trying to connect my Mindwave Mobile 2 to an outside BLE receiver. I just tore down one of my headsets and can confirm that the bluetooth module on the MW2 is a GT9664B1 (http://www.gigafu.com.tw/product_view.php?id=53) which according to their website has a CC2564B bluetooth chip inside of it. Here's a link to TI's page : https://www.ti.com/product/CC2564 BLE devs will typically follow the example documentation from the chip manufacturer. We might be able to reverse engineer what the custom service is doing while waiting on Neurosky to reply. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2022-08-15 by psc1988 Did I understand this correctly? The characteristic 039afff8-2c94-11e3-9e06-0002a5d5c51b stands for the transmission of the signal status, power spectrum and eSense (attention/meditation) but it is not sent publicly? So, one will not receive anything or see the received content? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2015-04-26 by Dennis
Anybody else working on brain waves?
I have successfully hooked up a TGAM (a tiny EEG module) to my Espruino board. I extracted my TGAM from a Mattel MindFlex game that I bought used for 20€ on ebay.
As electrodes I am using 1 cent coins from the US whose coating I removed with a dremel rotation tool. I have glued them onto a strap of tissue to be worn on the forehead. In order to measure brain waves, at least three electrodes are needed: a signal electrode, a ground electrode and a referece electrode. The TGAM basically measures the voltage between ground and signal and uses the voltage between ground and reference to determine noise.
Communication with the TGAM is nasty, but I developed an Espruino module for that. I just created a pull request for it, so hopefully it will soon be merged and available for the benefit of all.
So far I'm successfully dumping brain wave spectral data to console. My first goal with this project is to build a dream recorder which can be worn on the head at night and which simply dumps brain waves to an SD card. Once that is working, I want to develop an algorithm that detects REM sleep phases. The final goal is to turn it into a lucidity device, i.e. a device that detects when a person is dreaming and then informs that person that they are dreaming (without waking them up). The dreamer can then consciously interact with the dream and direct it. I have had a few short lucid dreams and they're awesome, but it's very hard for me to induce them, hence I need to build this tool :) The cue to the dreamer should be a short audio message played through an integrated speaker.
Attachments:
Beta Was this translation helpful? Give feedback.
All reactions