The Mathematics of Sex Toys…

…in which we learn just how big a stinker Franklin is.

Okay. So. Long story behind it, but I have on my balcony a large Tupperware container filled with sex toys. Vibrating eggs, to be exact. At one point, I had about 250 of them. I keep giving them away to people (in fact, I’ve been known to refuse to let guests leave the house unless they take one with them), and now I’m down to about 20.

Which is still a lot of vibrators, just for the record.

Some time ago, I read online about a guy who’d taken a vibrator and connected it to a Basic Stamp–think “little tiny computer on a single chip”–that he had programmed to switch the vibrator on and off at random intervals. The idea, you see, was to play with a quirk of human physiology.

Quick dissertation about human anatomy: The way our sensory nerves work, if you present the same stimulus to the same part of the body without varying it, eventually, your sensory nerves will quit responding to it. Take a toothpick and put it on your palm; you’ll be able to feel it. Leave it there long enough without moving it or your hand and eventually you’ll stop feeling it.

The sexual organs are no different than any other organ in this regard. Flip side of the same coin, if you vary the stimulation presented to a sensory nerve, it’ll keep informing your brain “Hey! The stimulus has changed!” and you won’t be able to ignore it.

Now, this guy had programmed his Basic Stamp to switch a vibrator on and off at random, but fairly short, intervals. The idea was to create an infuriating sex toy–a sex toy that, when you wear it, you absolutely can not ignore. Because the stimulation is random, you don’t become acclimatized to it–and if it switches on and off quickly enough, it also doesn’t stay on long enough to get you off. So basically, he created a sex toy that will make sure you always pay attention to it but won’t make you come.

If you draw a graph of the way the sex toyy switches on and off, you get something like this:

There’s vibration, then no vibration, then vibration, then no vibration, for randomly varying periods of time:
bzzzzz….bzz………bzzzzzzzzzz..bzzz……bzzzzz… you get the idea.

Now, that’s good and all, but the vibrators I have are equipped with a little thumbwheel speed control. When one of my partners is foolish enough to put me in charge of the control pack for one of these things, I like to run my thumb up and down the speed wheel thingy, making the vibrator go FASTER and slower and FASTER and slower.

So I started thinking, why not program a computer to run the vibrator for random times at random speeds? From there, I started thinking about how to actually code for that.

Now, it seemed to me, as I was thinking about it on the bus on my way down to Tallahassee, that the most obvious way to go about this is to take a bunch of sine waves and put them together. One can construct a waveform of nearly arbitrary complexity by merging together sine waves of different frequencies, via a mathematical bit of wizardry called a fast Fourier transform.

For example, suppose we have something like this:

The sum of the red sine wave and the blue wave (which is itself a composite of three sine waves) looks a bit like this:

Now, feed that into a vibrator and it should keep a person infuriatingly close to orgasm without letting her get off or ignore the vibrator just about indefinitely.

The thing is, you want a wave that looks random. Any composite of a finite number of sine waves will be periodic (that is, at some point it will start to repeat), so you want something that looks random and also has a long periodicity. I was thinking about how to choose a relatively small number of sine waves–say, sixteen or so–in such a way as to maximize the periodicity and also maximize the apparent randomness when combining them with an FFT. Make the ratios of their periods prime? Stuff like that?

I was hampered somewhat by the fact that I also know fuck-all about how to actually do an FFT, too, which means that basically I know squat about the best way to go about choosing the sine waves.

Shelly’s dating a physicist, though. And he took one look at the problem and observed that a fast Fourier transform isn’t really necessary; it’s using an anti-aircraft cannon on a mosquito.

His idea, which is brilliant, is this:

Take a sine wave whose period is the interval of time over which you don’t want the pattern of the vibrator to repeat. Add it to itself with a period of double that, and add it to itself with a period of three times that, and again with a period of five times that. (Geeky readers will already see where this is going: 1, 1, 2, 3, 5… is the Fibonacci sequence.)

You don’t need very many sine waves to get a right royal (and therefore random-looking) mess.

So, in theory, it will be remarkably simple to make The World’s Most Annoying Sex Toy(tm). A little bit of simple programming and some kind of variable interface and the result should be a vibrator that will drive the wearer right straight up the fucking wall for hours, with no relief in sight.

I am such a stinker.

Fortunately, the world is saved by the mere fact that I don’t at the moment have time to actually build one of these. Yet.

150 thoughts on “The Mathematics of Sex Toys…

  1. I was thinking of the mechanical aspects of vibrators ever since I first saw my first pearl rabbit back in the 1990s as a recently graduated mechanical engineer – with the power of chips today, those wave forms seem like the way to go with improving the performance of devices over the 20 minute one shot vibrators that Trojan is now selling in drug stores across the country.

    • From a strictly implementation standpoint, the hard part is the interface. Building a computer interface to a vibrator is more tricky than it sounds. I tried to do that a couple years back, and nearly started a fire; one of the resistors in the analog part of the circuit actually exploded. Then I sat down and did the math and realized that a typical 3-volt vibrator can draw as much as six watts(!) of power, and putting six watts through a carbon-film resistor rated at 250 mW doesn’t work so good.

      • Yes, it would be difficult to find test pilots if the risk of fire or explosion were present, as that would be alot to explain to the the emergency room attendant should something go awry.

      • Why does it even need to be digital? A vibrator works by spinning an off-center weight with a motor. You can get multiple wave forms by just using multiple motors with different weights and a variable speed on each.

        • Using multiple motors won’t achieve the same effect.

          The goal here is to have a vibrator that ramps up and down in vibration speed–starting from barely running, increasing to full-throttle over a period of three or four seconds, then dropping back down to half-speed over a second or so, then ramping back up to nearly full speed for half a second, then slowly falling off to zero, unpredictably.

          Multiple motors won’t change the speed of the vibrator, only the pattern of vibration, and the rate at which it changes is a function of the speed of the various different motors. If you have a motor that spins at 400 RPM and one at 200 RPM, you’ll get a vibration that cycles more than once a second–so you’d end up with a raspy buzz, rather than a changing “full power, then off, then half power, then full power” kind of pattern.

  2. I was thinking of the mechanical aspects of vibrators ever since I first saw my first pearl rabbit back in the 1990s as a recently graduated mechanical engineer – with the power of chips today, those wave forms seem like the way to go with improving the performance of devices over the 20 minute one shot vibrators that Trojan is now selling in drug stores across the country.

        • The tricky thing is to take a digital output and then use that as a motor speed control. That’s the bit I don’t know how to do–vary the speed of the motor with a digital signal. I’m good with digital electronics, not so good with D/A stuff or analog electronics. If there’s a single-chip solution for htis kind of application with small (3V, 6W) motors, that’d be idea.

          • There is. Most any 8-bit processor will do it. In fact, I’m building a board for it as we speak. -.^

  3. The reason why the sum of sine waves (in either the FFT version or the fibonacci series) is periodic is that the sine waves being summed all have commensurate periods. The FFT is a fast way of summing sine waves of frequencies f, 2f, 3f, 4f, etc. (It definitely overkill for this application, btw). The fibonacci sequence sums sine waves of frequencies f, 2f, 3f, 5f, 8f, etc. In both cases, the resulting waveform will repeat with period 1/f.

    However, if you sum sine waves with non-commensurate periods, the resulting waveform has an infinite period and never repeats. I’d suggest frequencies of f, φf, φ2f, etc. where φ is the golden mean, approximately 1.618.

      • Ooh, I like that. And it wins extra geek points because not only does it involve the square roots of prime numbers, but those prime numbers also happen to align witht he Fibonacci sequence as well!

        • Heh-heh—only as far as 5; the sequence then diverges for 7 and 11, reunites briefly at 13, and then takes off in a completely different direction with 17, 23, 29, ….

    • In practical terms, though, anything driven by a computer or microcontroller will exhibit periodicity, simply because of the limits of precision of the numbers in the computer. If, for example, one uses a 32-bit float to represent the multiples of the periods of the sine wave, it could be demonstrated that the resulting output would be identical to using 32-bit integers to represent the numbers (only longer), and I think that demonstrating periodicity in any integer multiples is trivial (though I admit I haven’t sat down and done the math).

      Still, for all intents and purposes, it might as well not be periodic, because the vibrator’s wearer certainly isn’t going to notice the periodicity. 🙂 And your way is better than a simple Fibonacci multiplication.

      • Yes, because you aren’t using real continuous variables, there will be periodicity. However, since I expect that you aren’t going to change the output that often (I can’t imagine an update of more than 1Hz being reasonable) the length of any period you’d experience would be extremely long.

        However, thinking about it, I’m not sure that a sum of sine waves is the best approach. One complication with summing sine waves you have is that to do it best, you need to also select phases and amplitudes for each component. And it’s really hard to tailor the resulting waveform to have the characteristics you want.

        I think what might be better is to use random 1/f noise. 1/f noise has an intriguing mix of both long-term and short-term structure to it, and would seem to combine the properties of changing slowly enough to be intriguing without being spastic and fast enough to be infuriating.

        1/f noise can most easily be generated by adding a bunch of white noise generators (i.e., random number generators) together, each of which updates had half the rate of the previous. What I mean is that you maintain an array of random numbers R0-Rn, and you update R0 every cycle, R1 every other cycle, R2, every 4th cycle, …, Rn every 2nth cycle. The output is the sum of R0 through Rn. Done right, every cycle just needs to have two random number generations, two subtractions and two additions, plus a computation of which generator to update that could be relegated to a lookup table. The inner loop would basically look something like:

        { counter++; 
          counter %= TWO_TO_THE_N; 
          k = binToModify[counter]; 
          sum -= bin[0]; bin[0] = rand(); sum += bin[0];
          sum -= bin[k]; bin[k] = rand(); sum += bin[k];
        }
        

        The larger the N, the lower the frequency added to the 1/f noise mix.

        • That’s an interesting approach, and has the advantage of being much easier to code than a sum of sine waves. You know, I’m actually getting interested enough in this project now that I want to make the time to build a prototype!

  4. The reason why the sum of sine waves (in either the FFT version or the fibonacci series) is periodic is that the sine waves being summed all have commensurate periods. The FFT is a fast way of summing sine waves of frequencies f, 2f, 3f, 4f, etc. (It definitely overkill for this application, btw). The fibonacci sequence sums sine waves of frequencies f, 2f, 3f, 5f, 8f, etc. In both cases, the resulting waveform will repeat with period 1/f.

    However, if you sum sine waves with non-commensurate periods, the resulting waveform has an infinite period and never repeats. I’d suggest frequencies of f, φf, φ2f, etc. where φ is the golden mean, approximately 1.618.

  5. this whole subject is flawed i think… this is completely ignoring the idea that a woman could possibly have control over her own orgasms. Even if you use this type of programming as a distraction for the woman instead of a tool for her to achieve orgasm, you’re ignoring psychological influences and stimulus. If you’re aiming for her to be driven up the wall, you need to make sure she’s not meditating and provide verbal stimulus as well i think.

    i’d love to test your prototype, though. 🙂

    • Okay, you make a good point. I’ve known a woman who can give herself an orgasm simply by squeezing her thighs together, and another woman who can come from verbal stimulation alone, so my Evil Device won’t have the intended effect on everyone.

      Still, I think that women with that kind of control over their orgasms are scarcer than women who don’t have that kind of control, and of course, there’s always tickling or other distractions that might be helpful as well…

      • Obvious response

        Your next project must be to build some kind of sensory input device, to test some variable or set of variables that would be a strong indicator for imminent orgasm, and incorporate that input into your wave… in an inverse proportion. 🙂

        Yes, I think about sex this much too.
        btw, you could probably find a few investors at http://www.tantalism.org

        • Re: Obvious response

          The addition of some kind of biometric feedback intended to stop the device if the wearer approaches orgasm is definitely something that should be incorporated into the second version of this thing.

          Now if only I had time to build the first version… 🙂

  6. this whole subject is flawed i think… this is completely ignoring the idea that a woman could possibly have control over her own orgasms. Even if you use this type of programming as a distraction for the woman instead of a tool for her to achieve orgasm, you’re ignoring psychological influences and stimulus. If you’re aiming for her to be driven up the wall, you need to make sure she’s not meditating and provide verbal stimulus as well i think.

    i’d love to test your prototype, though. 🙂

  7. When you’re ready for beta testers.. 😉

    Actually, as you know, I have the Je Joue, which is supposed to bring in that random element that is controllable via programming. As someone who rarely finds success with vibrating toys.. not even the Je Joue is overly pleasing to me (other than the geek points.)

    I think I have to agree with above.. for some women, there might need to be another element involved than technology alone.

    But I know you’re up for that task 😉

    • Seems like it might be fairly easy to program a Je Joue for pseudorandom vibration, though of course that kinda defeats its intended purpose.(And they’re a bit spendy.) I appreciate the vote of confidence in my “other element” skills, though! 🙂

  8. When you’re ready for beta testers.. 😉

    Actually, as you know, I have the Je Joue, which is supposed to bring in that random element that is controllable via programming. As someone who rarely finds success with vibrating toys.. not even the Je Joue is overly pleasing to me (other than the geek points.)

    I think I have to agree with above.. for some women, there might need to be another element involved than technology alone.

    But I know you’re up for that task 😉

  9. In practical terms, though, anything driven by a computer or microcontroller will exhibit periodicity, simply because of the limits of precision of the numbers in the computer. If, for example, one uses a 32-bit float to represent the multiples of the periods of the sine wave, it could be demonstrated that the resulting output would be identical to using 32-bit integers to represent the numbers (only longer), and I think that demonstrating periodicity in any integer multiples is trivial (though I admit I haven’t sat down and done the math).

    Still, for all intents and purposes, it might as well not be periodic, because the vibrator’s wearer certainly isn’t going to notice the periodicity. 🙂 And your way is better than a simple Fibonacci multiplication.

  10. Ooh, I like that. And it wins extra geek points because not only does it involve the square roots of prime numbers, but those prime numbers also happen to align witht he Fibonacci sequence as well!

  11. Okay, you make a good point. I’ve known a woman who can give herself an orgasm simply by squeezing her thighs together, and another woman who can come from verbal stimulation alone, so my Evil Device won’t have the intended effect on everyone.

    Still, I think that women with that kind of control over their orgasms are scarcer than women who don’t have that kind of control, and of course, there’s always tickling or other distractions that might be helpful as well…

  12. From a strictly implementation standpoint, the hard part is the interface. Building a computer interface to a vibrator is more tricky than it sounds. I tried to do that a couple years back, and nearly started a fire; one of the resistors in the analog part of the circuit actually exploded. Then I sat down and did the math and realized that a typical 3-volt vibrator can draw as much as six watts(!) of power, and putting six watts through a carbon-film resistor rated at 250 mW doesn’t work so good.

  13. Y’know, I wouldn’t think there’d be all that many people interested in a toy that’s intended to drive the victim user absolutely insane…

  14. Seems like it might be fairly easy to program a Je Joue for pseudorandom vibration, though of course that kinda defeats its intended purpose.(And they’re a bit spendy.) I appreciate the vote of confidence in my “other element” skills, though! 🙂

  15. The world isn’t very saved, as there are those of us that have built this many times over, and really all you’re needing is the interface (which I’m currently working on, my software will actually do function generation and interpolation. ^_^)

    http://www.slashdong.org is my website, check it out if you’re interested. ^_^ (And this is so getting blogged about)

    And, if you just want to get the hardware controller board now:

    http://www.tim.cexx.org/projects/vibe/buyone.htm

    Er, d’oh. Hell, looks like he sold out of the prebuilt boards.

  16. The world isn’t very saved, as there are those of us that have built this many times over, and really all you’re needing is the interface (which I’m currently working on, my software will actually do function generation and interpolation. ^_^)

    http://www.slashdong.org is my website, check it out if you’re interested. ^_^ (And this is so getting blogged about)

    And, if you just want to get the hardware controller board now:

    http://www.tim.cexx.org/projects/vibe/buyone.htm

    Er, d’oh. Hell, looks like he sold out of the prebuilt boards.

  17. Heh-heh—only as far as 5; the sequence then diverges for 7 and 11, reunites briefly at 13, and then takes off in a completely different direction with 17, 23, 29, ….

  18. Which one of Mom’s vibes will work the best?

    ok, this is like a kid’s science project on sex toys… judging on the scientific graphs provided of course 😉

    btw, check out my latest post. I met a sex magick high priestess from Atlanta… you may not be into sacred sexuality but she was from your neck of the woods and i thought that was interesting.

    Thanks!

    • Re: Which one of Mom’s vibes will work the best?

      Neat! What’s scary is I actually know more kinky poly folks in Chicago than in Atlanta these days.

  19. Which one of Mom’s vibes will work the best?

    ok, this is like a kid’s science project on sex toys… judging on the scientific graphs provided of course 😉

    btw, check out my latest post. I met a sex magick high priestess from Atlanta… you may not be into sacred sexuality but she was from your neck of the woods and i thought that was interesting.

    Thanks!

  20. Yes, because you aren’t using real continuous variables, there will be periodicity. However, since I expect that you aren’t going to change the output that often (I can’t imagine an update of more than 1Hz being reasonable) the length of any period you’d experience would be extremely long.

    However, thinking about it, I’m not sure that a sum of sine waves is the best approach. One complication with summing sine waves you have is that to do it best, you need to also select phases and amplitudes for each component. And it’s really hard to tailor the resulting waveform to have the characteristics you want.

    I think what might be better is to use random 1/f noise. 1/f noise has an intriguing mix of both long-term and short-term structure to it, and would seem to combine the properties of changing slowly enough to be intriguing without being spastic and fast enough to be infuriating.

    1/f noise can most easily be generated by adding a bunch of white noise generators (i.e., random number generators) together, each of which updates had half the rate of the previous. What I mean is that you maintain an array of random numbers R0-Rn, and you update R0 every cycle, R1 every other cycle, R2, every 4th cycle, …, Rn every 2nth cycle. The output is the sum of R0 through Rn. Done right, every cycle just needs to have two random number generations, two subtractions and two additions, plus a computation of which generator to update that could be relegated to a lookup table. The inner loop would basically look something like:

    { counter++; 
      counter %= TWO_TO_THE_N; 
      k = binToModify[counter]; 
      sum -= bin[0]; bin[0] = rand(); sum += bin[0];
      sum -= bin[k]; bin[k] = rand(); sum += bin[k];
    }
    

    The larger the N, the lower the frequency added to the 1/f noise mix.

  21. Yes, it would be difficult to find test pilots if the risk of fire or explosion were present, as that would be alot to explain to the the emergency room attendant should something go awry.

  22. Why does it even need to be digital? A vibrator works by spinning an off-center weight with a motor. You can get multiple wave forms by just using multiple motors with different weights and a variable speed on each.

  23. Fortunately, the world is saved by the mere fact that I don’t at the moment have time to actually build one of these. Yet.

    But when you do, I definitely have someone who can beta-test for you.

    Bwahahahaha.

  24. Fortunately, the world is saved by the mere fact that I don’t at the moment have time to actually build one of these. Yet.

    But when you do, I definitely have someone who can beta-test for you.

    Bwahahahaha.

  25. In another dimension I would be a high school math teacher, and this sounds like the perfect sort of “real world” problem that would get high schoolers really interested in math 🙂

  26. In another dimension I would be a high school math teacher, and this sounds like the perfect sort of “real world” problem that would get high schoolers really interested in math 🙂

  27. Ah yes, the art of the tease! Just like you can’t tickle yourself, you can’t tease yourself with a vibrator the way someone else can!

    Particularly if it’s an egg vibrator, and you’re in a moving car, strapped into the passenger seat and blindfolded. Gives me the shivers just thinkin…

  28. Using multiple motors won’t achieve the same effect.

    The goal here is to have a vibrator that ramps up and down in vibration speed–starting from barely running, increasing to full-throttle over a period of three or four seconds, then dropping back down to half-speed over a second or so, then ramping back up to nearly full speed for half a second, then slowly falling off to zero, unpredictably.

    Multiple motors won’t change the speed of the vibrator, only the pattern of vibration, and the rate at which it changes is a function of the speed of the various different motors. If you have a motor that spins at 400 RPM and one at 200 RPM, you’ll get a vibration that cycles more than once a second–so you’d end up with a raspy buzz, rather than a changing “full power, then off, then half power, then full power” kind of pattern.

  29. The tricky thing is to take a digital output and then use that as a motor speed control. That’s the bit I don’t know how to do–vary the speed of the motor with a digital signal. I’m good with digital electronics, not so good with D/A stuff or analog electronics. If there’s a single-chip solution for htis kind of application with small (3V, 6W) motors, that’d be idea.

  30. That’s an interesting approach, and has the advantage of being much easier to code than a sum of sine waves. You know, I’m actually getting interested enough in this project now that I want to make the time to build a prototype!

  31. Re: Which one of Mom’s vibes will work the best?

    Neat! What’s scary is I actually know more kinky poly folks in Chicago than in Atlanta these days.

  32. And measuring those is quite easy to do and can be done with afforable off-the-shelf components. I’ve built an improvised rig that can measure and record vaginal or anal contractions (connected to my PC via usb) for less than $100, and it’s fun to control things with it 🙂

  33. Random number generation

    Why not use a True Random Number Generator? (also known as a Hardware Random Number Generator)

    This consists of a silicon device and an amplifier. you amplify the quantum or thermal noise form a silicon junction and then sample it at regular intervals, in theory this gives one of the best approximations to a random number.

    • Re: Random number generation

      That’d work, but the downside I see is that hardware random number generators (at least those I’m familiar with) tend to be very pricey. In addition to lack of time, I also have…err, significant budgetary constraints. 🙂

      • Re: Random number generation

        http://www.cryogenius.com/hardware/rng/

        I swear to god I know people with entropy fetishes who would pay for this. ^_^

        It’s not as hard as you’d think, the question is, exactly what do you do with the random output? That’s the problem I’m running into. Sure, we’ve got a line to run off of now, but what does this say about motor speed? Does each number specify a motor speed for some static time portion? Do we have some function that generates that speed scheduling out of the random stream too?

        See, I can overengineer anything! ^_^

        • Re: Random number generation

          It’s not as hard as you’d think, the question is, exactly what do you do with the random output? That’s the problem I’m running into. Sure, we’ve got a line to run off of now, but what does this say about motor speed? Does each number specify a motor speed for some static time portion? Do we have some function that generates that speed scheduling out of the random stream too?

          I’ve been chewing on this problem for a while, and I think I’ve found an answer.

          This answer assumes a random stream of numbers in the range of 0-255, as this is most convenient when working with a hardware random number generator. The math becomes easier if we assume an arbitrary random number range, such as 0-100. The way to adapt the idea to such a random number generator will be intuitively obvious to the most casual of observers. 🙂

          Anyway, the idea that occurred to me while I was in the shower is this:

          When the device is turned on, the motor in the vibrator begins running at 50% of its maximum speed. Each second, the device queries the hardware random number generator for a random number. If this random number is even, the device will increase the speed of the motor; if it is odd, the device will decrease the speed of the motor.

          The motor speed will change by a value equal to ((random number/2)/127)*100. This produces a percentage change; the motor speed will be changed by an amount equal to this percent of its current speed (if the change is downward) or the maximum speed minus its current speed (if the change is upward). The change in speed will be done smoothly over a period of one second.

          So, for example, here’s a six-second graph of the motor’s speed as determined by six random numbers:

          Essentially, the idea is to generate two components randomly: up or down (motor speed increasing or decreasing), and then a percentage between 0 and 100 (indicating how much the motor speed should changed based on its current speed). Changes that would bring the motor speed below 0 or above 100% of its rated speed would result in the motor remaining at 0% or at 100% of its speed.

          Why consider the change values as percentages of the motor’s current speed?

          Because that produces large swings when the motor speed is near to its maximum and its speed is down, or when it’s near zero and the speed is up; but small changes when the motor speed is near maximum and its speed is adjusted up, or when it’s near its minimum and the motor speed is adjusted down.

          Whaddya think?

          • Re: Random number generation

            I like this idea a lot. It should be fairly simple to implement on what I’ve got (stupid ATTiny13s are making me have to avoid things like floating point numbers and other nice, rapid prototyping if slow calculating features). I’ll see if I can’t whip something up that looks like this tonight.

            I finished my first version of a board similar to this on Friday, and took it for a spin at Dore Alley this weekend. Should have a post about it up this evening, it was definitely… interesting. 🙂

    • Re: Random number generation

      Actually, better than a true random number sequence would be a m-sequence. These are pseudorandom sequences which can be generated with at least 1st or 2nd order counterbalancing and have a bunch of nice properties.

      • Re: Random number generation

        Neat! I think you’re right; an m-sequence might be better than true random numbers, as it will, on balance contain an even distribution of values which can be interpreted as “motor faster” and “motor slower.”

  34. Random number generation

    Why not use a True Random Number Generator? (also known as a Hardware Random Number Generator)

    This consists of a silicon device and an amplifier. you amplify the quantum or thermal noise form a silicon junction and then sample it at regular intervals, in theory this gives one of the best approximations to a random number.

  35. Re: Random number generation

    That’d work, but the downside I see is that hardware random number generators (at least those I’m familiar with) tend to be very pricey. In addition to lack of time, I also have…err, significant budgetary constraints. 🙂

  36. Re: Random number generation

    http://www.cryogenius.com/hardware/rng/

    I swear to god I know people with entropy fetishes who would pay for this. ^_^

    It’s not as hard as you’d think, the question is, exactly what do you do with the random output? That’s the problem I’m running into. Sure, we’ve got a line to run off of now, but what does this say about motor speed? Does each number specify a motor speed for some static time portion? Do we have some function that generates that speed scheduling out of the random stream too?

    See, I can overengineer anything! ^_^

  37. Obvious response

    Your next project must be to build some kind of sensory input device, to test some variable or set of variables that would be a strong indicator for imminent orgasm, and incorporate that input into your wave… in an inverse proportion. 🙂

    Yes, I think about sex this much too.
    btw, you could probably find a few investors at http://www.tantalism.org

  38. Re: Random number generation

    Actually, better than a true random number sequence would be a m-sequence. These are pseudorandom sequences which can be generated with at least 1st or 2nd order counterbalancing and have a bunch of nice properties.

    • Re: some thoughts.

      Neat site! I hadn’t seen that one before. The idea of adapting a theremin-style input to a vibrator is particularly ingenious.

  39. Re: Random number generation

    It’s not as hard as you’d think, the question is, exactly what do you do with the random output? That’s the problem I’m running into. Sure, we’ve got a line to run off of now, but what does this say about motor speed? Does each number specify a motor speed for some static time portion? Do we have some function that generates that speed scheduling out of the random stream too?

    I’ve been chewing on this problem for a while, and I think I’ve found an answer.

    This answer assumes a random stream of numbers in the range of 0-255, as this is most convenient when working with a hardware random number generator. The math becomes easier if we assume an arbitrary random number range, such as 0-100. The way to adapt the idea to such a random number generator will be intuitively obvious to the most casual of observers. 🙂

    Anyway, the idea that occurred to me while I was in the shower is this:

    When the device is turned on, the motor in the vibrator begins running at 50% of its maximum speed. Each second, the device queries the hardware random number generator for a random number. If this random number is even, the device will increase the speed of the motor; if it is odd, the device will decrease the speed of the motor.

    The motor speed will change by a value equal to ((random number/2)/127)*100. This produces a percentage change; the motor speed will be changed by an amount equal to this percent of its current speed (if the change is downward) or the maximum speed minus its current speed (if the change is upward). The change in speed will be done smoothly over a period of one second.

    So, for example, here’s a six-second graph of the motor’s speed as determined by six random numbers:

    Essentially, the idea is to generate two components randomly: up or down (motor speed increasing or decreasing), and then a percentage between 0 and 100 (indicating how much the motor speed should changed based on its current speed). Changes that would bring the motor speed below 0 or above 100% of its rated speed would result in the motor remaining at 0% or at 100% of its speed.

    Why consider the change values as percentages of the motor’s current speed?

    Because that produces large swings when the motor speed is near to its maximum and its speed is down, or when it’s near zero and the speed is up; but small changes when the motor speed is near maximum and its speed is adjusted up, or when it’s near its minimum and the motor speed is adjusted down.

    Whaddya think?

  40. Re: Random number generation

    Neat! I think you’re right; an m-sequence might be better than true random numbers, as it will, on balance contain an even distribution of values which can be interpreted as “motor faster” and “motor slower.”

  41. Re: Obvious response

    The addition of some kind of biometric feedback intended to stop the device if the wearer approaches orgasm is definitely something that should be incorporated into the second version of this thing.

    Now if only I had time to build the first version… 🙂

  42. Re: Random number generation

    I like this idea a lot. It should be fairly simple to implement on what I’ve got (stupid ATTiny13s are making me have to avoid things like floating point numbers and other nice, rapid prototyping if slow calculating features). I’ll see if I can’t whip something up that looks like this tonight.

    I finished my first version of a board similar to this on Friday, and took it for a spin at Dore Alley this weekend. Should have a post about it up this evening, it was definitely… interesting. 🙂

  43. Re: some thoughts.

    Neat site! I hadn’t seen that one before. The idea of adapting a theremin-style input to a vibrator is particularly ingenious.

    • From the looks of it, finding a volunteer shouldn’t prove too difficult. Apparently, the world is filed with people willing to be teased without mercy…

      • The problem I am foreseeing is sensor calibration. You really need a person with a sensor placed appropriately upon (or in) their personage and then measure the response in relation to stimulation so that signal processing, analogue and DSP, can be set up to allow the software to make best use of the data collected.

        That said, the random number to PWM stuff is now working while connected to an LED, just need to get a vibrating device to connect it to.

  44. From the looks of it, finding a volunteer shouldn’t prove too difficult. Apparently, the world is filed with people willing to be teased without mercy…

  45. The problem I am foreseeing is sensor calibration. You really need a person with a sensor placed appropriately upon (or in) their personage and then measure the response in relation to stimulation so that signal processing, analogue and DSP, can be set up to allow the software to make best use of the data collected.

    That said, the random number to PWM stuff is now working while connected to an LED, just need to get a vibrating device to connect it to.

    • Re: Done it!!

      Dude! That ROCKS!

      “The RNG has already been explained, the motor drive board has a diode (1n4148) coming off the PWM output pin going to a simple low pass filter made from a 1nF cap and a 100R resistor which then drives a Darlington voltage follower to run the motor.” Now that’s what I call talking dirty…

  46. Re: Done it!!

    Dude! That ROCKS!

    “The RNG has already been explained, the motor drive board has a diode (1n4148) coming off the PWM output pin going to a simple low pass filter made from a 1nF cap and a 100R resistor which then drives a Darlington voltage follower to run the motor.” Now that’s what I call talking dirty…

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.