Buttplug & Arduino devices


#1

Hi all, first post.

I have a question. I would like to connect an Arduino to the Buttplug server as a controllable device through a USB cable. Is that possible? If so has anybody got a head start on me and can offer any tips?

Btw I’m a mechanical engineer so I can do hardware, beyond Arduino my knowledge of coding is very limited.

Thanks!


#2

It will be! I’m just about to release the start of making this a possibility.

I’ll try to tl;dr this explanation.

In Buttplug so far, we haven’t had a way for users to define their own devices without changing the library. I’m making it so that users will just be able to change some text config files to add their own devices. On top of that, we’d need to know how to talk to your arduino. We’re considering a generic protocol to just send commands like vibrate, move back and forth, etc that people could implement on their arduino (we’ll provide examples) so things would “just work” in terms of talking to Buttplug software.

Like I said, first steps of this are about to ship, it may take us a bit to get to that final point.


#3

Hey thanks for taking the time to reply.

So in my ideal world anyone with an Arduino device would simply need to plug in to a USB port on the computer, then in Buttplug define a custom device by picking a serial comm port and a baud rate. That’s really it. Simple serial communication over USB would easily be enough for anything I’d want to do.

How to talk to the Arduino? I like your idea of a generic protocol. Just define one, it doesn’t need to be too complicated. You list a set of generic device messages in your excellent documentation. I would be in toy hacker heaven if I had that data coming down a serial connection.

I love using Arduinos because they are simple to use but are capable of controlling any kinds of motors, servos, sensors you care to name. Mostly it becomes a hardware problem, which is a domain I feel much more comfortable in. I’m amazed there aren’t more people dabbling in this area. Maybe a generic protocol will encourage more people to do it.


#4

In fact I have some thoughts about how I would go about implementing your generic device messages over serial. Happy to share them if you’re interested.


#5

@qdot
maybe look at the MQTT protocol as an arduino implementation.
the ESP8266 is a very popular “arduino” with wifi capabilities, and the community often uses the MQTT protocol for sensor and actuator communication.
a downside might be that MQTT is a Network protocol that requires an MQTT broker / server. one such MQTT broker is Mosquitto, and he supports usage via command line interface, which might make implementation super easy.

since it a network protocol, normal arduinos without ethernet / wifi wouldn’t work.

some personal anecdotes:
there’s a lady, called scanlime, that wrote an arduino library to control Lelo remote controlled toys (usually controlled with a Lelo insignia v3 remote). (a transceiver is required).

i built an arduino Gateway that uses this library and communicates through MQTT. making it possible to control my Lelo Hugo over the internet.

either way, support for arduino would essentially add support to all (afaik) Lelo remote controlled toys!
hth, ned


#6

wasn’t sure if it lets me post links. here is scanlime’s library:


#7

Yup, I’m aware of MQTT, though I’m not quite sure it was built for the kind of things we do. It seems like it’s more discrete actions (turn light on/off, turn AC to temperature, etc) than sending a stream of actions like we’ll need to do for relaying patterns. That said, there’s a few people over on the Deviant Designs discord that’ve used it for BDSM related work. I haven’t really had time to read up on it too much yet, but do plan on doing so soon.

Right now we’re considering a few different routes for arduino, including building some sort of standardized protocol for at least shipping our generic messages over. That way people can just adapt whatever they’re building to what we support and have it “just work” without our intervention.

And scanlime and I have known each other for years, I’m aware of her Lelo project. Hadn’t considered trying to adapt it for Buttplug as an example, I might give that a shot, thanks! :slight_smile:


#8

ok sounds good.
thinking more about it, supporting arduino over usb might make more sense than adding an extra layer of stuff.

yes that’s a valid concern. MQTT can easily transmit things like how bright certain lamps / colors should be. if i had to guess it’s probably maxing out at around 4 messages per second. longer distances would be worse.

and that’s so cool that you know her. i was thrilled finding her project and it inspired me a lot.
and now stumbling upon Buttplug i hope to come up with new fun ideas.
take care and thanks! ned


#9

Thanks for the link Ned, I will check it out

Yeah I think USB based serial has to be the starting point because it keeps things very simple. In the last few days I have managed to get an Arduino moving servos in time to a script being played on a computer via a serial protocol I have devised. I encoded a short video clip in 3-axes using a CSV file and was able to play it back with the video and servos (sort of) synchronised.

The protocol is inspired by G-code and based on buttplug’s generic device commands. It takes the form of ASCII character strings.

eg: L280S500

Linear move, device 2, position 80 (0.8), ramp at speed 500 (0.5/sec).

The commands can be shortened to mean instant reaction for live control, ie “L080” or “L80” (set device 0 to 0.8). Can substitute V or R for L to control vibration or rotation devices, and I instead of S to specify a ramp time interval rather than a ramp rate.

My Arduino code reads the serial commands and translates them into the appropriate servo responses. On the computer end I am using a basic python script to send the commands (and I mean extremely basic - Sunday was the first time I ever used python).

Will try to post pictures later, and happy to share my code.