Connecting a servo motor – move your vibrator

The body interaction vibrator development board can be connected with additional sensors and actuators. In this post we show how to connect a servo motor. A servo motor can adjust its shaft to be positioned in varies angles. We use a inexpensive SG92R servo which can be positioned in any position between 0° and 180°.

servo-birdNow we can build eg. a linear actuator which could be useful for sex toys. If you have a 3d printer you can build your linear actuator and fix the servo motor. You can download the design here.

servo-from-top

Connecting servo motor and body interaction vibrator development board

The servo motor has 3 wires: ground (-) (black or brown wire), power (+) (red wire) and control (yellow or orange).

servo connection 2pcb-bottomConnect the (+) wire to the body interaction board. You can use the pad on the bottom side as shown on the image.

servo pcb layoutservo-pcb-from-topThen turn the board around to the top side. Now you can solder the black wire to the “GND” (ground) pad. Then solder the orange or yellow control wire to the leftmost pad “PA1”.

Programming the servo motor

The standard Arduino servo library will not work on the body interaction board. But you can use the TinyServo library. Download the library as *.zip file  here or here and read the forum post.

Go into the Arduino library manager and include the ZIP file. Please restart Arduino.

The following script attaches the servo motor and shows how to control it.

// servo control with the body interaction development board using the TinyServo library
// -- adaption of the demo script by
// tylernt@gmail.com's ATTiny Hardware Timer Assisted Servo Library v1.0 20-Nov-13
// http://forum.arduino.cc/index.php?action=dlattach;topic=198337.0;attach=71790

#include <TinyServo.h>
const byte SERVOS = 1; // number of servos is 1
const byte servoPin[SERVOS] = { 7 }; // servo is connected to PA1 which is pin 7
#define SERVO 0 // our servo is given the name "SERVO"

void setup() {
  setupServos();
}

void loop() {
  delay(1000);
  moveServo(SERVO, 180); // move servo to 180°
  delay(1000);
  moveServo(SERVO, 0); // move servo to 0
  delay(1000);
  for (int i = 0; i <= 180; i++) {
    moveServo(SERVO, i); // move servo from 0° to 180° in 1° steps
    delay(50);
  }
  moveServo(SERVO, 0); // move servo to 0°
  delay(1000);
}

 

 

  One thought on “Connecting a servo motor – move your vibrator

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s