Hacking a Hitachi Magic Wand (Plus)
Fair warning: while this post does not get graphical or discuss using a vibrator, it is about hacking a sex toy. Reader discretion is advised.
So: the Hitachi Magic Wand is a very good device. It, however, has very little granularity in how strong it is. Even the newer Magic Wand Plus only has four, non-customizable settings.
I don't like this and want to fix it. In the process, I'll also be adding bluetooth connectivity, because I thought that was pretty funny.
Why a Magic Wand Plus?
The original Magic Wand is great, but it also runs mains voltage straight to the motor. That adds a lot of headaches which I'd not like to deal with. The Plus, meanwhile, uses an external 10V, 1A DC power supply, which is a lot friendlier.
The Physical Part
The wand is only held together by five phillips s crews, so it comes apart real easy. Once we're in, we need to desolder the power supply wires from the very funky PCB that runs the Hitachi.
The motor uses a cute little connector, so we don't need to desolder anything there (I removed the connector so I can reuse it, though). After that, we just need to wire the power supply to the motor through a simple transistor, which we can use to control its speed via PWM1. We're also adding in a little ESP32 board that'll be the brains of the operation, which we can conveniently power off the same 10V supply.
I did this with a horribly soldered perfboard and some jumper cables. In my defense it was real late at night. Here's what things looked like in the end:
While the hardware may be, if anything, underengineered, we're doing the opposite for the software. See, firmware's really annoying to update, right? And user customization is one of the top goals of this project...
I Put A Scripting Engine On The Hitachi Magic Wand
Using the wonderful Rust on ESP project, we can have the full might of the standard library on our ESP32. WHich means we can very easily just throw in a full-featured scripting engine, namely Rhai.
Via Rhai's custom types functionality, we can give scripts access to peripherals like the ESP32's PWM controller. We can also make hot-reloading of scripts a breeze, taking away the friction of firmware updates. It sounds stupid, but it actually really works! How do we call the script, though?
I Put JSON-RPC On The Hitachi Magic Wand
It's JSON-RPC. I made the interface to the wand JSON-RPC. The vibrator has a JSON-RPC interface. It supports script reloading, restarting the board, and calling arbitrary Rhai functions with arbitrary parameters. It's also transport agnostic, so you can send RPC calls via either bluetooth or HTTP, with discovery via mDNS.
There's also a translation layer for Lovense commands, so that you can control your Hitachi Magic Wand with the official Lovense Remote app (or buttplug.io). Here's a simple script powering that:
fn lovense(args) {
switch args[0] {
"Vibrate" => {
const lovense_range = 0..20;
const target_range = 50..100;
let strength = parse_int(args[1]);
let mapped_strength = if strength > 0 { map_range(lovense_range, target_range, strength) } else { 0 };
print(`setting duty to ${mapped_strength}% (from ${strength}/${lovense_range.end})`);
this.pwm.set_duty_percent(mapped_strength);
},
_ => {
return [];
}
}
}
The Code
This is a git repository containing The Code for this whole thing. It's a deep work-in-progress; do not expect refined programming.2
Enjoy?
If you've liked this/have thoughts, feel free to email me at kore at cat-girl.gay! Don't be weird, please. 3