Home > Reference > Widgets > Input-Output > ServoOut

ServoOut

The ServoOut widget controls the position of a servo motor within a 180 degree range of rotation. Servos are typically used to precisely position something mechanical by rotating to a specific angle. Most microcontrollers support absolute positioning (including the Make), where given an angle or rotation setting, the servo will position to that absolute position, no matter where it is before the new position is given.

See below for details on how to connect a servo.

On Screen Features

  • CONNECT: Establishes a connection with the specified microcontroller
  • IN: shows the instance name of the inputSource, and the values received from it
  • SPEED CONTROL: When on, the microcontroller smoothes out the motion of the servo to make it less jerky. The amount of damping (and therefore how fast or slow the servo moves) depends on the servoSpeed parameter value (see below). Only works with Make Controller, not Arduino.
  • ARROW BUTTONS: These allow you to manually control the servo by increasing or decreasing the position

Parameters

  • CONTROLLER: Determines which kind of controller the widget communicates with – NEW: Arduino is now supported in addition to the Make Controller.
  • CONTROLLERIP: Sets the IP address used to communicate with the Make Controller
  • CONTROLLERPORT: Sets the IP Port used to communicate with the Make Controller in combination with the CONTROLLER IP. By default this is 10000.
  • INVISIBLE: If set to “yes”, the widget will disappear when the Flash movie is run
  • INPUT SOURCE: The instance name of the source the widget listens to, e.g AnalogIn or DigitalIn.
  • OUTPUT PORT: The digital port on the microcontroller. For the Make Controller, should be 0-3.
  • SERIAL PORT: For the Arduino, the USB serial port name that the device is connected to. On the Mac, you can leave the default (/dev/cu.usb*) if only one device is hooked up. On the PC, replace this with the COM port used, e.g. COM7. For more detailed info on how to set this parameter, see the common features for all widgets discussion here.
  • SERVO SPEED: Sets the speed of servo motion if the “speed” button is on. The highest number (1023) is the fastest setting, the lowest number (0) is very slow. For the Make Controller, the actual usable numbers range from 0-14. Above that, the speed is the same as full speed with Speed Control off. Does not apply to Arduino.

Connecting Servos

Servos typically have a 3pin connector with the following wires:
  • Ground – Black or Brown
  • Power – Red or Orange (always in the middle)
  • Signal – Yellow, White or Orange
Connect the Ground and Power wires to their respective connections on the microcontroller. Connect the Signal wire to the appropriate port on the microcontroller as specified in the ServoOutput controllerPort parameter. For Arduino, this should be one of the digital output pins, starting at 2 or higher. For the Make, there are specific ports with 3pin connectors just for servos.

Using an external power supply

The Arduino is only able to power very small servos reliably because servos require a lot of power. So a better approach is to use a separate power supply for the servo. To do this, connect the power supply (4.8-6 volts) to the servo Ground and Power, but you must also connect the Arduino Ground to the Ground on the external power supply. Connect the servo Signal as usual.
The below diagram (made with Fritzing) shows how two servos can be connected to the Arduino using a battery pack with four AA batteries as an external power supply.

Last modified October 28th, 2011