Controlling Vibrator with "Arduino UNO" Board

This is the place for all suggestions, releases and feedback regarding Milovana Hardware efforts.
tdres
Explorer
Explorer
Posts: 6
Joined: Fri Feb 11, 2011 6:36 pm

Re: Controlling Vibrator with "Arduino UNO" Board

Post by tdres »

aimauanca wrote: 1. can I control the board (and hence the masturbatory device) from a PC? Via USB or serial? From java?
The Arduino board has one serial port. It's wired to a USB->Serial converter that's built onto the board. When connected to a PC, it appears as a USB->Serial adapter. You can talk to it in the usual way. There's even a bunch of canned libraries for Processing (a Java-based SDK/IDE) geared towards talking to an Arduino board.
aimauanca wrote: 2. what male masturbatory devices are there that could be conceivably controlled? Does taping a vibrating bullet to the head of your prick really work? Can it make you cum? Only if the latter is true can the "ideal" controlling program take you to the edge so many times.
There's tons of options, although I don't think bullet+tape provides a great user experience. With the right glue, a microcontroller can run stoker machines, pneumatic machines like the Venus 2000, belt massagers like the realtouch...
User avatar
Nezhul
Experimentor
Experimentor
Posts: 2373
Joined: Fri Apr 30, 2010 6:22 am
Sexual Orientation: Straight

Re: Controlling Vibrator with "Arduino UNO" Board

Post by Nezhul »

As I said it can run almost anything, but you'd have to really unscrew the device and use some soldering, to make a controlling line that may be connected to audrino. As far as it's electric you may control with it ANYTHING. But something is easyer to build for electronics noobs, such as myself. And something is much harder. So hard that I wouldn't risk such expencive device to be broken by me.
Check out my new site, and read SexTV story there!
Also I have the DARK section that features feature Erotic Horror.
I also launched a SubscribeStar recently! Please come check it out!
Updated whenever I feel like it. :wave: :love:
Image
PiJoy
Explorer
Explorer
Posts: 52
Joined: Wed Sep 07, 2011 6:29 pm
Gender: Male
Sexual Orientation: Straight
Dom/me(s): Not yet
Sub/Slave(s): Not yet
Location: Boston Metro Area, Massachusetts, USA

Re: Controlling Vibrator with "Arduino UNO" Board

Post by PiJoy »

Hello everybody,

I've used Arduino clones to control DC motors, which are what most vibrator are (except for the mighty Hitachi Magic Wand, which uses rectified AC into DC, for those of you geek out at the tech details.) I suspect that the current drive of the Arduino Uno are similar to earlier Arduinos, but that's worth checking from the (AVR) processor's specs.

To control a vibrator from an Arduino pin (digital output or PWM output), you'll need the following things, at least if you do it my way:

(1) A source of DC power, preferably one separate from the Arduino's power (so the motor currents don't cause the Arduino to glitch.) With care, and some big capacitors, one can use the Arduino's +5v rail, but watch for glitching the processor, and pay attention to the total current you can draw from the +5 rail.
A separate supply is nice, if you have the $ and space in your design.

(2) A transistor that has enough current gain (Hfe or Beta) so that the Arduino pin's rated output current times beta is comfortably above the max current the vibrator motor will draw, when running. Even better, to drive the transistor into saturation, so that it dissipates less power. The transistor also needs to be rated for (a comfortable margin above) the DC supply for the motor. NPN or N-channel MOSFETs are generally easier to work with, and often cheaper. If you don't drive the transistor fully into saturation, you may need to heat sink it.

(3) a resistor between the Arduino pin and the base (or gate if using a MOSFET), to limit the current to within the Arduino's rated current output. Caution, if using a MOSFET, the initial current inrush can be quite large, since the MOSFET's gate looks (to the pin), like a big capacitor, which can suck (or source) big currents, if only for a very short while. Even such short times can kill an Arduino pin, so be conservative, and look at the data sheets.

(4) A diode to prevent the inductive kick-back from the motor's inductance from destroying the transistor. Again, this is a short-duration phenomenon, but it has killed many a hobbiest's transistors.

A rough attempt at an ASCII schematic follows:

Code: Select all

 PositiveRailOfSupply >-------------------------                                              |                                              |_                                           /    \                                           |  M  |   Motor                                            \___/                                              |                                              |-------------                                              |             |                                              |             --                                               | Collector  |C |                                             _|_           |  | Diode                                      Base   /    \         |  |ArduinoOutputPin >---[ Resistor ]----------|  T  | NPN     |A |                                                   \___/           --                                      Emitter |             |                                              |             |Ground >--------------------------------------|------------- 
In the above circuit, the transistor is used to sink (pull down) current from the motor. The resistor limits the current into the transistor's base to within the processors rated sourcing current. The diode protects the transistor from the inductive kick-back voltage, when the motor is turned off. You leave this diode out at your transistor's peril. (And diodes are cheaper than transistors!)

Note that low-voltage (turn on) power MOSFETs are not that widely available or inexpensive, so I've used NPN transistors, to run modest motors. The key is to saturate the transistor's base drive, so little power is dissipated in the transistor. If you're running the Arduino pin in PWM mode, then you have to pay attention to the power dissipated during both the switch-on and switch-off transients, since these will be a much greater fraction of the time. If you want more current, consider using a Darlington Transistor, or the analogous NPN-Nchannel MOSFET combination.

I hope this is helpful. Feel free to comment here or send me a PM. However note that I haven't been checking this forum that all often.
User avatar
nilcum
King of Hardware
King of Hardware
Posts: 143
Joined: Tue Dec 26, 2006 6:47 am
Gender: Male
I am a: Switch

Re: Controlling Vibrator with "Arduino UNO" Board

Post by nilcum »

Hey, it's been awhile. I'm finally back and will be picking up my hobby once again. Thanks for the great post PiJoy! I had a very similar setup way back when.

My short term plan to get back into it is to start small and use this setup with my arduino to control one vibrator over PWM. I will post again with voltage and current requirements to drive your typical DC vibrator. Also I believe one could drive a hitachi with on/off functionality with a simple relay. Anyway, once I am setup with the one vibrator I will load up the firmeta firmware that standardizes serial communications to control the arduino outputs. Our firmware code is already written for us.

http://www.arduino.cc/playground/Interfacing/Firmata

There is also some as3glue code that will allow flash to send these commands to a serial port proxy program that users will run locally

http://code.google.com/p/as3glue/

Doing the controller in flash will hopefully make it easier to integrate into flash teases, but it raises a number of cross domain problems. Milovana.com can't communicate with 127.0.0.1 without first jumping through some hoops. If anyone has tried this before or knows more about the pitfalls associated with this kind of model please speak up. The other way to do it would be to have the local serial proxy register with a remote server, which will add a lot of complexity.

Ultimately, I feel where we should strive to be is to allow tease authors to embed code in their teases that will enable automated control of the vibrator.

Big talk for a guy that's been gone for so long. I realize.
PiJoy
Explorer
Explorer
Posts: 52
Joined: Wed Sep 07, 2011 6:29 pm
Gender: Male
Sexual Orientation: Straight
Dom/me(s): Not yet
Sub/Slave(s): Not yet
Location: Boston Metro Area, Massachusetts, USA

More detail Re: Controlling Vibrator with "Arduino UNO" Boar

Post by PiJoy »

nilcum wrote:Hey, it's been awhile. I'm finally back and will be picking up my hobby once again. Thanks for the great post PiJoy! I had a very similar setup way back when.

My short term plan to get back into it is to start small and use this setup with my arduino to control one vibrator over PWM. I will post again with voltage and current requirements to drive your typical DC vibrator. Also I believe one could drive a hitachi with on/off functionality with a simple relay. Anyway, once I am setup with the one vibrator I will load up the firmeta firmware that standardizes serial communications to control the arduino outputs. Our firmware code is already written for us.

http://www.arduino.cc/playground/Interfacing/Firmata

<snip>
@Nilcum,

First off, thanks for your kind words re my post.

Your idea to use Firmata seems useful for integrating such a system with other PC software.
I note that this would enable using the PC's greater computational speed and power to run more elaborate algorithms, and basically use the Arduino as an input/output device, provided that the firmata software doesn't impose too much communication delay. IMHO, having the ability to turn a vibe on/off quickly is important for a teasing/edging system to bring one (deliciously) close to edge, yet still stop in time.

Do you have any idea of what the minimum update time is for a digital pin (or a PWM pin) using Firmata?


I now see that I left a couple details out regarding power supplies, vibe motors and transistors:

Motors and power supply:
The power supply used to drive the motors must be reasonably matched to the vibe motor(s.) Its voltage needs to be high enough to drive enough current through the motor to run it at the desired speed, taking into account the voltage drop from the transistor. Similarly, it must not be too high, or else the motor could be burned out by 100% duty cycle (full on.) It's possible to use a too-high-voltage power supply, and then use PWM (pulse width modulation, kept suitably below 100% duty cycle) to protect the motor. However, this is risky because a software error could then burn out the motor. (There are other means to limit the current drawn from a higher-than-optimal power supply, but those require more knowledge of transistor circuits (and probably heatsinks on the transistors.)

Finally, the power supply must be rated for the sum of all the currents drawn from it, preferably with some margin. PC power supplies can be used; they're widely available and inexpensive (free if scavenged out of a discarded PC.) However those supplies misbehave unless some minimum current is drawn from their main output; a power transistor can be used to maintain a minimum load. Here are a couple links about such power supplies and how to adapt them to such uses:

http://en.wikipedia.org/wiki/Power_supp ... (computer)

http://www.wikihow.com/Convert-a-Comput ... wer-Supply

I've found that small vibrators (literally pager vibrators) can be very effective, if they are properly placed -- and their small size makes effective placement easier than with bigger ones. They also use relatively little current, under a hundred milliAmps max., if I'm remembering correctly. One can also use many of them, if desired, and run spatial patterns. I've used up to four pager vibes, on three independent channels (on Ch. with two motors in parallel.)

Transistor details:
The transistor has to have a current rating (I_c) comfortably above the max. current the motor can draw from the power supply. The transistor may need a heat sink to keep the transistor from thermal burnout.
Transistors to drive pager motors can have much lower I_c and power ratings than for high-current motors. I've used 2N3904 transistors (sans heatsink) to run pager motors.
http://search.digikey.com/scripts/DkSea ... 04-APCT-ND

For substantial motors (those drawing more than approx. 200 mA), I like transistors (or MOSFETS) in a TO-220 package. They can dissipate around one watt without a heat sink, and are easy to heatsink, if required. (Don't put multiple transistors on the same heatsink without electrical isolation or *carefully checking the data sheet; many power transistors have the metal case electrically connected to the collector (or drain for MOSFETs.) Heatsinks for TO-220 packages are inexpensive -- in a pinch, a large enough piece of Aluminum will serve; I've used 1/8" (3 mm) thick AL for this. Some Darlington transistors have a protection diode built in, for example the widely available TIP1XX series, so this can save on components and wiring. In the US, these are readily available from digikey, and start at under $1 each. Here's an example, rated to 2 Amps (I'd use it only up to 1 amp, to be conservative):

http://search.digikey.com/scripts/DkSea ... IP112TU-ND

Or this one, rated up to 5 Amps (I'd use it up to 2 -- 3 amps max):
http://search.digikey.com/scripts/DkSea ... IP122FS-ND


I hope I haven't bored you with too much detail, and that some of you reading will find these details helpful in building fun toys!
bundle
Explorer
Explorer
Posts: 13
Joined: Thu Oct 11, 2012 4:08 pm

Re: Controlling Vibrator with "Arduino UNO" Board

Post by bundle »

Image

I posted about this setup in another thread but I'll give the picture and a more in depth explanation here:

I have hooked up to the arduino uno: an lcd screen, a potentiometer, and the input terminals of a solid state relay. I have a 150W, 9-14 VDC (adjustable) power supply hooked up to the load terminals of the relay and a fleshlight bullet vibrator.

The potentiometer is connected to an analog pin and controls the vibration intensity. The relay is connected to a digital pin and controlled with PWM. The lcd screen displays the value I'm passing to analogWrite() which sets the PWM duty cycle.

For simplicity, I later removed the lcd screen and used the serial monitor to print myself data from the arduino.

This program brings the vibrations intensity slowly up and down and made me cum after about 20 minutes with no other physical stimulation.

Code: Select all

int potPin = 5,    relayPin = 10,    value = 0;    void setup(){  pinMode(relayPin, OUTPUT);  Serial.begin(9600);  analogWrite(relayPin, value);} void loop(){  /*  value = analogRead(potPin);  value /= 4; // analogRead returns 0 to 1023, analogWrite accepts 0 to 255  analogWrite(relayPin, value);    if(Serial)  {    Serial.print("value = ");    Serial.println(value);  }  */    for(int current = 70; current <  170; current++)  {    analogWrite(relayPin, current);     if(current < 80)      delay(1000);    else if(current >= 80 && current < 90)      delay(1200);    else if(current >= 90 && current < 100)      delay(1400);    else if(current >= 100 && current < 110)      delay(1600);    else if(current >= 110 && current < 120)      delay(1800);    else if(current >= 120 && current < 130)      delay(2000);    else if(current >= 130 && current < 140)      delay(2200);    else if(current >= 140 && current < 150)      delay(2400);    else if(current >= 150)      delay(2600);  }  for(int current = 170; current > 70; current--)  {    analogWrite(relayPin, current);     if(current < 80)      delay(1000);    else if(current >= 80 && current < 90)      delay(1200);    else if(current >= 90 && current < 100)      delay(1400);    else if(current >= 100 && current < 110)      delay(1600);    else if(current >= 110 && current < 120)      delay(1800);    else if(current >= 120 && current < 130)      delay(2000);    else if(current >= 130 && current < 140)      delay(2200);    else if(current >= 140 && current < 150)      delay(2400);    else if(current >= 150)      delay(2600);  }}
notes:
- I measured the resistance of my bullet vibrators to be about 13.4 Ohms, which at 4.5v will pull 335.8mA
- The vibrators got very hot after running for a long time.
Last edited by bundle on Thu Nov 15, 2012 8:12 am, edited 2 times in total.
PiJoy
Explorer
Explorer
Posts: 52
Joined: Wed Sep 07, 2011 6:29 pm
Gender: Male
Sexual Orientation: Straight
Dom/me(s): Not yet
Sub/Slave(s): Not yet
Location: Boston Metro Area, Massachusetts, USA

Re: Controlling Vibrator with "Arduino UNO" Board

Post by PiJoy »

bundle wrote:    
<snip>

notes:
- I measured the resistance of my bullet vibrators to be about 13.4 Ohms, which at 4.5v will pull 335.8mA
- The vibrators got very hot after running for a long time.

@Bundle,

You're probably putting too much current through your vibe's motor; that's why it's getting hot. Motors are NOT simple resistors; so you'd be much better off measuring the current in the vibe's original circuit and modifying your circuit so that it matches that current at max. power. Running a designed-for-3-volt motor at 4.5 volts may eventually burn it out (melt the insulation off the wires, which glues the rotor to the stator.)
bundle
Explorer
Explorer
Posts: 13
Joined: Thu Oct 11, 2012 4:08 pm

Re: Controlling Vibrator with "Arduino UNO" Board

Post by bundle »

PiJoy wrote:@
Bundle,

You're probably putting too much current through your vibe's motor; that's why it's getting hot. Motors are NOT simple resistors; so you'd be much better off measuring the current in the vibe's original circuit and modifying your circuit so that it matches that current at max. power. Running a designed-for-3-volt motor at 4.5 volts may eventually burn it out (melt the insulation off the wires, which glues the rotor to the stator.)
The vibrators ran off of 3 1.5v LR44 button cell batteries. My power supply is adjustable and can give anywhere from ~9.4-14v up to 150W. At its lowest voltage setting, a PWM duty cycle of around 50% should give close to 4.5 volts(assuming I understand electronics as well as I think I do :-/ ). One of the programs I ran went up to 170 out of 255 for the duty cycle or ~66.6%. If 100% gives 9.5v, 66.6% would give a little more than 6v.

It was a huge pile on my desk so its all put away now but if I pull it back out and start tinkering again, I'll make sure to lower the upper limit of the PWM to around 50% or lower.
User avatar
les
Experimentor
Experimentor
Posts: 6126
Joined: Thu Apr 19, 2007 10:04 am
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Dom (Male)
Sub/Slave(s): My serfs
All 2 True is head Serf
Location: London England
Contact:

Re: Controlling Vibrator with "Arduino UNO" Board

Post by les »



You must measure the voltage and current of the motor using original battery types, their internal resistance has a bearing on the available power consumed by the motor.
You may need to include a resistor to stop motor burn out.

                                          Lord Les
                                 Be careful what you wish for!

Growing OLD Is Inevitable,
          But Growing UP... Is Optional
                    OR
                              Why do I have to stop being a KID now I can afford it.







                                
                                                                                                                                                   
PiJoy
Explorer
Explorer
Posts: 52
Joined: Wed Sep 07, 2011 6:29 pm
Gender: Male
Sexual Orientation: Straight
Dom/me(s): Not yet
Sub/Slave(s): Not yet
Location: Boston Metro Area, Massachusetts, USA

Re: Controlling Vibrator with "Arduino UNO" Board

Post by PiJoy »

bundle wrote: The vibrators ran off of 3 1.5v LR44 button cell batteries. My power supply is adjustable and can give anywhere from ~9.4-14v up to 150W. At its lowest voltage setting, a PWM duty cycle of around 50% should give close to 4.5 volts(assuming I understand electronics as well as I think I do :-/ ). One of the programs I ran went up to 170 out of 255 for the duty cycle or ~66.6%. If 100% gives 9.5v, 66.6% would give a little more than 6v.
@bundle,

As Les also wrote, you won't get an accurate measurement of your vibe's max. steady-state current, unless you measure the current using the original battery type. Matching your power supply to the same *open-circuit* voltage as the batteries will not necessarily (and probably won't) give you an accurate current measurement. Those small button cell batteries have an internal resistance that limits their peak (AKA short-circuit) current. Your power supply almost certainly has a much lower effective series resistance, so a measurement done with a power supply set to equal the open-circuit voltage of three button cells in series, will almost certainly OVER ESTIMATE the maximum safe running current. So if your vibe motors run hot, you may well want to re-measure the motor current in a more accurate way.

Hope this helps
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest