More on the Mathematics of Sex Toys

I’ve been posting a bit about the Tormentor, a sex toy I’m designing for the sole and nefarious purpose of not letting the user get off. Quick recap in case you haven’t seen the project so far: it’s a vibrator connected to a programmable microcontroller that’s programmed to run the vibrator in random patterns for random lengths of time with random pauses in between, to keep the wearer sexually aroused but without being q-u-i-t-e enough to allow the wearer to come.

Because, yeah, I’m kind of a bastard.

My sweetie lapis_lazuli beta tested the first standalone prototype, the Tormentor version 0.2, and the biggest problem that arose was that the deice was just too damn bulky.

Part of this was the fault of using a 9V battery to run the microcontroller, but part of t was the fact that the Arduino Uno board I’m using is just plain big.

I mentioned this problem to roadknight last time I was in San Francisco, seeing how he’s also a micorocontroller hacker and general mad scientist. He suggested that I use a Teensy USB board in place of the Arduino, and even gave me a spare that he happened to have handy.

The name doesn’t lie.


Size comparison, top to bottom: 9-week-old Tonkinese kitten, Arduino Uno, Teensy USB

The Teensy is certainly that; it was the second-smallest programmable microcontroller in his collection. (The first was an obscure Chinese something something on a flexible board, about the height of a grain of rice and three times that long.)

I’ve started looking into building the Tormentor version 0.3 around a Teensy. It’ll take a bit of work; the Teensy lacks an on-board voltage regulator, for instance. I’m thinking of using a 6.3v lithium battery to drive both the Teensy and the sex toy; I’ll have to cobble together a recharge/regulator circuit of some sort, but it should let me get the finished gadget very, very small indeed.

The Teensy people don’t understand something that Apple does: User experience matters. The Teensy board is unlikely ever to knock over the Arduino as the reigning champ of DIY microcontrollers, even though the Teensy is smaller and has better technical specifications, because the user experience when it comes to programming a Teensy is, to put it bluntly, abysmal.

You don’t get no Arduino-style all-in-one IDE and device programmer, where you can type code into a window and press a button and bam! The device is working! Oh, no. The Teensy requires you to install a gcc compiler, then type your code in a text editor, run it through gcc with make, and then load the resulting hex file onto the board with a loader program. It’s archaic and barbaric, and it brings back memories of my Programming 101 class in college, in which I wrote 8080 assembly on a CDC Cyber 760 mainframe, compiled it to a hax hex file, copied it onto a floppy disk, then ran it on a CP/M machine using a hex loader.

Someone, please kill me now.

There is, though, an Arduino IDE plugin for the Teensy, and though it’s a bit weird and doesn’t run all Arduino code, it looks like it should work for me.

36 thoughts on “More on the Mathematics of Sex Toys

  1. The Arduino Pro Mini appears to be about the same size as the Teensy USB. It can be programmed with the standard Arduino library. The downside is that it doesn’t have a USB port for programming, you’d have to solder on a connector of some sort and then use a USB to serial converter when programming it. On the plus side, it does have an on-board voltage regulator.

  2. The Arduino Pro Mini appears to be about the same size as the Teensy USB. It can be programmed with the standard Arduino library. The downside is that it doesn’t have a USB port for programming, you’d have to solder on a connector of some sort and then use a USB to serial converter when programming it. On the plus side, it does have an on-board voltage regulator.

  3. “compiled it to a hax file”….
    I have heard of computer hacks, and hex files, but ‘hax’?

    I find it interesting that most of the folks who used to ‘play’ with transistors, resistors, op amps, making their own circuit boards, etc are now, it seems, programming these microcontrollers….

    • Ack! Fixed now.

      For me, the programmable microcontrollers appeal to the same mad-scientist bits living within me that love hardware hacking, but can do *so* much more than what I could do by cobbling my own circuits together. I wish I’d known about the Arduino when I was developing an Internet-controlled sex toy!

  4. “compiled it to a hax file”….
    I have heard of computer hacks, and hex files, but ‘hax’?

    I find it interesting that most of the folks who used to ‘play’ with transistors, resistors, op amps, making their own circuit boards, etc are now, it seems, programming these microcontrollers….

  5. That picture is delightful in every day 😀

    And you’re killing me with the kitten-cuteness, too!!

    — A (suffering from kitten-lust!)

    P.S. And all the sex-toy and programming nerdery is good stuff, too. But KITTEN!!!

  6. That picture is delightful in every day 😀

    And you’re killing me with the kitten-cuteness, too!!

    — A (suffering from kitten-lust!)

    P.S. And all the sex-toy and programming nerdery is good stuff, too. But KITTEN!!!

  7. Ugh! Hacking together a USB interface sunds a lot more painful than hacking together a voltage regulator.

    The Teensy can be powered at 3 volts, as it turns out, which is making me lean toward just using a couple of AA batteries to power it and the vibrator. I had planned to use a pair of 3.6v lithium-ion batteries, using one of the pair to run the sex toy and both of the pair (with a voltage regulator) to run the Teensy. As it turns out, connecting multiple Li-Ion batteries and then discharging them at different rates is a Very Very Bad Thing To Do, and can destroy the batteries, so that’s not so good.

  8. Ugh! Hacking together a USB interface sunds a lot more painful than hacking together a voltage regulator.

    The Teensy can be powered at 3 volts, as it turns out, which is making me lean toward just using a couple of AA batteries to power it and the vibrator. I had planned to use a pair of 3.6v lithium-ion batteries, using one of the pair to run the sex toy and both of the pair (with a voltage regulator) to run the Teensy. As it turns out, connecting multiple Li-Ion batteries and then discharging them at different rates is a Very Very Bad Thing To Do, and can destroy the batteries, so that’s not so good.

  9. Using the vibrator with the EEG is actually a different project. I’ll probably be using the Arduino for that; the size is less relevant because of the size of the EEG itself. The goal with the Tormentor is to make the gadget as small as possible, so it can be worn for extended periods of time while, say, shopping. Or going out to dinner.

    Yeah, I’m kind of a bastard.

    I used to do almost all my programming in assembly. I learned Z-80 assembly on my first computer (a Radio Shack TRS-80 Model I, does that date me?) and at one time I could code in Z-80 assembly as fast as I could type.

    And believe me, I’ve used UV-erasable EPROMs. I can still remember what a radical breakthrough EEPROMS were–no pulling the chip out of its socket to erase it! How cool!(I built a gadget for my TRS-80 that had a bunch of 7-segment LEDs and would show the PC of the computer on the LEDs all the time. Used EEPROMS to make the binary-to-7-segment decoders.

    Can’t say I’ve ever used an Overo, though.

  10. Using the vibrator with the EEG is actually a different project. I’ll probably be using the Arduino for that; the size is less relevant because of the size of the EEG itself. The goal with the Tormentor is to make the gadget as small as possible, so it can be worn for extended periods of time while, say, shopping. Or going out to dinner.

    Yeah, I’m kind of a bastard.

    I used to do almost all my programming in assembly. I learned Z-80 assembly on my first computer (a Radio Shack TRS-80 Model I, does that date me?) and at one time I could code in Z-80 assembly as fast as I could type.

    And believe me, I’ve used UV-erasable EPROMs. I can still remember what a radical breakthrough EEPROMS were–no pulling the chip out of its socket to erase it! How cool!(I built a gadget for my TRS-80 that had a bunch of 7-segment LEDs and would show the PC of the computer on the LEDs all the time. Used EEPROMS to make the binary-to-7-segment decoders.

    Can’t say I’ve ever used an Overo, though.

  11. Ack! Fixed now.

    For me, the programmable microcontrollers appeal to the same mad-scientist bits living within me that love hardware hacking, but can do *so* much more than what I could do by cobbling my own circuits together. I wish I’d known about the Arduino when I was developing an Internet-controlled sex toy!

  12. Yep, if you’re connecting batteries in series you don’t want to drain them unevenly. That’s true of any battery, not just lithium, but lithium cells require a lot more coddling than most other battery chemistry.

    You could probably get away with using a single Li-Ion or LiPoly cell to power both the Teensy USB and the vibrator. If the vibrator is designed to run off of two AA batteries, 3.6V shouldn’t be too much for it. You’ll still want to get the version of the Teensy with the 3.3V regulator, since a fully charged Lithium cell can produce up to 4V which is too much for the Teensy without a regulator. You’ll also want to put some hefty electrolytic or tantalum caps on the power into and out of the regulator to deal with all the electrical noise that the vibrator motor is putting out.

    With two AA cells, you might run into issues with not having enough voltage for the Teensy USB. From what I can tell from the datasheet, it’s rated to run down to 2.7V. Two AA batteries driving a motor can easily drop down that low – typical AA cells have pretty high internal resistance. If you used a MintyBoost or similar switcher to generate 5V from the low AA voltage, you’d be able to keep the device running until the voltage dropped too low for the motor to run. That would help with electrical noise issues too.

  13. Yep, if you’re connecting batteries in series you don’t want to drain them unevenly. That’s true of any battery, not just lithium, but lithium cells require a lot more coddling than most other battery chemistry.

    You could probably get away with using a single Li-Ion or LiPoly cell to power both the Teensy USB and the vibrator. If the vibrator is designed to run off of two AA batteries, 3.6V shouldn’t be too much for it. You’ll still want to get the version of the Teensy with the 3.3V regulator, since a fully charged Lithium cell can produce up to 4V which is too much for the Teensy without a regulator. You’ll also want to put some hefty electrolytic or tantalum caps on the power into and out of the regulator to deal with all the electrical noise that the vibrator motor is putting out.

    With two AA cells, you might run into issues with not having enough voltage for the Teensy USB. From what I can tell from the datasheet, it’s rated to run down to 2.7V. Two AA batteries driving a motor can easily drop down that low – typical AA cells have pretty high internal resistance. If you used a MintyBoost or similar switcher to generate 5V from the low AA voltage, you’d be able to keep the device running until the voltage dropped too low for the motor to run. That would help with electrical noise issues too.

  14. I think it will. The driver chip is a quad half-H-bridge that can drive one amp per bridge. Stacking two of the chips (one on top of the other) gets you two amps per bridge. Since there are two full bridges, you can also wire the outputs in parallel to combine them into one bridge, so two stacked chips could theoretically drive one motor with 4A.

    However, I’m dropping a lot of qualifiers in there because there might be some aspect of this that I’ve overlooked, like miss-matched switching voltages on the H-bridge transistors causing one transistor to take all the load and catch fire. I’m going to test that configuration before I go around enthusiastically endorsing it as a technique.

    If nothing else, if you hook the two H-bridges in parallel, and then set them to have opposed outputs, you will get a merry little fire when they directly connect V+ to ground.

        • So, when I say “beta hardware” I mean “I messed up every connector that could have been done wrong”. I’ll be ordering the V2 PCBs soon, will let you know when I have one together.

          My plan for the V1s is to get them working enough to build some demo objects and try to get crowd-funding for the V2 builds.

          The device that isn’t making it into the crowd-funding demo video is going to be a vibrator that hooks up to a multi-protocol instant messaging program and reacts appropriately when “/harder” and “/faster” (and obviously “/slower” and “/softer”) are sent in the IM conversation. Good for hot chat and the like.

          I suppose for BDSM purposes, I could add a /taze_sensitive_bits command… Bwah ha ha ha ha.

  15. I think it will. The driver chip is a quad half-H-bridge that can drive one amp per bridge. Stacking two of the chips (one on top of the other) gets you two amps per bridge. Since there are two full bridges, you can also wire the outputs in parallel to combine them into one bridge, so two stacked chips could theoretically drive one motor with 4A.

    However, I’m dropping a lot of qualifiers in there because there might be some aspect of this that I’ve overlooked, like miss-matched switching voltages on the H-bridge transistors causing one transistor to take all the load and catch fire. I’m going to test that configuration before I go around enthusiastically endorsing it as a technique.

    If nothing else, if you hook the two H-bridges in parallel, and then set them to have opposed outputs, you will get a merry little fire when they directly connect V+ to ground.

  16. Sounds good. MOSFET output transistors are a good way to drive things (good old IRF510) as driven digitally they loose less power due to the lack of the 0.7V forward drop (and are more efficient and green too)

    Also i have tried running vibrators off the same supply as the control electronics and the voltage drop from the motor starting usually causes a brown out. you need one hell of a decoupling cap to stop this or you need to have a diode or DC/DC converter between the power to the motor and the tank cap on the electronics.

  17. Sounds good. MOSFET output transistors are a good way to drive things (good old IRF510) as driven digitally they loose less power due to the lack of the 0.7V forward drop (and are more efficient and green too)

    Also i have tried running vibrators off the same supply as the control electronics and the voltage drop from the motor starting usually causes a brown out. you need one hell of a decoupling cap to stop this or you need to have a diode or DC/DC converter between the power to the motor and the tank cap on the electronics.

  18. So, when I say “beta hardware” I mean “I messed up every connector that could have been done wrong”. I’ll be ordering the V2 PCBs soon, will let you know when I have one together.

    My plan for the V1s is to get them working enough to build some demo objects and try to get crowd-funding for the V2 builds.

    The device that isn’t making it into the crowd-funding demo video is going to be a vibrator that hooks up to a multi-protocol instant messaging program and reacts appropriately when “/harder” and “/faster” (and obviously “/slower” and “/softer”) are sent in the IM conversation. Good for hot chat and the like.

    I suppose for BDSM purposes, I could add a /taze_sensitive_bits command… Bwah ha ha ha ha.

Leave a Reply

Your email address will not be published. Required fields are marked *