Как подключить моторчик mg996r
Перейти к содержимому

Как подключить моторчик mg996r

  • автор:

Mg996r: A Brief Introduction into Its Working and Applications

A motor is an electronic device capable of converting electrical to mechanical energy. There are several kinds of motors in the market. These include the DC motor, stepper motor, brushless motor, and servo motor. This article will discuss the servo motor, particularly the MG996R servo motor. A servo motor is a rotary actuator that produces torque and velocity depending on current.

However, our focus will be on choosing the right motor and how to use it in your projects.

Wire Configuration

The MG996R is a three-wired metal gear rotor. Each wire on the device has a specific purpose. The table below shows the description of each wire.

Wire no. Wire color Description
1 Brown The brown wire is the ground wire in this system. It works by earthing the system.
2 Red This wire supplies the motor with power. It usually provides the ability of between 4.8v to 7.2v
3 Orange This wire transmits the PWM signal that is essential in propelling the motor.

(a servo motor vector illustration image)

What is the MG996R Servo Motor?

An MG996R is a metal gear digital servo motor. The servo has a high-stall torque of 11kg/cm contained in just a small package. You usually find this motor in many appliances because it is an improved form of the MG995. The servo motor is more accurate and efficient because of the upgraded features. These features include a new design and shock-proofing system for the PCB and IC.

The gear train and motor drives for this device have been enhanced to better the centering and the dead bandwidth. This component comes as a package with an ‘S’ type 3 pin female header connector and a 30cm wire. The female header connector can link to most receivers.

A servo motor is an essential tool to use in your projects. It can spin to approximately 120⁰ that is, and it can go 60⁰ in each direction. Moreover, to control the servos, you need to use a library, hardware, or servo code.

Lastly, it is really easy to set up this device since it has a selection of arms and hardware.

(a PCB with electronic components.)

MG996R Servo Motor Features

  • First, the motor comes in a package consisting of screws and gear horns.
  • Secondly, servo MG996R is light in weight since it only weighs 55g.
  • Thirdly, the device does a rotation of 0⁰ up to 180⁰.
  • Also, the motor comes in a metal gear type.
  • The servo also has a double ball bearing construction that is shockproof and reliable.
  • Additionally, the operating speed of the motor is 0.17 s/60⁰
  • Also, this device is quite a small one since its dimensions are 40.7*19.7*42.9mm.
  • Then, this device has an ordinary operating voltage of +5v.
  • This motor has a 9.4kg/cm small torque which is normal at 4.8v. However, this stall torque can reach its maximum of 11kg/cm at 6V.
  • Similarly, this device operates under a stall current of 2.5A. However, during a running current, the device uses 500mA- 900mA of motor current.
  • Lastly, the motor works under a temperature range of 0⁰ to 55⁰.

(a small electric motor.)

Alternative Servo Motor

Just like every electronic device, the servo motor has alternatives. The devices you can use in place of the MG996R include VTS-08A, MG996R high torque gear, and MG90S metal gear.

How to Choose and Use a Servo Motor?

Guide to making the right servo choice.

From the standard servo to the MG996R servo, each motor has its specificity and applications. For the proper functioning of the servo motor, the higher the power supply, the higher the torque value. However, the standard voltage is usually at 5v.

Moreover, all most servo motors are set up to 180⁰. This setting is because of the arrangement of the gears in the system. The process is important because you need to ensure that your project can support the half-duty cycle. However, if this is not the case, you are advised to get a 0⁰ to 360⁰ motor. Consequently, you can adjust the motor to give a full cycle.

Nonetheless, you should know that gears in the motor will eventually tear and wear out. In a case where your motor will frequently be running, normal plastic gears will be preferred to avoid wearing out.

Also, there are many choices to make regarding the torque value. For instance, the 2.5kg/cm torque value in MG996R signifies that your motor carries a weight of 2.5kg. It is possible when the motor is hanging from a 1cm distance.

Connecting and using the servo motor

After selecting the right motor servo, you should see 3 wires coming from the motor. The motor will rotate if you power it with +5 volts. The voltage goes to the red and brown cables. These two cables will then transmit the PWM signals to the orange wire.

A microcontroller like an Arduino or a microprocessor like a Raspberry Pi should help you generate the PWM signal. Consequently, you need these items to make the motor work.

In addition, with a 50Hz PWM frequency signal, the PWM time should be 20ms. With this period, the on-time should vary between 1ms to 2ms. Then, your motor reading will be at 0⁰ when the on-time period is at 1ms. However, the motor will rotate to 180⁰ when the on-time period reaches 2ms. Controlling the direction of the motor from 0⁰ to 180⁰ happens when the on-time varies from 1ms reading to 2ms.

(an Arduino-like microcontroller)

Applications

  • First, the devices carry less weight; therefore, you can use them in multi DOF robots like humanoid robots.
  • Secondly, you use this servo object in robots where you do not require feedback for position control.
  • Also, you can use this device in the steering system of an RC digital servo.
  • Lastly, robotic engineers can use this servo as actuators in many of their projects.

Summary

In conclusion, Mg996r are suitable motor devices and can be helpful in a wide array of applications. They’re very easy to use and understand.

We hope you learned how the mg996r servo motor works as well as its uses in your daily life! If you have any further questions, please let us know. We would love to help.

Our professional engineering support saves our customers a lot of trouble and loss. >>>>>> After you place the order, our engineer will conduct technical reviews to make sure the parts can be mounted well/correctly on the boards. We will check if the component packages match well with the Gerber footprints, if the part numbers you provided match well with the descriptions, and if the polarity is clearly marked. >>>>> When your design is ready, please send your Gerber and BOM so we can quote and start!

ESP32 — MG996R

In this tutorial, we are going to learn how to use the MG996R high-torque servo motor with ESP32.

Hardware Used In This Tutorial

1 × ESP-WROOM-32 Dev Module
1 × USB Cable Type-C
1 × MG996R Servo Motor
1 × Jumper Wires
1 × (Recommended) ESP32 Screw Terminal Adapter

Or you can buy the following sensor kits:

Disclosure: some of these links are affiliate links. We may earn a commission on your purchase at no extra cost to you. We appreciate it.

Introduction to Servo Motor

The MG996R servo motor is a high-torque servo motor capable of lifting up to 15kg in weight. The motor can rotate its handle from 0° to 180°, providing precise control of angular position. For basic information about servo motors, please refer to the ESP32 — Servo Motor tutorial.

Pinout

The MG996R servo motor used in this example includes three pins:

VCC pin: (typically red) needs to be connected to VCC (4.8V – 7.2V)
GND pin: (typically black or brown) needs to be connected to GND (0V)
Signal pin: (typically yellow or orange) receives the PWM control signal from an ESP32’s pin.

MG996R Servo Motor Pinout

Wiring Diagram

Since the MG996R is a high-torque servo motor, it draws a lot of power. We should not power this motor via the 5v pin of ESP32. Instead, we need to use the external power supply for the MG996R servo motor.

ESP32 MG996R Servo Motor Wiring Diagram

This image is created using Fritzing. Click to enlarge image

If you’re unfamiliar with how to supply power to the ESP32 and other components, you can find guidance in the following tutorial: How to Power ESP32.

ESP32 Code

Quick Instructions

If this is the first time you use ESP32, see how to setup environment for ESP32 on Arduino IDE.
Do the wiring as above image.
Connect the ESP32 board to your PC via a micro USB cable
Open Arduino IDE on your PC.
Select the right ESP32 board (e.g. ESP32 Dev Module ) and COM port.
Click to the Libraries icon on the left bar of the Arduino IDE.

Type ServoESP32 on the search box, then look for the servo library by Jaroslav Paral. Please be aware that both version 1.1.1 and 1.1.0 are affected by bugs. Kindly choose a different version.

Click Install button to install servo motor library for ESP32.

ESP32 servo motor library

Connect ESP32 to PC via USB cable
Open Arduino IDE, select the right board and port
Copy the above code and open with Arduino IDE
Click Upload button on Arduino IDE to upload code to ESP32

Arduino IDE - How to Upload Code

See the result: Servo motor rotates slowly from 0 to 180° and then back rotates slowly from 180 back to 0°

Code Explanation

Read the line-by-line explanation in comment lines of code!

How to Control Speed of Servo Motor

By using map() and millis() functions, we can control the speed of servo motor smoothly without blocking other code

/* * This ESP32 code is created by esp32io.com * * This ESP32 code is released in the public domain * * For more detail (instruction and wiring diagram), visit https://esp32io.com/tutorials/esp32-mg996r */ # include < Servo .h>Servo myServo; unsigned long MOVING_TIME = 3000; // moving time is 3 seconds unsigned long moveStartTime; int startAngle = 30; // 30° int stopAngle = 90; // 90° void setup () < myServo. attach (9); moveStartTime = millis (); // start moving // TODO: other code >void loop () < unsigned long progress = millis () - moveStartTime; if (progress <= MOVING_TIME) < long angle = map (progress, 0, MOVING_TIME, startAngle, stopAngle); myServo. write (angle); >// TODO: other code >

Video Tutorial

Making video is a time-consuming work. If the video tutorial is necessary for your learning, please let us know by subscribing to our YouTube channel , If the demand for video is high, we will make the video tutorial.

Arduino Tutorial: MG 996R Servo Motor

A servo motor allows to precisely control a shaft to a specific rotary position. The MG 996R is one of the most popular servo motors within the maker community. This tutorial shows how to wire the MG 996R servo to an Arduino. Moreover, this tutorials includes a simple code example that let’s the motor rotate to various rotary positions.

Related products

MG 996R Servo Motor

The MG 996R is a popular servo motor within the Arduino Community. In contrast to the likewise popular SG90 servo, the MG 996R is able to rotate much higher weights. For example, you can see the MG 996R very frequently in 3D-printed robotic arm applications.

Technical specification

Name Value
Dimensions ca. 40.7 x 19.7 x 42.9 mm
Weight ca. 55g
Operating voltage 4.8 V – 6.6 V
Operating current ca. 600 – 1500mA
Stall torque 9.4 kg/cm (4.8V); 11 kg/cm (6V)
Operating speed 0.19 s/60º (4.8 V), 0.15 s/60º (6 V)
Angle 0-180°

Technical specification of MG 996R. Caution: There are different manufacturers, values might vary.

Example application

The example application is kept very simple. The motor rotates to four different positions with a delay of one second in between. If the motor has completed the last position, the sequence starts again.

Wiring

The motor has three wires: Brown (GND), Red (+5V) and Orange (PWM signal). Unfortunately, the motor can’t be directly powered from the Arduino. The motor will likely draw to much current from the Arduino. As a consequence, the Arduino might get damaged. In order to overcome this problem, I wired the motor to an external power supply.

In particular, I took a 5V USB power supply (power bank) to power the motor. For the wiring, I made use of a USB terminal adapter. The “-” signal from the USB terminal adapter is wired to the brown input of the servo motor. Accordingly, the “+” signal is wired to the servo’s red input. In order to guarantee the same signal level, the terminal adapter’s “-” signal is wired to one of the Arduino’s GND pins. Luckily, it is easily possible to connect two male jumper wires to a single terminal block of the adapter.

Next, Arduino’s pin #3 is wired to the orange input of the servo motor.

Example source code

I made use of the servo library to control the MG 996R motor. In the setup function, pin number 3 is made known to the servo object.

In the loop function, the motor is rotated to four different positions by the write method.

/* MIT License Copyright 2021 Michael Schoeffler (https://www.mschoeffler.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* * Example source code of an Arduino tutorial on how to control an MG 996R servo motor. */ #include Servo servo; // servo object representing the MG 996R servo void setup() < servo.attach(3); // servo is wired to Arduino on digital pin 3 >void loop() < servo.write(0); // move MG996R's shaft to angle 0° delay(1000); // wait for one second servo.write(45); // move MG996R's shaft to angle 45° delay(1000); // wait for one second servo.write(90); // move MG996R's shaft to angle 90° delay(1000); // wait for one second servo.write(135); // move MG996R's shaft to angle 135° delay(1000); // wait for one second servo.write(180); // move MG996R's shaft to angle 180° delay(1000); // wait for one second >

If everything has been correctly executed, the motor should start moving.

Arduino — MG996R

In this tutorial, we are going to learn how to use the MG996R high-torque servo motor with Arduino.

Hardware Required

1 × Arduino UNO or Genuino UNO
1 × USB 2.0 cable type A/B
1 × MG996R Servo Motor
1 × Jumper Wires
1 × (Optional) 9V Power Adapter for Arduino
1 × (Recommended) Screw Terminal Block Shield for Arduino Uno
1 × (Optional) Transparent Acrylic Enclosure For Arduino Uno

Or you can buy the following sensor kits:

Please note: These are Amazon affiliate links. If you buy the components through these links, We will get a commission at no extra cost to you. We appreciate it.

About Servo Motor

The MG996R servo motor is a high-torque servo motor capable of lifting up to 15kg in weight. The motor can rotate its handle from 0° to 180°, providing precise control of angular position. For basic information about servo motors, please refer to the Arduino — Servo Motor tutorial.

Pinout

The MG996R servo motor used in this example includes three pins:

VCC pin: (typically red) needs to be connected to VCC (4.8V – 7.2V)
GND pin: (typically black or brown) needs to be connected to GND (0V)
Signal pin: (typically yellow or orange) receives the PWM control signal from an Arduino’s pin.

MG996R Servo Motor Pinout

Wiring Diagram

Since the MG996R is a high-torque servo motor, it draws a lot of power. We should not power this motor via the 5v pin of Arduino. Instead, we need to use the external power supply for the MG996R servo motor.

Arduino MG996R Servo Motor Wiring Diagram

This image is created using Fritzing. Click to enlarge image

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *