Introduction

In this tutorial we're going to learn about servomotors.

What is servomotors

Servomotors are small motor devices that can positioned to specific angular positions, based on some coded signal (PWM) on it's input line. As long as the coded signal remains the servo will maintain the angular position of it's shaft. The servos will be used in our hexapod robot to position all of it's 6 legs.

Inside the servomotor has a control circuit and a potentiometer that is used to monitor the actual angle of the servo motor. A digital cicruit interprets the control signal and control the actual angle.

 

Bellow is the video of a hexapod with 18 servomotors (3 on each leg)

How to control the servomotor

The servomotor that we're going to use (HS422 and HS475) is controlled by a pwm signal in the control input(yellow).

The servo expect a pulse every 20 milliseconds(50 Hz). The lenght of the pulse will determine how far the motor turns. A 1.5 millisecond pulse, will turn the motor to the 90 degree angle (Neutral position). If the pulse is shorter than 1.5 ms the motor shaft will be closer to 0 degree. If is longer the shaft will be closer to 180 degree.

In practise we're going to observe that those values may vary a little, for example in the HS-475 HB datasheet the pulse duration range from 0.9ms to 2.1ms with 1.5 as the neutral position, but in practise it range from 0.5ms to 2.5m.

Practical tests

Now we're going to turn on our servomotor and send some PWM pulses in order to control it's position. For that we use a waveform generator and a osciloscope connected to our servo.

Mechanics specifications

The HS-422 servomotor has been modelled in solidworks for more information please reffer to mechanics section

 

Modeling servo dynamics in Simulink

After we got our servo modelled to SolidWorks we can model it's dynamics in Simulink (SimMechanics) with SimMechanics Link utility, also to link the electrical signal to our joint actuators (see in SimMechanics tutorial) we're going to use SimDriveline.

We're going to link the mechanical part in Simulink using SimMechanics, and the control/electronic part with SimElectronics, please refer to the Matlab tutorials to learn more about them. Bellow we have an video to ilustrate the idea.

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

First lest open our mechanicla model in SolidWorks and save it as SimMechanics link XML file, and after that, in Matlab use the mech_import command to import the created file to SimMechanics model.

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

Now that the mechanical part modeled, let's apply a force at the rotational joint and see how it moves, after checking that, just create a submodel that will be used with the electronic part.

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

Open source servo

Openservo