Manual for Vibrator-Control?

Ideas and instructions how you can make your own bondage toys.
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Re: Manual for Vibrator-Control?

Post by amity »

Hi Sir Cumference
sorry for my late reply - I was a week abroad for work...

Below is zhe beginning of your program which I have used.
I only made it longer but it is repeating the same sequence.

/*
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 = 9; //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 <= 10 )
{
int minTime=1000; //value in ms. Minimum length of pulse or pause (Default = 500)
int maxTime=1100; //value in ms. Maximum length of pulse or pause (Default = 5000) hier5000 setzen
int minInt=5; // Minimum intensity value (0-255) MUST BE SMALLER THAN maxInt ! (Default = 50)
int maxInt=6; // 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) hier100: 1Zyklus = ca. 105sec, => 19-20 Min
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 > 10 && counter <=15 )
{
int minTime=500; //value in ms. Minimum length of pulse or pause (Default = 500)
int maxTime=1100; //value in ms. Maximum length of pulse or pause (Default = 5000)
int minInt=150; // 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=12; // 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 2 ############
if ( counter > 15 && counter <= 20 )
{
int minTime=1000; //value in ms. Minimum length of pulse or pause (Default = 500)
int maxTime=2100; //value in ms. Maximum length of pulse or pause (Default = 5000)
int minInt=100; // Minimum intensity value (0-255) MUST BE SMALLER THAN maxInt ! (Default = 50)
int maxInt=155; // Maximum intensity value (0-255) MUST BE LARGER THAN minInt ! (Default = 250)
int balance=15; // 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"
}

and so on...

I wanted to use the "fade" program (from the arduino program) inbetween, let`s say for counter>10 to counter<15 but the test run didn`t work out :-(
I can`t get it done.
If you find the time to amend the program that would be great :-)

Amity


and this is the fade program from Arduino (of course...)
/*
Fade

This example shows how to fade an LED on pin 9
using the analogWrite() function.

This example code is in the public domain.
*/

int led = 9; // the pin that the LED is attached to
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by

// the setup routine runs once when you press reset:
void setup() {
// declare pin 9 to be an output:
pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
// set the brightness of pin 9:
analogWrite(led, brightness);

// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;

// reverse the direction of the fading at the ends of the fade:
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
User avatar
Sir Cumference
Moderator
Posts: 1608
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

Ok, I think I know what the problem is.


In the other parts of the program, it takes a loooong time to go through each loop.
It is on and off for minutes.
You have some really long
Delay(a lot of milliseconds);

In the "fade" sketch, in races through the loop in something like 30 milliseconds (because the entire idea is to dash through it, adjust the intensity a little bit, then go through it again), meaning that it will take it about 150ms to finish all your planned runs. The only delay is
Delay(30);


The quick fix is to just give it some really large numbers to work with.
That should work.

Code: Select all

// ############  Level 3 ############
if ( counter > 10 && counter <=5000 )
{"do the fade"}
Should give you 2-3 minutes of fading.

The "correct way" to solve the problem would be to use the internal timer in the arduino, making it only depend on the elapsed time.
I didn't do that originally, to keep the code as simple and understandable as possible.
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
User avatar
Sir Cumference
Moderator
Posts: 1608
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

But here is how it could be done.
It uses "if loops" and the value of millis() will decide which one.
This sketch will just blink an LED, but you can fill in anything you desire:

Code: Select all

/* "Do different things according to timer".


The sketch simply checks the timer to see how many 
milliseconds have elapsed since booting, and 
chooses what to do based on this.

 
 */

// constants won't change. Used here to 
// set pin numbers:
const int outputPin =  13;      // output

// Variables will change:
long timeNow = 0;        // 

void setup()    
{
 pinMode(outputPin, OUTPUT);  // the digital pin is output:
 Serial.begin(9600); // start serial monitor  
 Serial.println ("Do different things according to timer");
 Serial.println ("Version 1.0 20 JUNE 2015");
 Serial.println ("Output pin is # 13");
 Serial.println (" ");
 Serial.println (" ");
}

void loop()
{
timeNow = millis();
 
  
//********** The first thing to do *********  
  if(timeNow < 10000) 
  {
    Serial.println ("Case 1");
    digitalWrite(outputPin, HIGH);  //to get 1 blink
    delay (100);
    digitalWrite(outputPin, LOW);
    delay (1000);
  }
  
//********** The second thing to do *********  
  if(timeNow > 10000 && timeNow < 20000) 
  {
    Serial.println ("Case 2");
    digitalWrite(outputPin, HIGH);  //to get 2 blinks
    delay (100);
    digitalWrite(outputPin, LOW);
    delay (100);    
    digitalWrite(outputPin, HIGH);
    delay (100);
    digitalWrite(outputPin, LOW);
    delay (1000);
  }  
  
//********** The third thing to do *********  
  if(20000 < timeNow ) 
  {
    Serial.println ("Case 3");
    digitalWrite(outputPin, HIGH);  //to get 3 blinks
    delay (100);
    digitalWrite(outputPin, LOW);
    delay (100);    
    digitalWrite(outputPin, HIGH);
    delay (100);
    digitalWrite(outputPin, LOW);
    delay (100);    
    digitalWrite(outputPin, HIGH);
    delay (100);
    digitalWrite(outputPin, LOW);
    delay (1000);
  }  
}
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

programmer is not responding

Post by amity »

I am not amused :( :( :(

From one "program uploading" to the next, something went wrong.
I cannot upload a program anymore, not from the open library or my old programs, because i get the following:

Arduino: 1.6.5 (Windows 7), Platine: "Arduino Uno"
avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0xfd
...
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xfd

I haven`t changed the board
Uploaded the arduino software again - no help here
Port is unchanged COM1

I have tried to goole it - but no luck so far.
Can someone help and tell me what I did wrong???

Actually I have tried (with my little knowledge) to program my own sketch, but now I am back to square one.

Thanks a lot
amity
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Re: Manual for Vibrator-Control?

Post by amity »

...I have pressed reset just before selecting Upload menu item...
no help
User avatar
Sir Cumference
Moderator
Posts: 1608
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

Restart the computer and use another USB-port?
Another USB-cable?
~ 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 »

Hi
Annother USB-port: no change
another cable: will check if I have annother one...
keep you informed :-)

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

Re: Manual for Vibrator-Control?

Post by amity »

The device manager of my computer shows no "arduino" anymore.

Hmmmm, the cable???
But the lights on the board lighten up if I connect the arduino with the USB-port of the computer?
Does it make sense

Try to find a new cable...
User avatar
Sir Cumference
Moderator
Posts: 1608
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

The USB has four wires: one power supply, two data, one ground.

If "data" is broken, it can still power the Arduino.

If you have burned the USB-chip on the Arduino, you will have the same problem.
(I've done that once, luckily I have a large pile of them.
A couple of original Unos, a Mega, a couple of home-made 8MHz Unos, some Uno clones and several Pro-Minis built into things)
~ 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 »

A new cable - same problem.

All right: i will prepare a funeral for the board then :-(

burned USB-chip:
Does is just happen or is there a special "something" I have to avoid in the future?
User avatar
Sir Cumference
Moderator
Posts: 1608
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

Some ways to destroy an arduino:

http://www.divilabs.com/2013/10/ways-in ... stroy.html

I think #12 is a good guess.


The stuff that killed mine, was using a bad/cheap power supply.
It can theoretically work with up to 20V, but a 9 or 12V should be used.
I don't know if the cause of death was too high voltage, a voltage spike or a lot of noise.... but dead it was.

Was it an original or a clone?
~ 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 - I hardly understand the headlines in this article :-)
One way or another:

the board is dead.
Long live the board.
I am going to order a new one...

It was a clone - i guess
It says arduino uno but the price was def. below 10.- as I recall.
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Re: Manual for Vibrator-Control?

Post by amity »

I am waiting for my new board...

In the meantime I have time for thoughts:

In the basic "fade"-program:

Is there a way to delay the loops?
For example:
The first loop runs for 15sec (fade), I want to delay the begin of the next loop (15 sec of fading) for a certain time (60sec, or even better random).

Thanks again
amity
**
Posts: 61
Joined: 14 Jan 2009, 14:15

Re: Manual for Vibrator-Control?

Post by amity »

this works:

*fade*...

// wait for 30 milliseconds to see the dimming effect
delay(200);
if (brightness == 0)
delay(30000);

:D
User avatar
Sir Cumference
Moderator
Posts: 1608
Joined: 29 Jan 2012, 22:00
Location: Scandinavia

Re: Manual for Vibrator-Control?

Post by Sir Cumference »

:D
It can be as simple as that!
~ Leatherworking, blacksmithing , woodworking and programming are the most pervertable skills you can learn! ~
Post Reply