So for a project in my Rapid Prototyping class this Fall, we were told we could do whatever we wanted as long as it made use of an Arduino and was feasible for our limited skillsets.
I had the ambitious idea of making a working Sorting Hat from the Harry Potter series. I got the idea after I found other instructables on how to hack a MindFlex headset to work with an Arduino. I really loved the idea of reading (rudimentary) brain waves and thought I could make a real world sorting hat with that concept.
The end result, in my mind, would be a wearable sorting hat with the MindFlex headband built in that would constantly be scanning brain waves. It would go through its verbal spiel about what house its thinking about putting you into, and then gauge your interest in each house based on the brain waves it reads. After this, it will "sort" you into the house that it thinks you wanted to be in the most.
I knew going into this that I may not be able to get it working for this class, but that I would one day get it working the way I want it to.
Materials used thus far:
- Arduino Uno - $24.95 (The sorting hat's brain)
- WAV Shield - $22 (The sorting hats vocal cords)
- iHome Mini Speaker - $24.88 (The sorting hat's mouth)
- MindFlex headset - $20-100 (I got mine on eBay for $20)
- Shield Stacking Headers (The sorting hat's.... cartilage?)
- Solderless jumper wires (The sorting hat's nervous system)
- Rechargeable batteries (The sorting hat's heart)
- Battery holder - $4.65 (The sorting hat's chest cavity)
- Soldering iron
- 3D printer (For printing the arduino/wav shield holder)
- SD card (at least 4GB)
Step 1: Putting the Wav Shield Together!
So the biggest non-coding hurdle for me was actually putting the WAV Shield together. It comes in Kit form so you have to solder everything together perfectly or you will end up soundless. And at ~$25, it's not a cheap mistake if you mess up.
I got the WAV shield library from the wav shield's website (there's an example sketch there as well to help you get started)
I chose to follow the brilliant instructions on the wav shield's website rather than blaze my own trail.
Once I got it all together, I had to load some wav files on the SD card to test if it even worked. I used this audio converter website to convert some test files over to the proper wav file type. It needs to be mono, 16-bit, and 22KHz or less. Once the files were converted to the right type, I threw them onto the SD card.
I then connected the wav shield to my Arduino Uno using the shield stacking headers, popped in the SD card, plugged in the iHome speaker, and burned the wav shield example sketch and listened to the magic.
Step 2: Hacking the MindFlex Headset
- Unscrew the side of the headset with the white button on top.
- There should be 4 screws and opens very easily. Once opened, you should see the NeuroSky board with a "QC Pass" sticker on it.
- In the corner of the chip, you should see 4 pins. Strip one of the solderless jumper wires and solder one end to the T pin on the board, ensuring you don't short circuit any other pins doing so.
- Strip another one of the jumper wires and solder one end to the pin that already has a black wire soldered to it (ground).
- Mark or label each wire so that you can keep track of what they connect to once you've closed the cover.
- I drilled a hole in the side of the headset for the wires to exit then fed the wires through and screwed the cover back on. I then quickly powered it back on to test to see if it would short out or not.
- The wire that you soldered to the T-pin should then connect to the RX pin on your Arduino. The ground wire should connect to the GND pin on your Arduino. You can either solder these to the board permanently or you can use the solderless ends to just plug in and unplug from the board, as I did.
You can then download the Arduino Brain library to interface with the MindFlex headset.
Step 3: 3D Print a Housing for Your Sorting Hat Brain
Here are the downloads for the sketchup files and Makerbot files that I created for this. Obviously it wasn't perfect, as you can see by the slightly covered USB port. But other than that, it fit the battery holder, Arduino, and WAV shield very snuggly and held everything in place no matter the orientation of the device.
Step 4: Source Code and Audio Clips! As Well As a Quick Video of the It Working (not in the Sorting Hat)
Here's the source code that powers the sorting hat, as well as the audio clips I used to make it talk. You'll want to rename these audio clips (or your own) based on the AudioNamingConvention.txt file. The source code uses this naming convention specifically.