PROJECT Nº 1: Calibrate the servomotors without mechanical end stops

While you assemble the Arm Robot, calibrate the 4 servomotors included. The correct functioning of the servomotors will depend on the calibration.

DIFFICULTY LEVEL: Beginner.

DURATION OF THE EXERCISE:  60 min.

MATERIALS:

  • 1 Servomotor
  • 1 Build&Code UNO board
  • 1 Sensor shield
  • 1 USB cable

What is a Servomotor?

A servomotor is a direct current motor that instead of spinning constantly, is designed to rotate at a certain angle in response to a control signal, and to maintain that position.

Parts of a servomotor:

Arm Robot-parts-servomotor

There are two types of servomotors: with mechanical end stops and without mechanical end stops. The servomotor with mechanical end stop can make a 180º movement maximum. On the other side, the servomotor without mechanical end stop can make complete rotations. You can check which kind of servomotors does your Arm Robot kit include by inserting one of the three white pieces in the servomotor axis, and rotating them. This way, you will check which is the rotation angle and see if it is a servomotor with or without mechanical end stop.

The control sign is given by the digital pins PWM. To control the servomotor, pulses are sent every 20 ms, meaning 50Hz. The width of the pulse will determine the turning angle, which is known as PWM. This width variates according to each servomotor, but normally goes between 0.5 and 2.5 ms. This gives the servomotor an operating margin, so that it can move between 0º (pulse with 0.5 ms width) and a maximum, that is usually 180º (pulse with 2,5 ms width).

activity-1-arm-robot

Small servomotors, like the ones included in the Arm Robot kit, function with 5V. The control is made through a digital pin PWM of the Build&Code UNO board, in which the width of the pulse will determine the rotating angle for the servomotor.

A servomotor has 3 pins: 1 red (5V), 1 brown or black (Ground) and 1 yellow or white (Control).

PROGRAMMING CODE

Arduino Code

Before starting to assemble the Arm Robot, follow these steps:

  1. Download and install the Arduino IDE program. It is available for Windows, Mac OS and Linux.
  2. Open the Arduino program and copy the following program in it:
    #include <Servo.h>
    Servo motor1,motor2, motor3, motor4;
    int degree1 = 15, degree2 = 15, degree3 = 15, degree4 = 180 ;
    
    void setup() {
      // put your setup code here, to run once:
    Serial.begin (9600);
    motor1.attach (6);
    motor2.attach (9);
    motor3.attach (10);
    motor4.attach (11);
    }
    
    void loop() {
      // put your main code here, to run repeatedly: 
    motor1.write (degree1);
    motor2.write (degree2);
    motor3.write (degree3);
    motor4.write (degree4);
    }
    
  3. Look for the Build&Code UNO board and the sensor shield board, included in the Arm Robot kit.
  4. Place the shield board over the Build&Code UNO board, making sure that the contact pins are aligned. Use the screw holes as a reference.
  5. Connect the Build&Code UNO board to the computer using the USB cable included in the Arm Robot kit.
  6. Charge into the Build&Code UNO board the program you have copied in Arduino, according to the following steps:
    6.1 Configure Arduino IDE to work with the Build&Code 4in1 board: open the “Tools” upper menu, click on “Board” and select the “Arduino/Genuino Uno” option.

    6.2 Configure the work port for the Build&Code board: open the menu “Tools”, click on “Port” and select the port to which the board is connected.

    Note: if you are not sure to which port is the board connected, connect it and disconnect it, and check which is the port that appears and disappears from the menu.
    6.3 Click on the horizontal blue arrow indicated with the red rectangle in the next image:
    6.4 Once it has been uploaded, the message “Done uploading” will display. Now the program is on the Buil&Code board.
  7. Continue assembling the Arm Robot until you get to the “Calibrate the servomotor” step, for each one of the 4 servomotors. Once you are there, connect each servomotor to the corresponding port of the sensor shield board, as indicated in the following chart. Make sure that the sensor shield board is correctly connected to the Build&Code UNO board.Note: Remember that to calibrate the servomotors, you have to connect the computer to the Build&Code UNO board using the USB cable. This way you will give power to the entire system.
    Remember the position of the connectors. You can check it with the following image:
  8. The servomotor connected will place in the position indicated as “Movement stop”.
  9. Place the piece that goes on the servomotor axis according to the instructions manual. Follow the images to place the piece correctly.
    S1 → Place the Arm Robot in a 90º angle position as shown in the image. Its tongs must face right.
    servo-1
    S2 → Insert the piece in the position and 90º angle shown in the picture.
    servo-2S3 → Insert the piece in the position and angle shown in the image.
    servo-3
    S4 → Fix the piece to the rotor axis of the servomotor as shown, using the small screw.
    servo-4
  10. Screw each piece to the axis of the servomotor. Use the smallest screwdriver included in the servomotors plastic bags.
  11. Disconnect the USB cable from the computer, to stop transferring power to the Build&Code UNO board.
  12. Disconnect the servomotor and continue building the Arm Robot.
  13. Repeat steps 7 to 12 with each servomotor. Check which servomotor are you calibrating, to which port should it be connected and which is the position of the piece that has to be adjusted to the axis.

RESULT OF THE EXERCISE

Now that you have assembled your Arm Robot, do the projects 2 to 6 and check that the Arm Robot movements are correct. If it doesn’t move correctly, check all the steps detailed in project 1.

0 0

0