Comments (1)
It was working on my headset, but it's been a bit since I've done anything with this :) Are you using an HC-06?
I borrowed the trick from this guide by @arpruss, in case it's helpful:
Fortunately, the communications protocol for the ThinkGear chip allows you to switch to mode 0x02 very simply by sending 0x02 to its serial receive line. While this doesn't survive powercycling, nonetheless it should make things simpler: just make sure the receive line of the chip is connected to the Bluetooth radio's transmit line, and send 0x02. But there is a hitch. The 0x02 has to be sent at 9600 baud, while the subsequent data will be at 57600 baud. And unfortunately there is no way to control the HC-06 Bluetooth radio's baud rate dynamically in use.
But there is a solution that surprisingly works. 9600 = 57600 / 6. If you could just send a bit six times at 57600 baud, that would be the same as sending it once at 9600 baud. The only hitch is that when sending things via RS232 serial or its TTL variant, you don't get to control each bit. Instead, assuming the usual 8N1 communications setting, the bits are packaged into bytes, with each byte starting with an extra 0 "mark" but and ending with an extra 1 "stop" bit. The mark and stop bits are out of our control. But we can work around this. It turns out that if we send the hex string 0x00, 0xF8, 0x00, 0x00, 0x00, 0xE0 at 57600 baud and then pause for at least the length of a 9600 baud bit (a millisecond will be more than enough; idling is the same as sending 1's in the RS232 protocol), that's like sending 0x02, with four glitches (and some extra zeroes up front), each glitch being 1/6 of a bit in length. If we're lucky, the 9600 baud receiver will ignore the short glitches. And somewhat surprisingly it works! The chip switches to mode 0x02, starts transmitting at 57600 baud, and all is well. In fact, with the HC-06 as the transmitter it works 100% of the time (using a Brainlink, it sometimes requires a retry).
So there are three components to the project:
I. Set the HC-06 Bluetooth radio to 57600 baud. This setting survives powercycling. This is cumbersome but needs to be done only once.
II. Solder connections to the headset to connect it to the HC-06 radio.
III. Make sure that the headset goes to mode 0x02 by sending the magic hex string (or some variant on it) at 57600 baud. This could be done by building the magic string into EEG software, or by writing a simple program that sends the magic hex string to the device, and then the device can be used with any software compatible with the Mindwave Mobile. I did both: I wrote some EEG software in Java that can be run on a PC (probably also Mac and Linux but I haven't tested it there) and that sends the magic string before display the raw and processed data, and I made a simple Android app that simply sends the magic string (or a variant on it) at 57600 baud and activates the Mindwave Mobile compatible mode. Both programs are open source.
Let me know if you get it to work, or if you spot any bugs. Pull requests are welcome if you have improvements!
from brain.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brain.