A servo motor, or simply, a servo, is a rotary actuator that rotates or push parts of a machine to which it is connected, with precision. Unlike DC motors, these motors generally rotate to a particular angle, and then stop.
If pull apart a servo motor, you find the following inside it:
- A DC Motor
- A Potentiometer
- A gear train, i.e. a series of gears that are connected such that their teeth are engaged/interconnected. (A gear can be visualised as wheel with teeth, not the regular teeth though; sometimes more and sometimes less than 32!)
- A control circuit: This circuit is the actual brain behind the precise working of the servo. It controls how much the servo should move or rotate depending upon the input it receives.
evive has two dedicated servo motor outputs pins, as shown below:
Interfacing Servo Motor with PictoBlox
For interfacing the servo motor with PictoBlox, you must first connect the motor to one of evive’s servo channels as shown in the figure below:
You can control the servo using evive in two ways:
- By using evive’s inbuilt menu
- By writing a script in PictoBlox
You can control a servo motor in PictoBlox with the help of the following block:
- set servo on () to () angle: This block allows you to set/change the angle of the specified servo motor to a specified value.
You can find this block in the Actuators palette.
Activity: Controlling Motor Direction Using a Potentiometer
Follow the steps below to write the script:
- Connect evive to your computer and open PictoBlox; if already open and working on a project, save that project. Then, click on New.
- Go to the toolbar and click on the Board menu. Then select evive as your board.
- Next, click on the Connect menu and from the fly-out menu, select the Port to which evive is connected e.g. COMXX or ttyXX.Once you select the port, the icon beside the Connect tab will become connected.
- Go to the Events palette and drag and drop the when flag clicked block.
- Next, go to the Control palette and drag and attach the forever block below the when flag clicked block.
- Then, drag and drop the set servo on () to () angle block from the Actuators palette inside the forever block; channel 1 is set as the default servo channel.
- Drag and drop the potentiometer () reading block inside the set servo on () to () angle block from the evive palette; potentiometer 1 is set as the default potentiometer.
Below is the complete script:
Click on the green flag to run the script.
Click on the red octagon, next to the green flag to stop the script.
It this tutorial, you learned how to interface a servo motor with PictoBlox.
Hope you had fun! 🙂