Presentation is loading. Please wait.

Presentation is loading. Please wait.

ROBOTIC ARM 2 Wilmer Arellano © 2013. Hardware  Next slide shows sensor connection to analog pin 0 and Motor 1 connection. Lecture is licensed under.

Similar presentations


Presentation on theme: "ROBOTIC ARM 2 Wilmer Arellano © 2013. Hardware  Next slide shows sensor connection to analog pin 0 and Motor 1 connection. Lecture is licensed under."— Presentation transcript:

1 ROBOTIC ARM 2 Wilmer Arellano © 2013

2 Hardware  Next slide shows sensor connection to analog pin 0 and Motor 1 connection. Lecture is licensed under a Creative Commons Attribution 2.0 License.

3 Next motors use adjacent pins to the left Important

4 Let's use the same control numbering Lecture is licensed under a Creative Commons Attribution 2.0 License. Motor 2 Motor 3 Motor 4Motor 5 Motor 1 Arduino

5 H-Bridge http://www.robotroom.com/HBridge.htmlbotroom.com/HBridge.html This is just an example, we prefer to use the TC4422 in the T0-220 package which has higher Current capability but is single channel. You can order free samples from microchip Lecture is licensed under a Creative Commons Attribution 2.0 License.

6 Let’s try one motor (use the one in the Arduino kit)  Find operation of instruction analogWrite() in arduino.cc  Pseudo Code  Move motor at speed 1  Wait a certain amount of time  Move motor at speed 2  Wait a certain amount of time  Change direction  Move motor at speed 3  Wait a certain amount of time  Hints: set speed2 > speed1 = 150. And Speed3 = 255 – speed2  Test it, if it does not work invert motor cables Lecture is licensed under a Creative Commons Attribution 2.0 License.

7 Let's use the same motor numbering Lecture is licensed under a Creative Commons Attribution 2.0 License. Motor 1 Motor 2 Motor 3Motor 4 Motor 5

8 Precautions Lecture is licensed under a Creative Commons Attribution 2.0 License. Motor 1 Motor 2 Motor 3

9 Precautions Lecture is licensed under a Creative Commons Attribution 2.0 License. Motor 2 Motor 2 may not have enough power to lift the fully extended arm

10 Precautions Lecture is licensed under a Creative Commons Attribution 2.0 License. Motor 3 Lifting with motor 3 first helps to solve the problem

11 Positioning the sensor  Sensor must have at least 4 cm from object. For that reason is placed near the center  You may need to use some little rotation for best results Lecture is licensed under a Creative Commons Attribution 2.0 License. Sensor

12 Avoid extreme rotations  Avoid rotating motors to the extreme positions (left or right)  They may click and lock  Ask your instructor if this happens Lecture is licensed under a Creative Commons Attribution 2.0 License.

13 H-Bridge Lecture is licensed under a Creative Commons Attribution 2.0 License.

14 H-Bridge http://www.robotroom.com/HBridge.htmlbotroom.com/HBridge.html This is just an example, we prefer to use the TC4422 in the T0-220 package which has higher Current capability but is single channel. You can order free samples from microchip Lecture is licensed under a Creative Commons Attribution 2.0 License.

15 Precautions  The Robotic Arm is a delicate device that may be damaged if operated beyond the mechanic limits  If while you program the arm operation you observe a motion behavior that may compromise the robot integrity disconnect power immediately. Center the arm with the manual remote and make any corrections necessary to your program Lecture is licensed under a Creative Commons Attribution 2.0 License.

16 Installation  Download Library from:  http://web.eng.fiu.edu/~arellano/1002/Microcontroller/Arm.zip http://web.eng.fiu.edu/~arellano/1002/Microcontroller/Arm.zip  Unzip library and drop it in:  The libraries folder of your arduino installation. In my case:  C:\arduino-1.0.1-windows\arduino-1.0.1\libraries Lecture is licensed under a Creative Commons Attribution 2.0 License.

17  Include in your final report:  An explanation of a gear box operation. Particularize for the gear boxes you are using  How to measure power in a DC motor. Include several power measurements on the arm’s motors under different operating conditions Lecture is licensed under a Creative Commons Attribution 2.0 License.

18 #include // Create an instancve of Arm Arm arm(0); // Backward direction, Left and Down int LEFT = 0, DOWN = 0; // Forward direction, Right and Up int RIGHT = 1, UP = 1; int control = 1, temp; void setup() { Serial.begin(9600); Serial.println("Hello"); } void loop() { arm.checkData(); while(control > 0){ arm.moveMotor(1, LEFT, 5, 10); arm.moveMotor(1, RIGHT, 5, 10); control = control - 1; temp = arm.distance(); Serial.print("Distance: "); Serial.println(temp); } Example, just to test motor 1 Change the motor ID number and test motors one by one Lecture is licensed under a Creative Commons Attribution 2.0 License.

19 Constructor  Include the library:  #include  Create an instance of the class:  Arm arm(int);  “int” tells the library where the distance sensor is connected.  #include  // Create an instancve of Arm  Arm arm(0); Lecture is licensed under a Creative Commons Attribution 2.0 License.

20 Create Mnemonics  // Backward direction, Left and Down  int LEFT = 0, DOWN = 0;  // Forward direction, Right and Up  int RIGHT = 1, UP = 1; Lecture is licensed under a Creative Commons Attribution 2.0 License.

21 Initialize  int control = 1, temp;  void setup() {  Serial.begin(9600);  Serial.println("Hello");  } Lecture is licensed under a Creative Commons Attribution 2.0 License.

22 Execute  void loop() {  arm.checkData();  while(control > 0){  arm.moveMotor(1, LEFT, 5, 10);  arm.moveMotor(1, RIGHT, 5, 10);  control = control - 1;  temp = arm.distance();  Serial.print("Distance: ");  Serial.println(temp);  } Lecture is licensed under a Creative Commons Attribution 2.0 License.

23 Motor Control 1  arm.moveMotor (int motorID, int Direction, int Speed, int time)  Motor ID = 1, 2, 3, 4, 5  Direction = RIGHT, LLEFT  0 < Speed < 11  0 < time < 40  You may need to invert your motor connection for proper operation Lecture is licensed under a Creative Commons Attribution 2.0 License.

24 Motor Control 2  arm.checkData()  This function with no arguments checks for serial data from the computer  Use the serial monitor of the Arduino IDE to control the arm  Type one or more commands and hit enter Lecture is licensed under a Creative Commons Attribution 2.0 License.

25 Motor Control 2  Commands  Selection  a or A moves motor towards left  Motion  s or S moves motor towards right  w or W moves motor up  z or Z moves motor down  a, z and s, w are interchangeable  A single motion command will produce a small movement a sequence of several motion commands of the same type will produce an ampler motion Lecture is licensed under a Creative Commons Attribution 2.0 License.

26 Motor Control 3  arm.initialize(time)  This function allows you to adjust the arm position for “time” seconds, using the commands on the previous slide.  This function internally uses arm.checkData() Lecture is licensed under a Creative Commons Attribution 2.0 License.

27 Motor Control 3 #include Arm arm(0); // Creates an instance of Arm int LEFT = 0, DOWN = 0; // Backward direction, Left and Down int RIGHT = 1, UP = 1; // Forward direction, Right and Up int temp; void setup() { // We use this loop only as we want a single execution of the program Serial.begin(9600); Serial.println("Hello"); arm.initialize(20); // The argument Determines how many second you have to manually position the arm } void loop() { } Lecture is licensed under a Creative Commons Attribution 2.0 License.

28 Distance measurement  temp = arm.distance();  When this function is called an integer is returned with approximate distance between the sensor and an object  Limitations  Max distance 80 cm  Object with a distance less than 10 cm will appear to be farther away Lecture is licensed under a Creative Commons Attribution 2.0 License.

29 Functions  Next we will modify the original code to:  Include functions  Add some delay to manually position the griper  Lines highlighted in red have change please read the comments. Lecture is licensed under a Creative Commons Attribution 2.0 License.

30 #include Arm arm(0); // Creates an instance of Arm int LEFT = 0, DOWN = 0; // Backward direction, Left and Down int RIGHT = 1, UP = 1; // Forward direction, Right and Up int temp; void setup() { // We use this loop only as we want a single execution of the program Serial.begin(9600); Serial.println("Hello"); arm.initialize(20); // The argument Determines how many second you have to manually position the arm home(); // "home()" is a function call. It will execute the code between the braces of "void home()“ Program // Execution will return here after executing the code of spin() } void loop() { } void home(){ temp = arm.distance(); while(temp > 10){ // When the sensor detects an object within 20 cm of distance, the function will stop // Replace the next comment line with appropriated code // Move motor #1 so the arm moves towards home. //Try different combinations of speed and time to see which one works best. temp = arm.distance(); Serial.print("Distance: "); // This line is optional if you want to monitor distance in the computer Serial.println(temp); // This line is optional if you want to monitor distance in the computer } Lecture is licensed under a Creative Commons Attribution 2.0 License.

31 #include Arm arm(0); // Creates an instance of Arm int LEFT = 0, DOWN = 0; // Backward direction, Left and Down int RIGHT = 1, UP = 1; // Forward direction, Right and Up int temp; void setup() { // We use this loop only as we want a single execution of the program Serial.begin(9600); Serial.println("Hello"); arm.initialize(20); // The argument Determines how many second you have to manually position the arm home(); // "home()" is a function call. It will execute the code between the braces of "void home()“ Program // Execution will return here after executing the code in home() // add more functions, like find(); // Move arm to find the object } void loop() { } void home(){ temp = arm.distance(); while(temp > 10){ // When the sensor detects an object within 20 cm of distance, the function will stop // Replace the next comment line with appropriated code // Move motor #1 so the arm moves towards home. //Try different combinations of speed and time to see which one works best. temp = arm.distance(); Serial.print("Distance: "); // This line is optional if you want to monitor distance in the computer Serial.println(temp); // This line is optional if you want to monitor distance in the computer } void find(){ temp = arm.distance(); while(temp > 25){ // Replace the next comment lines with appropriated code // Move motor #1 so the arm moves towards the object. //Try different combinations of speed and time to see which one works best. // May need to move back a little bit after finding home (Overshoot) temp = arm.distance(); Serial.print("Distance: "); // This line is optional if you want to monitor distance in the computer Serial.println(temp); // This line is optional if you want to monitor distance in the computer } Lecture is licensed under a Creative Commons Attribution 2.0 License.


Download ppt "ROBOTIC ARM 2 Wilmer Arellano © 2013. Hardware  Next slide shows sensor connection to analog pin 0 and Motor 1 connection. Lecture is licensed under."

Similar presentations


Ads by Google