Sir..thanks. We work in paint technology. There are loads upto 4 to 5 kg with servo motor wt about 5 kg. It's mechanism. .poor. We use Ball screw which link with LM guide rail. These assly as space issue and costly. Please make vedio on this issue.
Sure, it's a code sample. You have to re-edit code for your own project. #define MY_BLUETOOTH Serial2 //Hardware Serial of Arduino Mega. //for Serial char robotMode; int SpeedOrPosition=0; //for DC Motor #include AF_DCMotor motor1(1); AF_DCMotor motor2(2); AF_DCMotor motor3(4); AF_DCMotor motor4(3); int motorSpeed=60; //60= LOWEST SPEED int motor1State=RELEASE; int motor2State=RELEASE; int motor3State=RELEASE; int motor4State=RELEASE; //for Servo #include Servo LRServo; // Servo for LeftRight. Server0 connetor -> Digital Pin9 Servo UDServo; //Servo for Up and Down. Server1 connetor -> Digital Pin X boolean isServoMode=false; int LRcenter=83; //6WD car=80, ITX car=83. int UDcenter=90; int LRposition=LRcenter; int UDposition=UDcenter; void setup() { Serial.begin(9600); // set up Serial library at 9600 bps //Bluetooth setting MY_BLUETOOTH.begin(9600); Serial.println("bluetooth start"); // Send test message to other device MY_BLUETOOTH.setTimeout(100); //씨리얼통신 값받는데 기다리는시간.
// turn on motor motor1.run(motor1State); motor2.run(motor2State); motor3.run(motor3State); motor4.run(motor4State); motor1.setSpeed(0); motor2.setSpeed(0); motor3.setSpeed(0); motor4.setSpeed(0); LRServo.attach(9); UDServo.attach(10); isServoMode=true; //re-postion servo } void loop() { if(MY_BLUETOOTH.available() >0 ){ //read from Bluetooth, USB serial or Smth... //The bytes array should be like: F2, F90, F250 robotMode = MY_BLUETOOTH.read(); //read first byte, SpeedOrPosition = MY_BLUETOOTH.readString().toInt(); //read rest of bytes as string. this code make slow to response
switch(robotMode){ //DC모터 제어 case 'F': motorSpeed=constrain(SpeedOrPosition, 60, 255); //60 is mininum speed motor4State=FORWARD; motor3State=FORWARD; motor2State=FORWARD; motor1State=FORWARD; break; case 'B': motorSpeed=constrain(SpeedOrPosition, 60, 255); //60 is mininum speed motor4State=BACKWARD; motor3State=BACKWARD; motor2State=BACKWARD; motor1State=BACKWARD; break; case 'L': motorSpeed=constrain(SpeedOrPosition, 60, 255); //60 is mininum speed motor4State=BACKWARD; motor3State=FORWARD; motor2State=FORWARD; motor1State=BACKWARD; break; case 'R': motorSpeed=constrain(SpeedOrPosition, 60, 255); //60 is mininum speed motor4State=FORWARD; motor3State=BACKWARD; motor2State=BACKWARD; motor1State=FORWARD; break; case 'S': // Stop Motor motorSpeed=0; motor4State=RELEASE; motor3State=RELEASE; motor2State=RELEASE; motor1State=RELEASE; isServoMode=true; LRposition= 95; UDposition=100; break;
case 'f': // Servo All Center isServoMode=true; LRposition= LRcenter; UDposition= UDcenter ; break; case 'r': // Move LRservo isServoMode=true; LRposition= LRcenter-constrain(SpeedOrPosition, 0, 90); //앱에서 0~100까지의 값이 옴. break; case 'l': // Move LRservo isServoMode=true; LRposition= LRcenter+constrain(SpeedOrPosition, 0, 90); //앱에서 0~100까지의 값이 옴. break; case 'u': // Move UDservo isServoMode=true; UDposition= UDcenter+constrain(SpeedOrPosition, 0, 60); //앱에서 0~100까지의 값이 옴. break; case 'd': // Move UDservo isServoMode=true; UDposition= UDcenter-constrain(SpeedOrPosition, 0, 15); //앱에서 0~100까지의 값이 옴. 서보 보호를 위해 하각 20도로 제한 break; case 'a': // Special only for NewsRobot. right->left->right->front LRServo.write(LRcenter+30); //right delay(400); //time for motorf LRServo.write(LRcenter-30); //left delay(400); LRServo.write(LRcenter+30); //right delay(400); //time for motor LRServo.write(LRcenter); //front delay(300); break;
case 'b': // Special only for NewsRobot. down->front->down->front UDServo.write(UDcenter-15); //down delay(400); //time for motor UDServo.write(UDcenter+5); //front delay(400); UDServo.write(UDcenter-15); //down delay(400); UDServo.write(UDcenter+5); //front delay(400); break; } // end switch
} //end if //Motor Move motor4.run(motor4State); motor3.run(motor3State); motor2.run(motor2State); motor1.run(motor1State); motor3.setSpeed(motorSpeed); motor4.setSpeed(motorSpeed); motor2.setSpeed(motorSpeed); motor1.setSpeed(motorSpeed); //End Motor Move. if(isServoMode==true){ LRServo.write(LRposition); delay(100); //time for Move UDServo.write(UDposition); delay(100); //time for Move isServoMode=false; } }
선생님 밑에 쪽은(좌우쪽 제어 하는 모터) 어떻게 고정시키나요?
i want to asking some question, if i use this bracket for my servo, can i attached a playwood as a sorting item to this bracket, and if it can, how?
Sir..thanks.
We work in paint technology. There are loads upto 4 to 5 kg with servo motor wt about 5 kg. It's mechanism. .poor. We use Ball screw which link with LM guide rail. These assly as space issue and costly. Please make vedio on this issue.
Hanzhen harmonic drive gear ,
strain wave reducer,
robot joint, over 30 years experience
잘봤습니다 ㅎㅎ
from where i can get this tilt bracket assembly for servo motor
Thanks
mg995,mg996 서보모터 사용하려고 하는데 몇V의 전압공급을 하셨나요?
모터쉴드에 연결해서 사용했고, 모터쉴드에서 5V가 나오는 것으로 알고 있습니다.
Hurmiz_World 감사합니다
can you give me the code for controlling the servo?
Sure, it's a code sample. You have to re-edit code for your own project.
#define MY_BLUETOOTH Serial2 //Hardware Serial of Arduino Mega.
//for Serial
char robotMode;
int SpeedOrPosition=0;
//for DC Motor
#include
AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(4);
AF_DCMotor motor4(3);
int motorSpeed=60; //60= LOWEST SPEED
int motor1State=RELEASE;
int motor2State=RELEASE;
int motor3State=RELEASE;
int motor4State=RELEASE;
//for Servo
#include
Servo LRServo; // Servo for LeftRight. Server0 connetor -> Digital Pin9
Servo UDServo; //Servo for Up and Down. Server1 connetor -> Digital Pin X
boolean isServoMode=false;
int LRcenter=83; //6WD car=80, ITX car=83.
int UDcenter=90;
int LRposition=LRcenter;
int UDposition=UDcenter;
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
//Bluetooth setting
MY_BLUETOOTH.begin(9600);
Serial.println("bluetooth start"); // Send test message to other device
MY_BLUETOOTH.setTimeout(100); //씨리얼통신 값받는데 기다리는시간.
// turn on motor
motor1.run(motor1State);
motor2.run(motor2State);
motor3.run(motor3State);
motor4.run(motor4State);
motor1.setSpeed(0);
motor2.setSpeed(0);
motor3.setSpeed(0);
motor4.setSpeed(0);
LRServo.attach(9);
UDServo.attach(10);
isServoMode=true; //re-postion servo
}
void loop() {
if(MY_BLUETOOTH.available() >0 ){ //read from Bluetooth, USB serial or Smth...
//The bytes array should be like: F2, F90, F250
robotMode = MY_BLUETOOTH.read(); //read first byte,
SpeedOrPosition = MY_BLUETOOTH.readString().toInt(); //read rest of bytes as string. this code make slow to response
Serial.print("Mode:");
Serial.println(robotMode);
Serial.print("Speed:");
Serial.println(SpeedOrPosition);
switch(robotMode){
//DC모터 제어
case 'F':
motorSpeed=constrain(SpeedOrPosition, 60, 255); //60 is mininum speed
motor4State=FORWARD;
motor3State=FORWARD;
motor2State=FORWARD;
motor1State=FORWARD;
break;
case 'B':
motorSpeed=constrain(SpeedOrPosition, 60, 255); //60 is mininum speed
motor4State=BACKWARD;
motor3State=BACKWARD;
motor2State=BACKWARD;
motor1State=BACKWARD;
break;
case 'L':
motorSpeed=constrain(SpeedOrPosition, 60, 255); //60 is mininum speed
motor4State=BACKWARD;
motor3State=FORWARD;
motor2State=FORWARD;
motor1State=BACKWARD;
break;
case 'R':
motorSpeed=constrain(SpeedOrPosition, 60, 255); //60 is mininum speed
motor4State=FORWARD;
motor3State=BACKWARD;
motor2State=BACKWARD;
motor1State=FORWARD;
break;
case 'S': // Stop Motor
motorSpeed=0;
motor4State=RELEASE;
motor3State=RELEASE;
motor2State=RELEASE;
motor1State=RELEASE;
isServoMode=true;
LRposition= 95;
UDposition=100;
break;
case 'f': // Servo All Center
isServoMode=true;
LRposition= LRcenter;
UDposition= UDcenter ;
break;
case 'r': // Move LRservo
isServoMode=true;
LRposition= LRcenter-constrain(SpeedOrPosition, 0, 90); //앱에서 0~100까지의 값이 옴.
break;
case 'l': // Move LRservo
isServoMode=true;
LRposition= LRcenter+constrain(SpeedOrPosition, 0, 90); //앱에서 0~100까지의 값이 옴.
break;
case 'u': // Move UDservo
isServoMode=true;
UDposition= UDcenter+constrain(SpeedOrPosition, 0, 60); //앱에서 0~100까지의 값이 옴.
break;
case 'd': // Move UDservo
isServoMode=true;
UDposition= UDcenter-constrain(SpeedOrPosition, 0, 15); //앱에서 0~100까지의 값이 옴. 서보 보호를 위해 하각 20도로 제한
break;
case 'a': // Special only for NewsRobot. right->left->right->front
LRServo.write(LRcenter+30); //right
delay(400); //time for motorf
LRServo.write(LRcenter-30); //left
delay(400);
LRServo.write(LRcenter+30); //right
delay(400); //time for motor
LRServo.write(LRcenter); //front
delay(300);
break;
case 'b': // Special only for NewsRobot. down->front->down->front
UDServo.write(UDcenter-15); //down
delay(400); //time for motor
UDServo.write(UDcenter+5); //front
delay(400);
UDServo.write(UDcenter-15); //down
delay(400);
UDServo.write(UDcenter+5); //front
delay(400);
break;
} // end switch
} //end if
//Motor Move
motor4.run(motor4State);
motor3.run(motor3State);
motor2.run(motor2State);
motor1.run(motor1State);
motor3.setSpeed(motorSpeed);
motor4.setSpeed(motorSpeed);
motor2.setSpeed(motorSpeed);
motor1.setSpeed(motorSpeed);
//End Motor Move.
if(isServoMode==true){
LRServo.write(LRposition);
delay(100); //time for Move
UDServo.write(UDposition);
delay(100); //time for Move
isServoMode=false;
}
}
please?