Smart Servo MS-12A Arduino IDE


#1

Hello,
I am using the Arduino IDE to program the MS-12A Smart Servo but can get no movement out of the motor. I see many others have had this issue when looking through the forum. I have followed the instructions here
https://forum.makeblock.com/t/smart-servo-ms-12a-not-working-with-arduino/13438/11
on this thread but it didn’t resolve the issue.

I am using an Arduino UNO
Any help is greatly appreciated


#2

I’ll think about it… Mention @Crackel and @CommandeR


#3

It might be helpful if you were to share your test code and what other tests you’ve done to ensure the connection is set up correctly, e.g. can you programme the servo LED?


#4

As mentioned in my initial post I am following the structure of the last suggested code in this forum post with suggested changes to library dependencies and port used in software serial:
https://forum.makeblock.com/t/smart-servo-ms-12a-not-working-with-arduino/13438/10

/**
  • \par Copyright ©, 2012-2016, MakeBlock
  • @file SmartServoCallback.ino
  • @author MakeBlock
  • @version V1.0.0
  • @date 2017/07/10
  • @brief Description: this file is sample code for Smart servo device.
  • Function List:
    1. boolean MeSmartServo::assignDevIdRequest(void);
    1. boolean MeSmartServo::moveTo(uint8_t dev_id,long angle_value,float speed,smartServoCb callback);
    1. boolean MeSmartServo::move(uint8_t dev_id,long angle_value,float speed,smartServoCb callback);
  • \par History:
  • 
    
  • Mark Yan 2017/07/10 1.0.0 build the new

*/
#include <SoftwareSerial.h>
#include<MeSmartServo.h>
#include <MeOrion.h>

MeSmartServo mysmartservo(PORT5); //UART2 is on port 5

long loopTime = 0;

void setup()
{
Serial.begin(115200);
mysmartservo.begin(115200);
delay(5);
mysmartservo.assignDevIdRequest();
delay(50);//must delay over 50ms
mysmartservo.setInitAngle(1);
delay(40);
mysmartservo.setZero(1);
delay(40);
loopTime = millis();
}

void loop()
{
mysmartservo.setRGBLed(1, 0, 255, 0);
delay(500);
mysmartservo.move(1, 90, 50); //device ID, angle, speed; absolute angle move;
delay(500);
mysmartservo.setRGBLed(1, 255, 0, 0);
delay(500);
mysmartservo.move(1, 180, 50); //device ID, angle, speed; absolute angle move;
delay(500);
mysmartservo.move(1, 270, 50); //device ID, angle, speed; absolute angle move;
delay(500);
mysmartservo.move(1, 360, 50); //device ID, angle, speed; absolute angle move;
delay(500);
mysmartservo.move(1, -180, 50); //device ID, angle, speed; absolute angle move;
delay(1000);
mysmartservo.move(1, 0, 50); //device ID, angle, speed; absolute angle move;
delay(2000);
}

The RGB LED is not working consistently. It does not change via programming it just remains blue on the motor.

I have tried various power sources: 9V battery and VIN pin on Arduino, 9V battery with positive power line direct to servo and ground to servo and to Arduino, 12V power source. None have made any difference.
I have also tried the example that comes with the latest MakeBlockDrive Arduino library release. No movement.

The wiring is as advised on the Getting Started leaflet for Arduino + Smart Servo. Red Terminal wire that comes with the motor and the 4 wires go Red to Vin, Black to GND, yellow to TX , white to RX

I have tried an UNO board with PORT5 for software serial and a Leonardo. No change
I have two smart servos and neither move.


#5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.