The purpose of servo motor calibration is to align the angle of your servo motor properly.
Connecting Servo to Quarky
The Servo motor will be connected to the Quarky Servo Connector. There are two servo ports on Quarky. Always make sure that brown wire is on your left side.
Angle Calibration
To do the calibration we have to be familiar with the servo angles.
According to the servo motor’s configuration, 90° means facing forward. Therefore, 45° is on the right, and 135° on the left, which is nothing but 45° on the left, from the forward position.
Servo Control Blocks
PictoBlox has one block that can be used to calibrate a servo motor:
Set servo on () to () angle: This block is used to change the angle of the servo motor to any particular angle between 0 to 180.
We have assembled the Obstacle Avoidance Robot. We will understand how to calibrate it using this block. Follow the steps given below,
First, detach the Ultrasonic Sensor Assembly from the servo head.
Go to the event block and drag and drop the when green flag clicked into the scripting area.
Next, place the set servo on () to () angle from the robot palette below the when green flag clicked block.
Run the script. The servo head should get aligned properly.
Finally, put the Ultrasonic Assembly on the servo shaft.
Your calibration is done.
Activity: Servo Movement
Continuing with the next activity, here we’ll rotate the servo motor’s shaft at different angles, such as 0, 90, and 180 degrees.
Lets Code!
Open PictoBlox and create a New File.
Select the coding environment as Block Coding.
Go to the event palette and add the when green flag clicked block into the scripting area.
Place the forever block below it.
Add set servo on () to () angle block from robot palette within the forever block, and change the angle 90.
Add a delay of 1 second by placing the wait () seconds block inside the forever block.
Duplicate the last two blocks and now set the angle to 0 in the setservo on() to () angle block.
Repeat this step and change the angle to 90, and 180 respectively for the next servo blocks.
Save the file with the name Activity- Servo Moment.
Finally, our script is ready!
Click on the green flag to run it.
Testing
When we click on the green flag, the servo’s shaft will continue to rotate. Try to set it on different angles and check.
Assignment
Before you move on to the next lesson, a small assignment awaits you!
You must upload the PictoBlox program you created in this activity to the website. Submitting the assignment is a must in order to receive the certificate after completing the course.
Follow the steps below to upload your assignment:
Click on Browse.
Search and Select your saved Project file(.sb3) and Click Open.
Click on Upload to submit the assignment.
The file type allowed is the SB3 file generated from the PictoBlox program. The maximum file size allowed is 5 MB.