UCL-IIOT-"basic Robot Arm 0.3"

Welcome to my Industri 4.0 Project.

this is an arduino controlled robot arm that gets it's signal from nodered.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Audino Tekst for Projektet

Here is my code for arduino:

#include
#include Servo Motor1; Servo Motor2; Servo Motor3; // create a servo object

//Software serial #1: RX = digital pin 10, TX = digital pin 11. SoftwareSerial bluetooth(10, 11);

int enable1Pin = 7; // pin 7 on magnet int state; int flag = 0; //makes sure that the serial only prints once the state int stateStop = 0; int angle1 = 0; int angle2 = 0; int angle3 = 0;

void setup() {

Motor1.attach(3); // attached the pin 3 to Servo object Motor1 Motor2.attach(5); // attached the pin 5 to Servo object Motor2 Motor3.attach(6); // attached the pin 6 to Servo object Motor3

Motor2.write(180); //start position Motor1.write(15); Motor3.write(0); delay (500);

// sets the pins as outputs: pinMode(enable1Pin, OUTPUT);

// initialize serial communication at 9600 bits per second: Serial.begin(9600); bluetooth.begin(9600); }

void loop() {

// processCommand(); //if some date is sent, reads it and saves in state if (Serial.available() > 0) { state = Serial.read(); flag = 0; } // if the state is 'H' the DC motor will go forward if (state == 'h') { for (angle1 = 15; angle1 < 75; angle1 += 1) //Rotating to the left { Motor1.write(angle1); delay(30); } for (angle2 = 180; angle2 >= 145; angle2 -= 1) //lowering the arm { Motor2.write(angle2); delay(30); } for (angle3 = 0; angle3 < 50; angle3 += 1) //lowering the arm { Motor3.write(angle3); delay(30); } digitalWrite(7, HIGH); //activateing the magnet

for (angle3 = 50; angle3 >= 0; angle3 -= 1) //lifting the arm { Motor3.write(angle3); delay(30); } for (angle2 = 145; angle2 < 180; angle2 += 1) //lifting the arm { Motor2.write(angle2); delay(30); } if (flag == 0) { Serial.println("Henter metal skiver!"); flag = 1; state = 's'; } }

// if the state is 'A' the motor will turn left else if (state == 'a') {

for (angle1 = 75; angle1 >= 15; angle1 -= 1) //Rotating to the right { Motor1.write(angle1); delay(30); } for (angle2 = 180; angle2 >= 145; angle2 -= 1) //lowering the arm { Motor2.write(angle2); delay(30); } for (angle3 = 0; angle3 < 50; angle3 += 1) //lowering the arm { Motor3.write(angle3); delay(30); }

digitalWrite(7, LOW); //Deactivates the magnet for (angle3 = 50; angle3 >= 0; angle3 -= 1) //lifting the arm { Motor3.write(angle3); delay(30); } for (angle2 = 145; angle2 < 180; angle2 += 1) //lifting the arm { Motor2.write(angle2); delay(30); }

if (flag == 0) { Serial.println("aflevere metal skiver"); flag = 1; state = 'f'; } delay(1500); state = 180; stateStop = 1;

} //For debugging purpose //Serial.println(state); }

Download my arduino file.

Step 2: Sammenkobling Af Ledninger Og Komponenter

Motor 1 (shoulder) is put in pin 3.

Motor 2 (upper arm) is put in pin 5.

Motor 3 (lower arm) is put in pin 6.

Pin 7 is the magnets signal men den skal kobles til relæet. Husk at den er koblet til en 5v's strømforsyning. (Det er lidt svært at se men det er den sote ledning der går ud af billedet til højre og er koblet til den højre side af breadboardets plus og minus.)

Der er en bluetooth enhed koblet på som ikke bliver brugt i denne guide som man bare kan se bort fra. (Indtil jeg tilføjer et step med det.)

Step 3: Nodered

import dette i nodered

[{"id":"994e1329.45c8a","type":"tab","label":"Project 1: robot arm eksempel","disabled":true,"info":""},{"id":"6d88914b.5cb0c","type":"serial out","z":"994e1329.45c8a","name":"","serial":"c986f578.6491f8","x":430,"y":120,"wires":[]},{"id":"4ec3dcc5.2f5834","type":"debug","z":"994e1329.45c8a","name":"","active":true,"console":"false","complete":"false","x":450,"y":180,"wires":[]},{"id":"15e3055b.b8ce9b","type":"ui_dropdown","z":"994e1329.45c8a","name":"","label":"Option selection","place":"Select option","group":"f70e2cd7.20d4","order":0,"width":0,"height":0,"passthru":true,"options":[{"label":"Select option","value":"0","type":"str"},{"label":"Start hauling","value":"h","type":"str"},{"label":"Start unloading","value":"a","type":"str"}],"payload":"","topic":"","x":160,"y":140,"wires":[["6d88914b.5cb0c","4ec3dcc5.2f5834"]]},{"id":"c986f578.6491f8","type":"serial-port","z":"","serialport":"COM7","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","newline":"\\n","bin":"false","out":"char","addchar":false,"responsetimeout":"10000"},{"id":"f70e2cd7.20d4","type":"ui_group","z":"","name":"Default","tab":"ff3520e1.0030c","disp":true,"width":"6","collapse":false},{"id":"ff3520e1.0030c","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]

Step 4: Eventuelt Bluetooth

venter på forklaring...

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • CNC Contest

      CNC Contest

    Discussions