WOLFRAM SYSTEM MODELER

MoveServo

Using servos

Diagram

Wolfram Language

In[1]:=
SystemModel["ModelPlug.Examples.MoveServo"]
Out[1]:=

Information

Hardware Components Used

  • 1 Arduino
  • 1 5 V servo
  • 1 external 5 V power source

Description

This example shows how to control a servo by using the Servo component. You can find the diagram in the following figure.

For this example, it is recommended to use an external power source to provide voltage for the servo. This is because the power from the Arduino may not be sufficient. If you are unsure how to connect your servo, take a look at the reference in the Arduino Playground.

Servos are controlled with a signal in the range of 0 to 1, where 0 corresponds to 0 degrees of rotation and 1 to 180 degrees. This example makes the servo bounce from 0 to 180 degrees until it gets stable around 90 degrees.

Components (3)

arduino

Type: Arduino

Description: Component with default configuration for Arduino boards

servo

Type: Servo

Description: Controls a servo motor attached to the specified pin

expSine

Type: ExpSine

Description: Generate exponentially damped sine signal