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 »

More than a thousand words:
image.jpg
I quickly replaced the motor with a lightbulb. Listening to a motor whirring in ever changing intensities is an incredibly annoying background noise!



Notice that the only role of the breadbord is to connect the wires to the Arduino with the pins on the MOSFET board.
(My male-female wires had disappeared somewhere in the workshop)
~ 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 »

You name it: better than a thousand words.

I have ordered everything and are waiting for the things to come.
The mosfet will take some time, because i couldn´t get it around the corner.

I like the idea with the breadboard to connect the Moseft with the arduino. It gives some stability.

@ Pijoy / Sir Cumfrence
I took my time to look into "ladyada" learing-program (yes, I am a computer-nerd now) :D
Thanks for mentioning it.

...eager to start when hardware has arrived.
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

Programming has so many uses, you will not regret it!



I've fixed a bug that would make the program stop if too high a value for "balance" was chosen, and changed an annoying typo, that probably only I would notice :oops:

Version 1.2:

Code: Select all

/*
Random motorcontroller

History:
- Version 1.1        06 September 2014
"Balance" Pause/Pulse has been added as a user parameter.
- Version 1.2        11 September 2014
offTime defined as "long" to enable "off > 32676 ms"

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

:-)
*/

// 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=2; // 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
long 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 ("ms 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! ~
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

amity wrote: .......
I like the idea with the breadboard to connect the Moseft with the arduino. It gives some stability.
....
Some mechanical stability, yes, but breadboards can be quite annoying.

Their value is, that they are quick and easy to move components around on, connect and change the connection. If you solder something together it is semi-permanent, and if you just want to test something or expect to reuse the part for something else in a moment, the breadboard is your friend.

If you shake it, drop it or just move it around too much, some wire will get caught in something.

But do not worry about that now. It is time to play.


I changed the pins on my MOSFET board to a female header (still have not found those pesky male-female wires) allowing me to connect directly from Arduino to board.
image.jpg
If I was going to use this setup more permanently, I'd put all the parts in an appropriate box and fix them there wit hot melt glue or styrofoam blocks.
Put an on/off switch in the lid and a 2mm jack to connect the wire form the vibrator.



It sends information to the serial monitor, just in case you are in doubt what it is doing.
When you are developing code, the serial monitor is a real friend!
If you let it write comments along the way, you can quite often pinpoint where it does something you did not intend it to.

This is what the serial monitor writes when the program is running:
Welcome to Amity's Random Vibrator Controller
The following defining values have been chosen:
Pulse and pause durations will be between 500 and 5000 ms.
Intensities will be between 150 and 255.
Balance pause/pulse is set to: 1

Let the fun begin!

ON! Int = 157 On-time = 4151
OFF! Int = 0 Off-time = 860
ON! Int = 154 On-time = 4634
OFF! Int = 0 Off-time = 3267
ON! Int = 172 On-time = 3146
OFF! Int = 0 Off-time = 1452
ON! Int = 207 On-time = 688
OFF! Int = 0 Off-time = 2870
ON! Int = 234 On-time = 1434
OFF! Int = 0 Off-time = 3595
ON! Int = 186 On-time = 3103
OFF! Int = 0 Off-time = 1350
ON! Int = 151 On-time = 2570
OFF! Int = 0 Off-time = 2694
ON! Int = 226 On-time = 2874
OFF! Int = 0 Off-time = 3680
ON! Int = 225 On-time = 1776
OFF! Int = 0 Off-time = 3740
ON! Int = 220 On-time = 622
OFF! Int = 0 Off-time = 727
ON! Int = 215 On-time = 2642
OFF! Int = 0 Off-time = 3165
ON! Int = 223 On-time = 785
OFF! Int = 0 Off-time = 2347
ON! Int = 244 On-time = 3291
~ 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 »

Wow - can´t wait until I have all the components in my hand to get going and to try this program.

By the way you have answered the questions that I haven´t even asked: how to modulate the intensities of the vibe.
The Moseft will take at least 8 to 10 days to arrive, I think...
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

amity wrote:Wow - can´t wait until I have all the components in my hand to get going and to try this program.

By the way you have answered the questions that I haven´t even asked: how to modulate the intensities of the vibe.
The Moseft will take at least 8 to 10 days to arrive, I think...
Pulse width modulation is really smart, but when you move on, remember that you should only use it with DC, and that you can't use it with a mechanical relays.



Remember: As soon as you have the Arduino, you can start playing.

LadyAda's lesson http://www.ladyada.net/learn/arduino/lesson0.html, 1 and 2 do not need anything but the board, the cable and your computer.
There is a small LED attached to pin 13 on the board, and that is all the "output device" you need to get started.


That means, you can have everything up and running, have learned the basics and feel quite cool about it, when the other parts arrive.
8)
~ 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 »

The Arduino has arrived. :D

It says Arduino UNO on the front and “Board Model UNO R3” on the back.
Made in Italy
Could be original …

The “Blink”-Program is running just fine. Yeah!

Only the Mosfet is missing (that will be a loooong wait) :(
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

amity wrote:The Arduino has arrived. :D

It says Arduino UNO on the front and “Board Model UNO R3” on the back.
Made in Italy
Could be original …

The “Blink”-Program is running just fine. Yeah!

Only the Mosfet is missing (that will be a loooong wait) :(
It will be sooner than you think.

You can start playing with the tutorials, and get all the basics settled.
~ 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 »

@Sir Cumference
I have run your program Random "motorcontroller" from the 11th of Sep. and try to figure out what does what.

The influence of min / max intensity is difficult to tell with only a LED attached.
I guess with a motor attached the differences will be clearer.

:arrow: Is there a way to change the program after -let`s say 100 cycles- to annother loop (with different parameters)?

I tried the same assembly with a bread board (with help from a youtube manual), but didn`t get a result. :(
Hmmm, have to start again to find the mistake.
It looked so easy.
That means: I am really still at the very beginning.

Appreciate your support (all of you that are active here) :hi:
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

Oh yes.

You could start a timer (or count the cycle with a "++") , and use "if"

Then simply let it jump to the next set of parameters

If (timer>x)
{
A new set of parameters
}



I'll have to change to a real computer, before I write any real code.
~ 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 »

amity wrote: :arrow: Is there a way to change the program after -let`s say 100 cycles- to annother loop (with different parameters)?

There is indeed!
And now I'm at a regular computer, than can be used for some decent writing.
The fantastic thing about microcontrollers is, that the hardware is the same, you just change the software.
:D

The very simple way to do it, is counting the number of cycles, then let the program act accordingly:


Version 2.1 is hereby officially released:
(But now you have to go down in the program to insert the values, and how many cycles you want before a change occurs)

The new additions:
A new parameter called "counter" for holding the number of cycles.
Each time through the loop it will encounter this line:
counter ++; // add 1 to the value of "counter"
It will take whatever value "counter has, and increase it by 1.

Then there are a number of blocks of code starting with an "if (something)"
If the "something" statement is true, the block of code in the following { } will be executed, otherwise it will be ignored.

if ( counter > 5 && counter <= 10 )
Means in this case, that the parameters in the brackets following, will be the ones used in the loop, if the counter is larger than 5 but smaller than or equal to 10.

EDIT: My attempts to write elegant code failed miserably! The code below is written with a shovel, but it is working

Code: Select all

/*
Random motorcontroller

History:

- Version 2.0  17 SEP 2014  (and 2.1, which is actually working)
A cycle counter and different values enanbled
- Version 1.2        11 September 2014
offTime defined as "long" to enable "off > 32676 ms"
- Version 1.1        06 September 2014
"Balance" Pause/Pulse has been added as a user parameter.


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

:-)
*/




// you input the following five values, and upload to the Arduino:
int minTime; //value in ms. Minimum length of pulse or pause (Default = 500)
int maxTime; //value in ms. Maximum length of pulse or pause (Default = 5000)
int minInt; // Minimum intensity value (0-255) MUST BE SMALLER THAN maxInt ! (Default = 50)
int maxInt; // Maximum intensity value (0-255) MUST BE LARGER THAN minInt !  (Default = 250)
int balance; // 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
long offTime; // how long to be off
int counter = 0; // for counting the number of cycles


//****************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 ("Remember to input your desired values in the code.");


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() {


// and then we will let the counter decide the values of the variables
// if it has passed the treshold, use these parameters instead of the starting parameters:

// ############  Level 0 ############
if ( counter <= 5 )
{
int minTime=1000; //value in ms. Minimum length of pulse or pause (Default = 500)
int maxTime=2000; //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=1; // relative offset between off/on. large value = long pauses  (Default = 1)
    Serial.println (" "); // empty line
    Serial.println("Startlevel");
    // 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!   Intensity = ");      // 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!   Intensity = 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"
}



// ############  Level 1 ############
if ( counter > 5 && counter <= 10 )
{
int minTime=1000; //value in ms. Minimum length of pulse or pause (Default = 500)
int maxTime=2000; //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=1; // relative offset between off/on. large value = long pauses  (Default = 1)
    Serial.println (" "); // empty line
    Serial.println("level upgrade 1");
    // 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!   Intensity = ");      // 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!   Intensity = 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"
}


// ############  Level 2 ############
if ( counter > 10 && counter <=15 )
{
int minTime=200; //value in ms. Minimum length of pulse or pause (Default = 500)
int maxTime=3000; //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=1; // relative offset between off/on. large value = long pauses  (Default = 1)
    Serial.println (" "); // empty line
    Serial.println("level upgrade 2");
    // 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!   Intensity = ");      // 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!   Intensity = 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"
}

// ############  Level 3 ############
if (counter>15)
{
int minTime=300; //value in ms. Minimum length of pulse or pause (Default = 500)
int maxTime=4000; //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=1; // relative offset between off/on. large value = long pauses  (Default = 1)
    Serial.println (" "); // empty line
    Serial.println("level upgrade 3");
    // 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!   Intensity = ");      // 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!   Intensity = 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"
}


counter ++; // add 1 to the value of "counter"
// Serial.println (" "); // empty line
Serial.print ("Elapsed number of cycles is:   ");
Serial.println (counter);
Serial.println (" "); // empty line
// 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! ~
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Re: Manual for Vibrator-Control?

Post by amity »

@Sir Cumference

Your program + update:

Amazing.
With unlimited number of loops the program will stay interesting.
Even better: now I could more or less stop the program by just setting “int balance=1000” (or so) in the last loop.

I am getting excited and are still waiting for the Moseft.
Like waiting for Christmas… :)
User avatar
Sir Cumference
Moderator
Posts: 1606
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

Or just set the intensity interval to "0-1"
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
User avatar
Dark_Lizerd
*****
Posts: 2416
Joined: 22 Oct 2006, 11:30
Location: New Mexico

Re: Manual for Vibrator-Control?

Post by Dark_Lizerd »

OK, thing on this...
....
The tease program...
Main loop...
if random #=X then {
do tease #1 for random # of loops
}
if random #= Y then {
do tease #2 for random # of loops
}
if random #=Z then {
do tease #3 for random # of loops
}
If Number of loops= a predetermined # then end...
----------------

Now, every run will be different and you never know what to expect each time...
One rule, cum or not, only 1 run per day...
and no other methods of "relief"...
All advice is checked, re-checked and verified to be questionable...
Don't ask, we both wont understand the answer...
http://www.mediafire.com/download/09dtr ... e_V2_2.exe Not just for nubies any more...
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Re: Manual for Vibrator-Control?

Post by amity »

I am still here...
my program is somewhat crude, I guess - but it runs :-)
...but still waiting for my MOSEFT
but once it`s here: Open fire, all the weapons :D
Post Reply