This is a quick DIY guide how you could switch devices on/off or switch between E-Stim channels using a Raspberry PI, a Relay board and the Connect plugin directly from your VaM scene using triggers. No soldering needed. As this is just the equivalent of "reconnecting cables", this should work with any E-Stim devices.
We are using mechanical relays, which means the current that runs the Raspberry and relay board is completely isolated from the E-Stim devices. Also the relays are rated for 5A 250V AC or 5A 30V DC, so instead of E-Stim you could also switch pretty much anything with it. Like a "magic wand" vibrator, etc. Downside of using relays is that they are "slow" and make a "click" sound when switching. You probably shouldn't switch them more than once per second or so, especially when switching high currents/voltage.
Parts List
Optional additional parts
This is preparing for future expansions, you don't really need these at this point. See "The future..." section at the bottom.
Assembly
This is straightforward, there is not much to it:
Usage in VaM
So, what's it all for?
Obviously you can use all the things described there in a scene similar to my "The New Remote" scene. But it's pretty much up to you, anything is possible. Doesn't have to be BDSM either
The future...and the holy grail
A potential future plan is to look into into an edging/orgasm-sensor. Apparently just about before someone (male or female) is about to cum, there are a series of involuntary muscle contractions. These can be measured via an inflatable buttplug and a simple air pressure sensor, connected by some hose. You can detect when someone is a few seconds before cumming. There is a small company by the name of MausTec.io who build/sell an open-source edging-device based on that principle, which is supposedly able to keep you edged for an hour or so. So, if I can build something similar and get the signal via Raspberry PI into VaM...which your favorite dominatrix in VaM could then react to...like triggering voice lines or animation, turning off the vibrator just at the "right" moment...or ramping up the punishment....all the things you can do with VaM....then we have the perfect VR edging system...."inescapable" until the timer runs out, thanks to VirtualLock.
Sadly, I have very little time to actually work on this....so it may be a long while, probably months, if ever
Also expect that, even with build plans, you will need a LOT of tinkering and trial&error until you get it working well and calibrated to your body. There is of course also the possibility I'm falling for some internet legend here, but at least I will have fun building this
Support me here:
We are using mechanical relays, which means the current that runs the Raspberry and relay board is completely isolated from the E-Stim devices. Also the relays are rated for 5A 250V AC or 5A 30V DC, so instead of E-Stim you could also switch pretty much anything with it. Like a "magic wand" vibrator, etc. Downside of using relays is that they are "slow" and make a "click" sound when switching. You probably shouldn't switch them more than once per second or so, especially when switching high currents/voltage.
Parts List
- Raspberry PI 3B+
Other (cheaper) Raspberry PI units with 40 pin GPIO header should do as well. You probably want to make sure it at least has Wifi, though.
- Micro-USB power supply, 5V, 2.5A
Note that newer Raspberry PI may need USB-C now.
- Passive cooler set for your Raspberry PI
Technically not needed, but you may get some better performance.
- MicroSDHC card
If you are lazy, they sell them with Raspberry Pi OS pre-installed these days.
- Waveshare RPi Relay Board (B)
There are plenty of alternatives available. I chose this one because, the Raspberry PI can be mounted, it does not necessarily need a case as it already has a backpanel and also the GPIO pin assignments can be customized.
- 4x 20mm spacers, screws, nuts and shims (e.g. M2.5 standard)
- Dupont cable male-female, 20cm, separable
- Several TENS/EMS electrode cables, matching whatever E-Stim devices and electrodes you have.
- screwdriver
- wire stripper
- scissors
- multimeter
- optional, but very helpful
- insulating tape (various colors)
- It helps keeping track of all the cables if you can color them
- generic copper wire, isolated
- You just need a number of some short pieces to connect the relays
Optional additional parts
This is preparing for future expansions, you don't really need these at this point. See "The future..." section at the bottom.
- Adafruit Perma-Proto HAT (the one without EEPROM)
- Stacking Header 2x20
The pins header included with the Proto HAT are too short to connect cables to it. So you need a header with longer pins.
- 4x additional spacers to match the stacking header
Assembly
This is straightforward, there is not much to it:
- Mount the Raspberry PI on the Relay Board
- Use two Dupont cables to supply the relay board with 5V power. As you are using a 10W power supply, you can just draw directly from the Raspberry PI, e.g. pins 4 and 6. The Dupont cables fit just fine into the screw terminal block.
- In my setup I have 4 E-Stim channels I want to connect to a single set of electrodes. For that I'm using 3 pairs of 2 relays each. I'm using the yellow jumpers of the relay board to pair channels 1-2, 3-4 and 5-6. That way each of them switch as one and we only need a single GPIO port for each pair.
- Use more Dupont cables to connect the relay inputs to GPIO ports used by the ConnectGPIO plugin. Here is an overview what is connected to what, yeah, it's bit confusing. (You can also change the GPIO's used in the source code of the ConnectGPIO app, if you prefer. I actually did that, which is why you see different pins being used in the overview photo above.)
Connect plugin 0 1 2 3 4 5 6 7 8 9 GPIO name 17 18 19 20 21 22 23 24 25 26 Actual Pin number 11 12 35 38 40 15 16 18 22 37 Relay board 1 3 5 7 8 - - - - - - Use some copper wire to chain the relays. Each relay has 3 pins, the center pin C can be connected to either A or B, based on how the corresponding GPIO port is set. Basically we use relay pair 1-2 to decide whether we want input from pair 3-4 or 5-6:
- Relay 1 pin A ⇔ Relay 3 pin C
- Relay 1 pin B ⇔ Relay 5 pin C
- Relay 2 pin A ⇔ Relay 4 pin C
- Relay 2 pin B ⇔ Relay 6 pin C
- Cut the ends of the TENS/EMS electrode cables and remove some 4-5mm insulation. For obvious reasons, THINK before you cut Make sure you cut the correct ends. Put the cable ends into the various screw terminal blocks of the relays.
- I recommend to actually measure using a multimeter which is the positive pole and what's ground for each cable and then use some colored insulating tape to mark it. Although relay pairs should switch "as one", so this shouldn't happen, we still want to avoid to connect positive pole and ground from different E-Stim devices, even if it's just for a microsecond.
- Note that some cables may include some kind "rope" besides just copper wire to make them stronger. Since that rope likely isn't conductive, you need to cut a bit of it away so it doesn't get into the screw terminal blocks and give you a bad connection.
- I'm using relays 1, 3 and 5 for the positive pole. Relays 2, 4 and 6 for ground.
- Use a multimeter to check all the connections. Go through all different relay states to make sure everything works as expected. It's just way easier to find issues this way.
Usage in VaM
- Compile/Run the ConnectGPIO application on your Raspberry PI. Follow the instructions in the PDF that comes with the application, find it with the Connect plugin download. Don't forget it needs admin rights to control GPIO ports, so run it with "sudo". Also make sure your device is connected to your local network, e.g. your Wifi.
- Add an Empty atom to your VaM scene. Name doesn't matter, but I renamed it to "ConnectGPIO".
- Add a Connect plugin to your atom. Setup the IP address or hostname of the Raspberry PI in your local network. Then hit the "Connect" button. You should get a log message in VaM telling you it was able to connect.
- Use the "Send" trigger of the plugin to send commands to your Raspberry PI.
- For example:
GPIO;m=111;v=001
- This would set relay pairs 1-2 and 3-4 to their A side, while the 5-6 pair would switch to their B side. If you hooked it up as described above would have chosen the E-Stim channel connected to the 3-4 pair A side.
- The Waveshare Relay Board has helpful LEDs that indicate the status of each relay. LEDs are ON if the matching GPIO if OFF.
- Check the PDF documentation that comes with ConnectGPIO for more command examples.
- For example:
- It can be useful to use a StateMachine LogicBrick and setup a "State" for each E-Stim channel. That way you can refer each channel by some name, which makes it easier than having to think in 0's and 1's. Also helps with testing to confirm everything is working.
So, what's it all for?
Obviously you can use all the things described there in a scene similar to my "The New Remote" scene. But it's pretty much up to you, anything is possible. Doesn't have to be BDSM either
The New Remote - Scenes -
Your mistress has a mysterious new remote she would like to try...and that's just a condom, right? Maybe it isn't...o_O This is a small (but nice) femdom scene specifically made for real-life E-Stim integration and virtual self-bondage via...
hub.virtamate.com
The future...and the holy grail
A potential future plan is to look into into an edging/orgasm-sensor. Apparently just about before someone (male or female) is about to cum, there are a series of involuntary muscle contractions. These can be measured via an inflatable buttplug and a simple air pressure sensor, connected by some hose. You can detect when someone is a few seconds before cumming. There is a small company by the name of MausTec.io who build/sell an open-source edging-device based on that principle, which is supposedly able to keep you edged for an hour or so. So, if I can build something similar and get the signal via Raspberry PI into VaM...which your favorite dominatrix in VaM could then react to...like triggering voice lines or animation, turning off the vibrator just at the "right" moment...or ramping up the punishment....all the things you can do with VaM....then we have the perfect VR edging system...."inescapable" until the timer runs out, thanks to VirtualLock.
Sadly, I have very little time to actually work on this....so it may be a long while, probably months, if ever
Also expect that, even with build plans, you will need a LOT of tinkering and trial&error until you get it working well and calibrated to your body. There is of course also the possibility I'm falling for some internet legend here, but at least I will have fun building this
Support me here: