Behavior Control
Help Index

Servo Controls

Every control that uses servos has a configuration dialog for specifying the servo port, min and max range. In this lesson, we will explain how to configure a servo (even multiple servos) to be moved from a control. We will use a vertical servo slide control in this example, although this procedure applies to any control that uses servos. There are many controls that use servos, including WiiMote, MYO, Camera and dozens more...



What You Will Need

  • A PC with EZ-Builder Installed and connected to your ezb



Step 1

Load EZ-Builder.

*Note: Always ensure you have the latest EZ-Builder. When you load EZ-Builder and have a connection to the internet, it will notify you if there is a newer version.



Step 2

Press the Project tab from the top menu. Now press the Add Control button.



Step 3

The Add Control window will display. In this window, you can browse and select controls to add to your project. Press the SERVO tab to view servo specific controls.



Step 4

We are going to use the Vertical Servo control for this example. There are many kinds of controls that interact with servos, even more than you can see in this page. Nearly every control uses servos, however only the specific servo controls are listed in this page. Even the Camera, WiiMote, MYO and more use servos. Click the Vertical Servo button to add the vertical servo control to your project.



Step 5

The Vertical Servo control will be added to the workspace.



Step 6

As mentioned in the Controls Tutorial, every control has a gear button. This gear button can be pressed to load the configuration menu. Each control has a unique configuration menu.



Step 7

The configuration menu will now be displayed



Step 8

Each configuration control will have many options. Any control that uses Servos will have a similar servo configuration interface. Some controls may have 2 or more servo configuration interfaces (usually for horizontal and vertical servo control). In this control, there is only one servo interface.

Name: This is the name of the control.
Board Index: There can be 5 EZ-B's connected to the EZ-Builder Software. This specifies which EZ-B to send the servo command to.
Port: The EZ-B port of the servo. Pressing this button will display the EZ-B for you to select the respective port.
Min/Max: Min and Max limits in degrees of the servo. The servo can move between 1 and 180 degrees. The value for Min must be less than the value of Max, in all cases, even when Invert is checked.
Invert: If the servo is moving in the incorrect direction, checking this box will reverse/invert the direction of the servo.
Multi Servo: If more than one servo will be moving, this allows you to specify multiple servos.



Step 9

Press the PORT button and the EZ-B port configuration will be displayed. In this dialog, you may select the port and press the Close button.



Step 10

Now that you have selected a port, we can move the servo to specify the MIN and MAX limits. These numbers are in degrees between 1 and 180. Start with the MIN by clicking and holding the mouse button while dragging the cursor UP or DOWN. The MIN value must be less than the MAX value. In this example, set the MIN to a low number and the servo will move in real-time, if connected to EZ-Builder and an EZ-B.



Step 11

Move the MAX by clicking and holding the mouse button while dragging the cursor UP or DOWN. The MIN value must be less than the MAX value. In this example, set the MAX to a low number and the servo will move in real-time, if connected to EZ-Builder and an EZ-B.



Step 12

If you would like this control to move more than one servo at the same time, the Multi Servo button does just that. Press the button to display the Multi Servo dialog.



Step 13

To add multiple servos, press the ADD SERVO button. Each time it is pressed, a new servo entry is added. You can remove the servo by pressing the X on the respective servo. Use the PORT, MIN and MAX to configure the limits. The multiservo option also allows a ratio to be specified. The ratio is based off the primary value for first servo in the list. If the servo degree position for the first servo is specified as 10 and the ratio is 2, the respective servo will move to degree position 20.



Step 14

Close the configuration dialog for the servo control and return to workspace. Now that the servo has been configured, you may move it between the MIN and MAX limits that were specified. Click in the servo position and the cursor will change while holding the mouse button. Slide the mouse up and down (for vertical control) to move the servo between the specified limits.



*Note: Remember that even though many controls may move servos, the configuration of those servos are only valid for that control. This means if you configure a camera control to move servos to specific min/max ranges, those ranges are only applicable to the camera control. If you wish a servo, or group of servos to move together from script, use the Relative Servo control.

Set Servo Limits

The servo control values in the previous example are for that servo control only. Every control have its own servo values (i.e. min and max). This means the Camera control has different servo values than the Joystick control. The values specified in a control's configuration are specific to that control. If you wish to specify global servo position limits across the entire application, you can do so with EZ-Script commands in your Init.

The command to use in an INIT script to specify servo positions globally across the entire application are...

SetServoMin (servoPort, position)
Set the minimum limit that this servo can ever move to
Servo position is between 1 and 180
Example: SetServoMin(D14, 40)

SetServoMax (servoPort, position)
Set the maximum limit that this servo can ever move to
Servo position is between 1 and 180
Example: SetServoMax(D14, 100)

Here's an example from the JD project that makes the left gripper not move further in either direction globally across the software.

# Left Gripper
SetServoMin(d6, 30)
SetServoMax(d6, 90)


January 2 — Updated January 2
What i am trying to do is connect the VR Robot control plug in to google cardboard vr goggles and ALAN. The plugin uses the internal gyro of the phone to control the servos. It uses X and Y servos like most controls. I have my robot set up with two servos that work together to not only raise up the head up and down but also side to side tilt. For the VR demonstration I don't mind losing the tilt and just have both motors as the Y servo for up and down of the head they just both need to follow the same y signal or copy each others 1:1 motions.(one inverted)

Plug in for reference:https://synthiam.com/Software/Manual/Virtual-Reality-Robot-15982



User-inserted image

DJ Sures
Synthiam
January 2 — Updated January 2
Read this tutorial manual that I moved your question to. 

Every single servo control in the entire EZ-Builder software allows that. Read that manual page and you’ll see how easy it is.
January 2
I've never understood the ratio and how it works. Even after reading this and watching the video on the robot arm. Do I put a"0" in there to copy the exact motion of the master servo? What number gives me an exact 1:1 motion for two servos.

DJ Sures
Synthiam
January 2 — Updated January 2
Put a 1 in there. That would be 1:1. Because an editable ratio of both sides doesn’t make sense. So think of the master as being a 1 and the slave being X

It’s a good idea to try things because you can learn how it works. Sometimes it’s easier to understand how something works that reading. There’s only so many ways something can be written
January 2
Yeah I'm fresh outta EZBs and working on Alan and Alena LIVE almost cost me a head. I managed to find a IOTiny in a drawer and tested with it....got it now ! Thanks for helping on a very rudimentary question. Also very good to know the default is 1:1!