Tags: Micro, Servo, Motor, TowerPro, SG90, 9G

Micro Servo Motor TowerPro SG90 9G

  • 15.00 AED

    19.00 AED

    • Ex Tax:15.00 AED
    • Brands techmaze
    • Product Code: Digital
    • Availability: In Stock
    A Servo is a small device that has an output shaft. This shaft can be positioned to specific angular positions by sending the servo a coded signal. That's why we need the Arduino, in oder to send that signal to the servo. Servos in general require a lot of current to operate since they have a motor ..

      A Servo is a small device that has an output shaft. This shaft can be positioned to specific angular positions by sending the servo a coded signal. That's why we need the Arduino, in oder to send that signal to the servo. Servos in general require a lot of current to operate since they have a motor inside. If you only need to control one small servo like this one you can connect it directly to Arduino. If you need to control two or more servos you need an external power supply or battery pack

      • Dark gray: GND
      • Red: VCC 4.8 - 7.2V
      • Orange line: pulse input
      • All nylon gear
      • Connector wire length 150mm
      • Can be used with Arduino, Raspberry Pi, AVR, ARM, PIC microcontrollers
      • Wire Configuration

        Wire Number

        Wire Colour

        Description

        1

        Brown

        Ground wire connected to the ground of system

        2

        Red

        Powers the motor typically +5V is used

        3

        Orange

        PWM signal is given in through this wire to drive the motor

         

        TowerPro SG-90 Features

        • Operating Voltage is +5V typically
        • Torque: 2.5kg/cm
        • Operating speed is 0.1s/60°
        • Gear Type: Plastic
        • Rotation : 0°-180°
        • Weight of motor : 9gm
        • Package includes gear horns and screws

         

        A servo is very useful in many projects!

        In this tutorial we are going to learn how to use the popular SG90 micro servo with Arduino in an easy way.

        Today we are going to use only one servo so we are going to connect it directly to an Arduino Uno. We are using an SG90 micro servo today which is a very popular one and very cheap.

        Servo’s are very important in electronics, they are motors with a geared output shaft which can be controlled to turn one(1) angle at a time. Asides the power supply pins(VCC and GND) to the servo motors, they require a signal pin which is used to tell the servo what angle to turn to or what degree of rotation it should make. Servo motors usually have very high torque and are used in robotics and several other applications majorly because of the ease with which their rotation can be controlled.

        Servo’s have high current requirement so when using more than one servo motor with the Arduino, it is important to connect their power connections to an external power supply as the Arduino may not be able to source the current needed by the servo. Since we will be using just one servo in this tutorial its fine to power it with an Arduino.


        Schematics

        Connect the servo to the Arduino as shown in the Schematics below.

        Schematics

        The connection with Arduino is extremely easy has the servo has just three pins/leads and the connection to the Arduino is also described below.

        Servo Wires ▶ Arduino
        
        Red(VCC) ▶ 5v
        
        Black/Brown(GND) ▶ GND
        
        Yellow/Orange(Signal) ▶ D8

        It is important to note that the signal pin for the servo motor needs to be connected to a PWM pin on the Arduino as the servo angles are controlled by sending PWM signals to the servo motor through the signal wire.

        Code

        The code for this project, just like the schematics is fairly easy. It is heavily reliant on the servo.h library which comes pre-installed with the Arduino IDE.  The goal implemented by the code is simple, turn the servo motors in a different direction using different angles to demonstrate its capabilities.

        To do an explanation of the code, as usual, The first thing we do is include the libraries we will be using i.e the servo.h library.

        #include <Servo.h>
        

        Next, we create an object of the servo library

        Servo servo;
        

        Next, we move proceed to the void setup function where we attach the servo object to a digital pin and set the servo angle to 0. This is known as centering the servo.

        void setup() {
          servo.attach(8);
          servo.write(angle);
        }
        

        Next, is the loop function. To turn make the servo rotate to a particular degree, we use the servo.write() function to write the degree of rotation we desire to the servo. We used the function to turn the servo from one to the other and back.

        void loop() 
        { 
         // scan from 0 to 180 degrees
          for(angle = 10; angle < 180; angle++)  
          {                                  
            servo.write(angle);               
            delay(15);                   
          } 
          // now scan back from 180 to 0 degrees
          for(angle = 180; angle > 10; angle--)    
          {                                
            servo.write(angle);           
            delay(15);       
          } 
        }
        

        The full code for the project can be downloaded through the download link below.

        ——————–
        CODE OF THE PROJECT
        ——————–

         

         




      Tags: servo; motor; robot