Manual for Vibrator-Control?

Ideas and instructions how you can make your own bondage toys.
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

That is basically it.

If there is an electronics hobby shop somewhere near you, you could go there for smaller items too.

An arduino from Ebay is probably a clone. I have two genuine, and two fakes (and a lot of Pro Mini-clones, but forget about those for now) They all work as they are supposed to.

I saw there was a parcel for me today, but I didn't have time to collect it. Hopefully it is my MOSFET boards, and in that case, I'll review them ASAP.
.....And post a picture of how I hooked them up to vibrator, power and Arduino.


There are several ways to power an arduino. I think you should stick to the two most common (and less error prone).

You can power it from your computer through the USB cable. Do that for a start. You are going to change the code a lot anyway, so you can just as well leave it attached to the computer.


Or you can power it through the barrel jack.
Image
The power for that is recommended between 7 and 12 V. A 12V supply is great, or you can connect a battery with an adapter like this:
Image
A 9V battery lasts longer than I do.
This is for when you are confident that the code is as it is supposed to be, and you do not want a computer hooked up to it. It could be, that someone else in the household wanted to be on the forum, watch porn or do some other noble task.


what else to buy?

A couple of light emitting diodes and a couple of resistors (330 ohm is fine) will be great to have for the learning experiments.
No need to solder for now. Twist the leads together or use a breadboard.

Some test wires (male-male and male-female) as recommended earlier, and a breadboard will be great for experiments.






You will do yourself a great service by going through LadyAda's tutorials.
http://www.ladyada.net/learn/arduino/index.html
The time spend there, will save you a lot of time later!
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

An update!

"balance" parameter added, to let you change the balance between pauses and pulses.
The larger the number, the longer the pauses.

Code: Select all

/*
Random motorcontroller
06 September 2014

From the infamous Sir Cumference to Amity.
Welcome to the wonderful world of perverted programming!

:-)

Version 1.1
"Balance" Pause/Pulse has been added as a user parameter.

*/

// you input the following five values, and upload to the Arduino:
int minTime=500; //value in ms. Minimum length of pulse or pause (Default = 500)
int maxTime=5000; //value in ms. Maximum length of pulse or pause (Default = 5000)
int minInt=50; // Minimum intensity value (0-255) MUST BE SMALLER THAN maxInt ! (Default = 50)
int maxInt=255; // Maximum intensity value (0-255) MUST BE LARGER THAN minInt !  (Default = 250)
int balance=5; // relative offset between off/on. large value = long pauses  (Default = 1)

// defining the other values the program needs:
const int signalPin = 6; //output. You can change this, but it must be a PWM-pin!
int onTime; //how long to be on
int intensityVal; // with this intensity
int offTime; // how long to be off


//****************SETUP***********
void setup() // runs once to get things ready
{  
  pinMode(signalPin, OUTPUT); //define signalPin as OUTPUT
  randomSeed(analogRead(0)); //listen to an unused pin, to generate (mostly) random values.
  Serial.begin(9600); // start serial monitor, to see in text what is happening
  // I'll use that, and write the values you gave above to the monitor:
  // No real use, just to show you how to send some text.
  
  Serial.println (" "); // empty line
  Serial.println ("Welcome to Amity's Random Vibrator Controller");
  Serial.println ("The following defining values have been chosen:"); 
  Serial.print ("Pulse and pause durations will be between ");
         Serial.print (minTime);
         Serial.print (" and ");
         Serial.print (maxTime);
         Serial.println (" ms.");
 Serial.print ("Intensities will be between ");
         Serial.print (minInt);
         Serial.print (" and ");
         Serial.print (maxInt);
         Serial.println (".");
 Serial.print ("Balance pause/pulse is set to:  ");
         Serial.println (balance);


delay   (1000);   
Serial.println (" "); // empty line
Serial.println ("Let the fun begin!");
Serial.println (" "); // empty line
}

// *************and this is where things happen!***************
// loop runs over and over and over and over.....
void loop() {
// draw some random numbers in the intervals defined by you:
onTime = random(minTime,maxTime);
offTime = random(minTime,maxTime);
offTime = offTime*balance;             //and here the offTime becomes a new offTime!
intensityVal = random(minInt,maxInt);

// And use those random numbers! (While writing to the serial monitor what is happening)
analogWrite (signalPin, intensityVal);  // switch signalPin on with intensity = intensityVal
    Serial.print(" ON!   Int = ");      // and write it in the serial monitor
    Serial.print(intensityVal);
    Serial.print("   On-time = ");
    Serial.println(onTime);
delay (onTime);                          //keep it on for "onTime"
analogWrite (signalPin, 0);              // switch off
    Serial.print(" OFF!   Int = 0");      // ...and write that in the monitor
    Serial.print("   Off-time = ");
    Serial.println(offTime);
delay (offTime);                        // stay switched off for the duration of "offTime"*"balance"

// That's it! Now it will go back to the start of the loop and run it again with fresh values

}
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
PiJoy
**
Posts: 89
Joined: 07 Sep 2011, 18:26
Location: Boston Metro Area, Massachusetts, USA

Re: Manual for Vibrator-Control?

Post by PiJoy »

amity wrote:I have ordered an Arduino UNO R3 Atmegs Board328
Tell that this is the right one... :D
Ordered from ebay but has (of course not) arrived yet.

...wall-wart: I thought i could use the batteries (seperate box) that came with the vibe. Is that correct?

Is that the right item I need to buy next?
http://www.ebay.com/itm/TOP-MOSFET-Butt ... 2ed5359f1d
Found a similar item on ebay.

something else

After that I go get the wires and the screwdrivers an so on.

amity
I hope your Arduino comes with header (connectors) already installed. If not, you'll need to order those and solder them in:
From Sparkfun, the part's link is: https://www.sparkfun.com/products/10007

If you don't have one, you'll need a basic meter to measure ("see") what's doing on -- or not going on! -- in your circuit.
Again a representative link from sparkfun: https://www.sparkfun.com/products/12966

Sparkfun has a similar MOSFET module, but better because the MOSFET on the sparkfun version will turn full on from either a 5 or 3.3 volt logic signal.
See: https://www.sparkfun.com/products/10256
which is a single channel for $4 US (I'd get at least one spare; these are cheap) or
https://www.sparkfun.com/products/10618
for 6 channels. Both require soldering, but you end up with something with screw terminals to connect it to pretty much whatever you want.

With the above boards from Sparkfun, you have essentially no voltage limitations, so long as you have a DC power supply. compatible with your motors. Some motor driver chis/circuits, especially ones that can drive a motor both forward and reverse, need higher (often above 5 volt) power supplies.

Other vendors (adafruit, pololou etc. have similar things you can order; I just picked one to pull up some examples. It's your money, so it'll be you choice what you order and from where.

Hope this helps,
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

There are distributors for both Adafruit and Sparkfun in Germany.

I bought some of my components from http://www.watterott.com/de/SparkFun
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
Theresajayne
*
Posts: 26
Joined: 27 Oct 2013, 15:13

Re: Manual for Vibrator-Control?

Post by Theresajayne »

I am sorry I am so late into this topic, I have done lots of little projects with arduino and rPi.

I think only Sir Cumference came up with the most important part, which was a brief introduction to Programming..

It is known that there are a small percentage of people who cannot program at all. the concept is beyond them.
Electronics is easier to understand, = imagine the components and wires all tranfer water and you will get it, the Battery is a pump and it pumps water round the wires and through the components.
So the FET/Transistor on the motor shield or on the breadboard works as a switch or valve turning the flow on and off. and the more flow the faster the motor turns.

The problem is understanding the logic in how to make the motor turn on and off and use different speeds.
On the arduino i think it uses 128 levels (please correct me if i am wrong as i am doing this from memory)
which means 0 = not on, 128 = max speed (it could also be 256 max speed but the concept is still the same)
so if 128 = max speed, and 0 = off how do we make it run at half speed? 64 = half speed.
So for a truly random vibrator you need more than one random number.
Random Speed, Random time on, Random Time off.
The numbers are also special.

The numbers go up and down in the normal way but there are Magic numbers. 1 2 4 8 16 32 64 128 256 512 1024.
These are special to binary which is the language of the computer. (dont worry you dont need to learn it)
1 = 00000001
2 = 00000010
4 = 00000100
8 = 00001000
16=00010000

and so on.

But back to the computer programming.
In the arduino there is a part of the program which loops the "operating system" of the arduino will run the "method" loop over and over until the power is removed.
So we have to put all our code in the void loop() method in the program.
We want truly random numbers though, so first we have to put a call in the void setup() method which is run on each power on .

void setup()
{
randomSeed(analogRead(1)) //This assumes that analog pin one is not connected to anything.
}

randomSeed is used to make the sequence truly random otherwise you get the same numbers every time as its a pseudo random number generator.

Now we come to the loop.

void loop()
[
//first we want to set up the random numbers for this run.
long delayTillOn = random(60000) //this means any time within a minute (divide by 1000 to get seconds)
long timeOn = random(120000) //This means random for 2 minutes
long speed = random(128) //random up to the top speed of the motor

}

all you have to do then is wait for the delaytillon
delay(delayTillOn)

then turn on the motor at the right speed.
setSpeed(speed)
wait until the time runs out
delay(timeOn)
then set the speed to 0
setSpeed(0)


**Note** setSpeed is not the actual command switching a motor is fairly complex and uses pinouts etc. but it shows the logic we are following http://playground.arduino.cc/Main/DCMotorControl


at that point the loop method finishes and is called again by the arduino system.

I hope this little programming tutorial helps at least a little bit.
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Re: Manual for Vibrator-Control?

Post by amity »

I guess I will use the computer as the power source for the arduino.
I will need the computer anyway for implementing the program, right?

This is the first picture that I have ever uploaded.
I can see the picture in the "preview" - hope it will work when I press "Submit"
Call me "nerd" :D (i am proud)

Is the drawing correct so far or am I on the wrong track?
Please be gentle :shock:
How do I connect the MOSEFT and the arduino?
Wich port of the Moseft goes with which port of the arduino?

Image
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Re: Manual for Vibrator-Control?

Post by amity »

Why is the picture so small???? :x
PiJoy
**
Posts: 89
Joined: 07 Sep 2011, 18:26
Location: Boston Metro Area, Massachusetts, USA

Re: Manual for Vibrator-Control?

Post by PiJoy »

amity wrote:Why is the picture so small???? :x
@Amity,

The small picture you see is an icon. When I clicked it, I was able to download the full-sized image from imageshack, and when I opened the downloaded image, it displays at a useful size.

Re the last three connections:

If you look at the little MOSFET board, the three unconnected signals are labelled:
Sig,
Vcc,
Gnd.

These are, in order:
Sig: the control signal (wire this to the digital output pin you use in your program to turn the vibe on, off or PWM for speed control.)
Vcc: wire this to Arduino's +5 volts. (it's not clear to me offhand why this connection is even needed.)
GND: wire this to the Arduino's ground pin. In general, ground/DC common must be shared (wired together) for electronic modules to "talk" to one another.

Note: in your diagram, I think you have your vibe and battery pack switched around from the correct way. I recommend using a wall-wart instead of a battery pack to supply power for the vibrator. Batteries will work, but get expensive. For example, sparkfun has several wall-wart style power supplies. I suggest getting the highest current one in stock with your local distributor that is 5 volts DC. See: https://www.sparkfun.com/categories/28

Another reason to buy from stable sellers (vs, eBay) is that sparkfun, adafruit and pololou are more likely to have correct technical information and you're more likely to get answers if you post in their customer-support forums.

You're making progress; keep going!
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

I completely agree with PiJoy.

Here it is in a graphical format:
MOSFET motor control.jpg
"SIG" must be connected to whatever pin you choose as output from the Arduino. I the code I've posted earlier, I've used pin 6.

Notice the polarity from the battery box!
It is very important to connect it correctly, or you will in the best case get nothing, in the worst case burn components.

A normal DC motor will change direction when you change polarity. In the case of a vibrator it makes no difference which way it is running, hence I've used black "wires" for it.

Notice also that you have a speed control on the battery box. It is probably just a potentiometer. Set it to full speed, or use it as a "speed limiter".
If the box contains other electronics, it could be disturbing to have two circuits trying to control the same motor, and you should use a battery holder instead.
It will cost you approximately 1 € at the electronic shop.
Image


I do not agree on the wall wart fascination.
When I hook myself up to something, I definitely prefer it to be battery powered. It reduces the possible accidents significantly.
After that comes computer power supplies and last the wall warts.
Some of them are horribly constructed. I have tested a couple, and one of them outputted so much noise, that it caused my microcontroller to reset.

If it is something that has to run day out and day in, I'll normally use a (good) wall wart.
(Or a standalone chip with some clever power saving programming. I made a gizmo once, that would run at least for 5 years on 3 AA batteries)

Battery prices are not an issue when it comes to sex. The rest of the gear is much more expensive (and batteries are relatively cheap), not forgetting that pleasure is worth a lot (in my book at least. I'm so happy they have not managed to impose a "pleasure tax").
And batteries have an intrinsic safety. They can't deliver more that the teaspoonful of chemical energy they contain. The wall wart on the other hand, has a direct line to a megawatt power plant.
:shock:
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

By the way:

The packet yesterday was not my MOSFET shields.
It was another nerdy object that I desired, but not related to naughtiness in any way.
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Re: Manual for Vibrator-Control?

Post by amity »

@PiJoy and Sir Cumference
GREAT - thanks for your support (again).

I coundn`t open my own picture out from this forum :evil: , but you got done somehow. super!

Today, I try to get a Moseft at a local shop (and probably the battery holder) and wires.
Otherwise, I have to buy the Moseft online (only found it on ebay). ("Google is not my friend" except on ebay)
China: cheap but delivery in 30 days or so
Europe: quicker but more expensive (times five)

I think I have understood the outline so far. I don not want to change now.
If (no, better is "when" 8) ) ) I am succesful, I will at least try to install a wall-wart.

Keep you informed...
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

If they sell electronics, rest assured that they have MOSFETs.

Remember to get logic level ones.
That means that the 5V from the output can switch them fully on.

Wires, breadboard, some resistors 330, 1k and 10k, and a couple of LEDs will get you far.

Maybe even a couple of pushbuttons and a couple of 10k potentiometers?
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Re: Manual for Vibrator-Control?

Post by amity »

Good Morning

Mosfets not in stock...
(If have asked for the MOSFET IRT520)

But I will get one, for sure! (somewhere...)
Batterie holder and wires: Done

First I will get this vibe running. If I get hooked by this programming, I will go further and get more hardware.

I got confirmation that the Arduino is on its way...
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

For this purpose, almost any logic level mosfet will do.

irl540 is one I've used a lot.
Image
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

They are here!
It only took 11 days for the MOSFET boards to arrive. That's not bad!


I have one running at my desk at the moment, hooked up to a 4.5V battery and a random DC motor I grabbed from the drawer (I think it came from the carriage drive in an inkjet printer).

It is working perfectly well, and I have no doubt that it will drive the vibrator too.





There is just one funny thing!
The VCC does not seem to do anything! As far as I can measure, it is not connected to anything, and everything is working as it should when it is not connected.
Bemused I am!
Attachments
MOSFET motor control 2.jpg
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
Post Reply