[Arduino] Automatic random intensity change using relays

Selfbondage software and other kinky developments

Moderators: Riddle, Shannon SteelSlave

Rpzor
*
Posts: 10
Joined: 07 Jun 2017, 07:03

[Arduino] Automatic random intensity change using relays

Post by Rpzor »

Before I start:
I feel the need to repeat what many before have told: Electrostimulation requires respect or it can be dangerous. Selfbondage requires respect or it can be dangerous. Always think of this, when you are getting ready to play. Test everything and if unsure, always choose less than more. I have experimented for years, I still advance carefully and yet few times I have screwed up and it resulted in a less of a pleasant experience to say the least.
This is only a presentation of an idea (which made it to a working prototype with HW, so working idea). I post this into the SW section, as I was asked here http://forum.boundanna.net/board/viewto ... 11&t=11936 to provide a code for random relay operation I used in that scenario and also, I think more work went to the code than to the hardware part. Described code and schematic is provided here https://uploadfiles.io/6vuz8. The hosting is only for 30 days. If you know better options, please do tell so I can upload permanently.
If you do not understand the technicalities behind this, don’t try to replicate this step by step. I will not post any exact values or types of parts in the schematic. It’s a simple circuit. If you don’t have the knowledge to select correct parts to make it work from the schematic, you should not attempt to create this device!

Principle description:
The idea behind this device is to add automatic “random” change of intensity to an estim unit that does not have that ability. The reason is to augment selfbondage experience. Of course, in a safe way so no tampering with the unit itself, no waveform modifications and no signal amplifications. My unit is a basic Fetish Fantasy with a display (so not that small one with only few buttons) powered by two AAA batteries. It has a 15min timer, three modes, 10 speed options and 10 intensity options. The 15min off timer is the only automated part. That and, if the connection is not made, it turns itself off after few seconds.
This created a set of requirements. The no modifications part can be done by relay and resistors. No semiconductors as their non-linear characteristic could create distortions. Using a relay also separates the stimulation signal from the control signals.

I used a 2.5 jack connector to split the cables from the unit and a second connector to allow connection of 2.5 jack toys. One of the cables is only a pass through. The second has two resistors put in series. A lower and higher value (that’s why in the schematics one is R1 and R2 in parallel, to hint it’s a lower value than R3). Each of these resistors can be shorted by a relay controlled by a transistor from the Arduino (UNO in this case). Essentially the idea is to lower the intensity by “burning” part of the power on the resistors, but by shorting them you can increase it. This arrangement allows 4 intensity levels:
1) Both relays turned off – all resistors in series – lowest intensity.
2) Relay 1 switches on, Relay 2 is off - this shorts the lower value resistor (R1 and R2).
3) Relay 2 switches on, Relay 1 switches off – again intensity increases as there is only the smaller resistor value “in the way”.
4) Finally, both relays turn on and now its just a pass through for the signal from the power box to the toy.
This way should be safe, it never disconnects the signal (so the power box does not turn off) and the maximum output is only the one you select on the power unit. Here comes the BIG warning:
It’s easier to go into higher levels of intensity when all is connected, but relays are off. But the “jumps” in intensity is determined only by the resistor R1 to R3 values. I won’t post any values for them, because I selected them through trial and error on my self to my liking when I was in full control. DO NOT even think about just slapping some parts there and going right into selfbondage. You could find that you accidentally selected intensity that is too high and finding this in the middle of a selfbondage session when your waiting for a key to drop or something could ruin your experience. Also test the full 4 levels on a lower setting of the power box.
For example, what would happen if you would choose high resistor values? Well you ramp it up, its fine, you use the second level and its still fine so you go for “the two more jumps will be fine too, time to play”. Level 3 might be fine, but the last level (the pass through without any limitation) will be the power of your box. When I started testing this, I firstly selected these higher values of resistance and went to a full power of the box on my cock just to find it “pleasingly strong”. But I know level 6 is pain so common sense arrived and I turned it off and replace the resistors for smaller, so they have smaller impact. I have made this circuit in a development board (you can create circuits without soldering, so changing a part is quick). That’s also the reason I don’t have any photos of it – I did not have time yet to create a printed circuit board design so far. But it works.
Also, I should note that once you get it going, testing for the intensity level can be tricky. If you go up step by step slowly, you can get to some level you think is “tolerable”, but if you would change quickly to that level, it will be much more noticeable. Keep in mind this device can do very little simulation for several minutes and then jump switch to full power. That’s actually point of one of the modes, but more on that later.

Technicalities:
As I said I will not post any part values as kind of a safety part. A skilled electric engineer wont have any problems finding correct parts and calculating it so it works. And I am not talking just about switching and the resistors for the intensity change, but also let’s say the base resistors so that the transistor operates reliably without burning out.
As for how this device operates with my code. I did not want to make it just pure random. I wanted to make it so that the probability of higher levels increases with time. Also I wanted it to have multiple randomly selected modes so that the probabilities are decreased or increased to create less/more intense play. So here are the modes (yes, those names are used in the code using an enumerator):
1) “Mercy” – As hinted by the name, the probabilities of higher levels are significantly lowered. Its very uncommon for this mode to command full intensity.
2) “Normal” – Nothing to say here.
3) “Torture” – Probabilities increased, you have 99% chance that at least once during the 15minutes of play (limited by my power box) you will get the full power level. Keep in mind the change of level can occur only every 30 seconds.
4) “Torture X” – There is very little chance to select this mode, but when it does your in for a ride. After about 8,5 minutes it goes to the lowest level and after two more minutes it jumps to the highest and stays there. The mere presence of this mode adds great anxiety to the play. After 2mins of resting it turns into real painful torture. However, because it stays at the highest from there on without jumps, the nerves will get a chance to adapt to this. It will still be full power of your powerbox, so if you don’t go crazy on the setting before play, you will be ok. I repeat – don’t go crazy on the settings of your power box before play!
I have an excel spreadsheet where I calculated the settings so that it does the probability as I want it (who said I would not use statistics in my life?). The system waits for 2 minutes overriding any selected level to the lowest to provide time to finish the selfbondage.

Code part one: Function setup()
This is where the coding begins. I will refer to the code sections by comments. The full code is in the link above. Also I will skip the basic initializations because if you want to implement this, you have to know these basics:

Code: Select all

// Prepare serial line
Just a note here. I noticed that the Arduino UNO does not run my program if the serial line is active and I don’t open a line from my computer. I use this communication as a debug line and also to see what levels I endured after playing. I am using the Hercules terminal application for this.

Code: Select all

// Load random seed
This is the main reason why this post got delayed. As I was running checks through my code I noticed the “good old” method of selecting a value from one analogRead of a disconnected pin is not good. It’s not random noise and from about 50 attempts it mostly gave 4 distinct values. So not very random. I thought about creating the random seed better and I created this. Basically it takes one analog read, creates pseudorandom number from it (every “random number” here is pseudorandom to be correct). Then it takes another read from a different analog input, adds the generated random number and repeat several times. Why did I not just say add all of the analog inputs? Where I figured there might be some weak signal affecting the noise from the ADC so this approach gives small time differences between measurements. Doing testing, this works much better and “good enough” for now. If anyone has suggestions for improvement, I am asking for your help.

Code: Select all

// Select PlayMode
Based on threshold macros in the head of this file, the appropriate mode is selected.

Code: Select all

// Select coefficients depending on playmode
These are the numbers from the excel spreadsheet. “DataArray” contains basic thresholds. For example if the random number is between DataArray[0] and DataArray[1], it selects the lowest level, between DataArray[3] and DataArray[4] is the highest. “DataVariation” is a rate of change of these values per second. So lets sey if the starting DataArray[2] is 8000 and the DataVariation[2] is -1, then after 100 seconds, the value will be DataArray[2] + Time * DataVariation[2] = 8000 + 100 * (-1) = 7900. Also the DataArray[0] is the lower limit of the generated number. This approach ensures that the more time has passed, the higher probability of higher level selection.

Code: Select all

// Report PlayMode
This gives you report at the start of program. There is also a commented command to tell you which mode was selected, but I found its better to not know and get surprised.

Code: Select all

// Timer interrupt setup
Activation of timer interrupt after everything is initialized.
Code part two: Function MainInterrupt()

Code: Select all

// Toggle LED
This is just so you can verify the code is running.

Code: Select all

// Reduce switching
My power unit has three modes, one of them has a 30second period (20s pulse + 10s of nothing). So I choose this as a baseline. Each 30 seconds the program “decides” what level to choose next. Also this limits the usage of relays, which wear over time (to be honest you would have to play really much to wear them down…).

Code: Select all

// Create low limit for RNG
This is a part of the “progressively higher chance of higher intensity” as the lowes number that can be generated is being moved higher, reducing possibility for the lowest level selection.

Code: Select all

// Keep at least some space for number generation
Just a check so that you create a number within valid limits.

Code: Select all

// Randomly generate number to select mode
Generate number in the interval from LowLimit to DataArray[4].

Code: Select all

// Change mode select depending on PlaySelect after starting time
As I said before, you get 2 minutes where the program stays at the lowest level so you can complete your selfbondage.
// Select mode depending on random number
Select level (here called mode to make it confusing! I did not change the variable name before writing this text, sorry…).

Code: Select all

// Extreme Torture
Yeap, that what the “X” means – eXtreme. Although its only extreme as you set it. Again, think of what you are doing! The only point of this part of code is to implement the “After about 8,5 minutes it goes to the lowest level and after two more minutes it jumps to the highest and stays there.” Feature.

Code: Select all

//Select output depending on mode
This part actually operates the outputs based on all the previous code.

Code: Select all

// Diagnostic print
This sends the time and selected intensity into the console. I like to keep the console running in the background (foreground is reserved for porn! The internet is for porn, why you think the net was born?). Time is conveniently translated into minutes and seconds.

Code: Select all

// Increment time
As the interrupt is set to activate each second, this is effectively a seconds counter.

Final words
I tried to provide as much information about my project as possible. I admit may have overdone the text, but I wanted to put everything here. I will be glad for any suggestions or hints on how to improve.
User avatar
Shannon SteelSlave
Moderator
Posts: 6530
Joined: 03 Feb 2019, 19:49
Location: New England, USA

Re: [Arduino] Automatic random intensity change using relays

Post by Shannon SteelSlave »

Bondage is like a foreign film without subtitles. Only through sharing and practice can we hope to understand.
A Jedi uses bondage for knowledge and defense, never for attack.
I am so smart! I am so smart! S-M-R-T!....I, I mean S-M-A-R-T!
👠👠
User avatar
occorics
***
Posts: 368
Joined: 31 May 2016, 12:46
Location: Germany
Contact:

Re: [Arduino] Automatic random intensity change using relays

Post by occorics »

Alternatively, you could connect a small stepper-motor to the arduino and use it to turn the power-level knob.
There are also digital potentiometers. I think, internally they work very similar to your solution. I'm just not sure, if they can handle the voltage. I have seen them rated for up to 36V, the estim signal might exceed that...
maid marta, Collared property of Domina Shelle Rivers and Lady Helena

https://twitter.com/ShellesPuppy
my blog: https://owned-by-princess-shelle.blogspot.com
my art: https://maid-marta.bdsmlr.com
User avatar
sweh
***
Posts: 235
Joined: 10 Aug 2017, 01:14
Contact:

Re: [Arduino] Automatic random intensity change using relays

Post by sweh »

occorics wrote:Alternatively, you could connect a small stepper-motor to the arduino and use it to turn the power-level knob.
There are also digital potentiometers. I think, internally they work very similar to your solution. I'm just not sure, if they can handle the voltage. I have seen them rated for up to 36V, the estim signal might exceed that...
Apparently a TENS can be 350V 0.7A ( https://www.tmjtherapyandsleepcenter.co ... e-current/ )

Although the specs on https://www.tensunits.com/product/TU3000.html claims 40V 80mA.

So what do I know? :-)
User avatar
Blacky
****
Posts: 601
Joined: 01 Sep 2011, 15:07
Contact:

Re: [Arduino] Automatic random intensity change using relays

Post by Blacky »

occorics wrote:Alternatively, you could connect a small stepper-motor to the arduino and use it to turn the power-level knob...
Or a servo. There are quite a lot of options, it seems.
sweh wrote:Apparently a TENS can be 350V 0.7A ...
I've seen some Estim units with specs reaching close to 1kV with current in the range of just a few µA. Not sure which ones that were, though, nor where I had seen them.
Seems like I share my computer's bane: Insufficient memory. :?
If the doors of perception were cleansed everything would appear to man as it is, infinite. (W. Blake)
lj
Moderator
Posts: 2255
Joined: 14 Oct 2008, 18:22
Location: East Anglia, UK

Re: [Arduino] Automatic random intensity change using relays

Post by lj »

Apparently a TENS can be 350V 0.7A ( https://www.tmjtherapyandsleepcenter.co ... e-current/ )
I find it very scary to think a company could actually publish this complete rubbish.

They state that their TENS is safe, producing a pulse of 350v with an available current of 700mA, and then saying this is fine because a house circuit breaker is set to trip at around 20 amps, this being considered a safe current.

I realise this is an American company, and they have different supply systems to the UK (eg their mains voltage is 110-120vac, 60Hz whilst in the UK it is 230-240vac, 50Hz, but just because a circuit breaker is used to protect the wiring by limiting the current doesn't make this a safe current to pass through a human body. That the TENS pulse width is much less than the 60Hz "pulse width" also doesn't make it safe.

In the UK, we use Residual Current Circuit Breakers. These detect an imbalance of current which can indicate a wiring failure and an incorrect line-to-earth connection such as you grabbing a live wire whilst also connected to "earth" and the usual trip current is 30mA. There is a good reason for the choice of 30mA - in most cases, a current of 30mA passing across the chest cavity will not kill.

The physics and physiology is quite simple. Ohms Law determines the current that can pass, given a known resistance and voltage. You can safely touch a 10,000 volt supply that has a very high internal resistance (have you tried rubbing a balloon against a fleece jacket and getting a spark? - that's around 10,000 volts but the current will be microamps for microseconds) Depending upon skin condition and several other factors, the body represents quite a high resistance but anything more than about 100 volts CAN kill (which is why building sites in the UK require a supply of 110vac, which strikes a balance between delivering power to electrical tools whilst minimising the risk of electrocution)

70mA across the heart is pretty much guaranteed to kill, so if the TENS really can supply 350v at 700 mA, and the user has damp skin, the undertaker will be very happy. I hope this specification is in the same mould as the PC speakers about 2" cube rated at 200 watts...

To answer the question of altering EStim levels you could use relays or MOSFETs, both readily switchable by an Arduino or any microprocessor, to bring in various resistance paths. Digital potentiometers are unsuitable, as they have quite low working voltages and usually very low current capability - they are generally used as volume controls or to set reference levels rather than control current.
be a switch, double the fun :-)
User avatar
AssTechWarrior
**
Posts: 113
Joined: 15 Jan 2015, 18:30

Re: [Arduino] Automatic random intensity change using relays

Post by AssTechWarrior »

sweh wrote:
occorics wrote:Alternatively, you could connect a small stepper-motor to the arduino and use it to turn the power-level knob.
There are also digital potentiometers. I think, internally they work very similar to your solution. I'm just not sure, if they can handle the voltage. I have seen them rated for up to 36V, the estim signal might exceed that...
Apparently a TENS can be 350V 0.7A ( https://www.tmjtherapyandsleepcenter.co ... e-current/ )

Although the specs on https://www.tensunits.com/product/TU3000.html claims 40V 80mA.

So what do I know? :-)
I really do hope the writer meant to say 7 milliamps.

Maintaining a controllable 2 ma (0.001 A) DC current flow through dry skin takes 12 to 40 volts depending on the electrode type, distance and skin moisture. Skin is very non-linear in response.

Research TENS units typically use short pulses of current at between 3 and 400 Hz with closed loop current limited drive of between 1 and 20 ma for stimulation.

Interestingly if you look up electroejaculation and follow that rabbithole to TPPS you find that using 20-60 Hz signal at significantly higher currents than I would have expected can make a man cum.



Lower cost units use a transformer and capacitor discharge to deliver a set amount of energy in each pulse, not really caring about the current flow.

For safety be sure that the tens unit is electrically isolated from any other power source you may come in contact with. Batteries and wifi or opto-isolated connections.
schulz
*
Posts: 32
Joined: 08 Mar 2006, 16:15

Re: [Arduino] Automatic random intensity change using relays

Post by schulz »

I realized a web control for my Tens Device with three servo motors, two controlling the Intensity for the two channels and the third motor is controlling the frequency.
Midders
*
Posts: 1
Joined: 05 Jan 2020, 15:38

Re: [Arduino] Automatic random intensity change using relays

Post by Midders »

Hi,

Does anyone have a working link to this project?
User avatar
Shannon SteelSlave
Moderator
Posts: 6530
Joined: 03 Feb 2019, 19:49
Location: New England, USA

Re: [Arduino] Automatic random intensity change using relays

Post by Shannon SteelSlave »

Midders wrote:Hi,
Welcome to Bound Anna, Midders.
Bondage is like a foreign film without subtitles. Only through sharing and practice can we hope to understand.
A Jedi uses bondage for knowledge and defense, never for attack.
I am so smart! I am so smart! S-M-R-T!....I, I mean S-M-A-R-T!
👠👠
Heinrich
*
Posts: 2
Joined: 16 May 2016, 09:45

Re: [Arduino] Automatic random intensity change using relays

Post by Heinrich »

Can anybody upload a code?
User avatar
Shannon SteelSlave
Moderator
Posts: 6530
Joined: 03 Feb 2019, 19:49
Location: New England, USA

Re: [Arduino] Automatic random intensity change using relays

Post by Shannon SteelSlave »

Good to meet you, Heinrich. This thread seems to be more about a hardware driven device, randomized with different kinds opf triggers.
Bondage is like a foreign film without subtitles. Only through sharing and practice can we hope to understand.
A Jedi uses bondage for knowledge and defense, never for attack.
I am so smart! I am so smart! S-M-R-T!....I, I mean S-M-A-R-T!
👠👠
Heinrich
*
Posts: 2
Joined: 16 May 2016, 09:45

Re: [Arduino] Automatic random intensity change using relays

Post by Heinrich »

Shannon SteelSlave wrote:Good to meet you, Heinrich. This thread seems to be more about a hardware driven device, randomized with different kinds opf triggers.
I understand. And I want also build this hardware. I have small experience with Arduino.
Ok. Can anybody reupload schematic and code? And how many ohms need resistors?
User avatar
Shannon SteelSlave
Moderator
Posts: 6530
Joined: 03 Feb 2019, 19:49
Location: New England, USA

Re: [Arduino] Automatic random intensity change using relays

Post by Shannon SteelSlave »

Send me a PM when you get a chance. Might be able to connect you with like minded users.
Bondage is like a foreign film without subtitles. Only through sharing and practice can we hope to understand.
A Jedi uses bondage for knowledge and defense, never for attack.
I am so smart! I am so smart! S-M-R-T!....I, I mean S-M-A-R-T!
👠👠
rezreal
*
Posts: 15
Joined: 10 Jan 2020, 01:20

Re: [Arduino] Automatic random intensity change using relays

Post by rezreal »

If you want to share code and schematics with others, I'd recommend to put it on github or as a github gist. Open lasts longer.
Post Reply