Read the Wand ID and shake magnitude of a MagiQuest wand, using an Arduino and IR sensor.
Comms enabled - beginning sensing
wand_id: 683915009
magnitude: 33114
wand_id: 683915009
magnitude: 33114
wand_id: 809765633
magnitude: 383
wand_id: 809765633
magnitude: 33278
Hardware:
- Arduino Uno
- IR Receiver (I used an OSEPP IR Receiver Module, AdaFruit IR Receiver Sensor should also work)
- MagiQuest Wand
Software - Arduino IR Support:
- Arduino -> Sketch -> IRRemote
Or if IR support isn't alrady installed:
- or Arduino -> Sketch -> Include Library -> Manage Libraries...
- search IRRemote
- Install
The magi-spin
project is a basic example of using a MagiQuest wand to control a servo. In repsonse to a wand wave, a
servo will quickly swing back and forth.
Hardware:
- Arduino Uno
- IR Receiver (I used an OSEPP IR Receiver Module, AdaFruit IR Receiver Sensor should also work)
- Servo (I used an Adafruit Micro Servo)
- MagiQuest wand
Software - Arduino IR Support:
- Arduino -> Sketch -> IRRemote
Or if IR support isn't alrady installed:
- or Arduino -> Sketch -> Include Library -> Manage Libraries...
- search IRRemote
- Install
See magi-spin source
A breakdown of the signal characteristics of a MagiQuest Wand is available over at OpenSchemes. Instead of hand decoding the entire IR signal, we piggyback on the IRremote Arduino library, with a few modifications courtesy of mpflaga's MagiQuest fork of IRremote.
We lifted the MagiQuest specific code from mpflaga and, with a few changes, directly included the relevant decode functions
in the Arduino Sketch. The function of interest is decodeMagicQuest, which is called with a pointer to an IRremote::decode_results
structure,
and the magiquest
structure we declare at the top of the sketch. Calling the decodeMagiQuest will decode and fill in the
data in both the decode_results
and magiquest
structures:
decodeMagiQuest(&results, &data);
// the wand id is also in results.value
Serial.print("wand_id: ");
Serial.println(data.cmd.wand_id);
Serial.print("magnitude: ");
Serial.println(data.cmd.magnitude);
I've used the following sensors successfully (with no code changes):