Use MG995 continuous rotation servo motor with Arduino
Hello, in this tutorial we’re using the MG995 continuous rotation servo motor, it has many applications especially robotics, you can use it to move heavy vehicles or charges, or passing through tough terrains, because it has very high torque ( 8.5 kgf·cm (4.8 V ), 10 kgf·cm (6 V) ), also it has metal bearing which can stand “heavy work”.

The usual servo rotates from 0-180° or 0-360° and its main feature that it actually knows its position that’s why they’re called “servos”, but this one is mainly called servo too even if doesn’t have the main feature… maybe it’s because the shape and wiring.
Wiring:
Make sure that the control pin is wired with a “PWM” output, they are the ones marked with “~”.

Code:
Download code .ino format or check below.
The code is simple and just like the servos standard codes with the main functions, but here instead of controlling the position we control the speed and direction, you can watch the tutorial for more information.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
//This code is to demonstrate the use of a continuous rotation servo motor with its different functions //Refer to surtrtech.com to understand further #include <Servo.h> //Servo library Servo myservo; //Servo name is myservo void setup() { Serial.begin(9600); myservo.attach(6); // attaches the servo signal pin on pin D6 } void loop() { Serial.println("0");// You can display on the serial the signal value myservo.write(0); //Turn clockwise at high speed delay(3000); myservo.detach();//Stop. You can use deatch function or use write(x), as x is the middle of 0-180 which is 90, but some lack of precision may change this value delay(2000); myservo.attach(6);//Always use attach function after detach to re-connect your servo with the board Serial.println("180");//Turn left high speed myservo.write(180); delay(3000); myservo.detach();//Stop delay(2000); myservo.attach(6); //myservo.write(92); //Used in the tutorial video, 92 was my stop value } |
Categories
Yassine View All
Automation and Electrical Engineer, Electronics amateur trying to share my little projects.
