One day, I was browsing instagram and saw an advertisement for a “magic wand” that spewed fire, like Incendio. It looked awesome! Curious, I searched up how it worked, and found that it was shooting burning bits of some kind of inflammable paper. Genius! I was tempted to get one, but then deemed it a fire hazard for my apartment with lots of wood and cloth all around.
However, as with most things I find interesting, I started wondering how I’d build it if I had to build one myself. I got sidetracked in my thinking and arrived at a solution for an even better wand: one that does not spew fire, but can do other things, through the magic of science and technology.
The science of spells
Performing a spell isn’t as simple as “point the wand, say something”. There are three components to performing a spell: intention, incantation, and wand movement. We go over them in the reverse order.
Wand Movement
Most (all?) spells have a wand movement associated with them:
For my wand, I could hide an IMU at the top. That would measure the z, y and z accelerations as the wand moves. I could then subtract gravity from it to get the accelerations solely due to the wand’s motion, then double-integrate it to get the 3-D position over time. The result would trace the path of the tip of the wand, which I could compare against stored patterns to determine which spell was cast. Amazing!
Incantation
This is the “say something” part of performing a spell. Some examples are: “Accio”, “Lumos”, “Wingardium Leviosa”, etc.
The solution: Just put a microphone in the wand. When something is spoken, convert the sound using speech-to-text, and compare the words to spell incantations (or maybe directly compare the sound with some stored patterns?). Seems easy.
Intention
Intention involves more than “I intend to do some magic right now”, like thinking about the effects of the spell (eg: as when using Riddiculus to banish a Boggart), and accumulating the will/energy to fuel the spell (eg: as when using Expecto Patronum to cast a patronus).
For my wand, I assume intention == “I intend to do some magic right now”. This is a bit important, because most likely my wand will be battery-powered, so I’d like to prevent useless battery drain. For that, I don’t want it to process accelerometer and microphone data all the time when it is not in use. I plan to solve this with a tiny button right where my thumb would be when I hold the wand.
Pressing the button => “I intend to do some magic right now”. So my wand would only process the IMU and microphone data when the button is pressed.
Effects of the spell
Now we have all the components to perform a spell:
- I press the button, move the wand, and say something.
- My wand captures the microphone and IMU data, processes it, and compares against some stored patterns.
- It finds a match, and now it needs to act upon some spell.
Now what? Unfortunately, my wand can’t really perform magic. It can, however, transmit infrared or radio (wifi/bluetooth) signals based on the performed spell. This makes it somewhat similar to a remote control. I could then have objects in my house that receive these signals and perform some actions, like closing the curtains, switching the lights, playing music, controlling the TV, etc. Yes, then my magic wand won’t work outside my house, but I can always claim that my wizarding school is in my house and I’m not supposed to perform magic outside of school. :)
Technology
I would, thus, need the following electronic items for a complete wand:
- IMU: For capturing the wand movements. I decided to get a few pieces of ADXL345, MPU6050 and MPU9250 to experiment with.
- Microphone: For capturing the incantations. I decided to get a few pieces of KY037, MAX4466 and MAX9814 to experiment with.
- Microcontroller: To process the IMU and microphone data. It needs to support Wifi/Bluetooth. I decided to get a few pieces of ESP8266 and ESP32 to experiment with.
I also ordered a kit of other random electronic items like resistors, capacitors, LEDs, jumper wires, a breadboard, etc.
I would also need a 3D-printed wand to fit all the components once I’m done with a POC, but that is a problem for later.
Can’t wait to start working on this! I’ll give more updates on this project in later blogs.