Introduction: Arduino Controlled Robotic Arm From Lego Mindstorm

About: Hack Sioux Falls Project!

Repurpose two old Lego Mindstorm motors into a grabber arm controlled by an Arduino Uno.

This is a Hack Sioux Falls project where we challenged kids to build something cool with an Arduino.

Step 1: Parts Needed

Supplies needed:

Step 2: Remove Motor Housing

Start by removing the screws on the backside of both motors, then removing the white caps. You can then discard them.

Pull the motors out, making sure not to remove any of the gears on the inside. If you do remove any of the gears, just pop them back into place.

Once the motors have been removed, cut off the plugin on the end of the motor with a wire cutter.

Step 3: Solder on Longer Wires

Solder on some new, longer wire. This is much easier than it looks and only takes a few seconds if you know what you're doing.

Put the motor back into the plastic casing, then screw it back in. You can now start the construction of the arm. You can create your own design or go off of the one in the picture.

Step 4: Add Motors to Motor Board

Use a Phillips screwdriver to plug the wires coming from the motors into the motor board as shown in the picture. Then plug the board into the Arduino Uno.

Cut the USB charger in half, exposing the wire inside. Strip the insulation, then strip the two positive and negative leads. Then plug it into the motor board

Step 5: Build Switch Board

Solder on the resistors, switches, and wires onto the perfboard like the picture.

Add a few female connector pins on the perfboard and motor board like the picture shows, then connect the two.

Step 6:

Plug the Arduino into a computer and upload this code into the Arduino.

We used this motor driver library from Adafruit , but another driver library would work as well.

#inlude <AFMotor.h>

int buttonLeft = A0;<br>int buttonRight = A1;
int buttonOpen = A2;
int buttonClose = A3;

AF_DCMotor motorRotate(1);
AF_DCMotor motorGrabber(2);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor test!");

  pinMode(buttonLeft, INPUT);
  pinMode(buttonRight, INPUT);
  pinMode(buttonOpen, INPUT);
  pinMode(buttonClose, INPUT);

  // turn on motor
  motorRotate.setSpeed(200);
  motorGrabber.setSpeed(200);
 
  motorRotate.run(RELEASE);
  motorGrabber.run(RELEASE);
}

void loop() {
 
  int buttonStateLeft = digitalRead(buttonLeft);
  int buttonStateRight = digitalRead(buttonRight);
  int buttonStateOpen = digitalRead(buttonOpen);
  int buttonStateClose = digitalRead(buttonClose);

  if (buttonStateLeft == HIGH) {
    Serial.println("Button Left");    
    motorRotate.run(BACKWARD);
    delay(250);
    motorRotate.run(RELEASE);
    
  } else if (buttonStateRight == HIGH) {
    Serial.println("Button Right");
    motorRotate.run(FORWARD);
    delay(250);
    motorRotate.run(RELEASE);
    
  } else if (buttonStateOpen == HIGH) {
    Serial.println("Button Open");
    motorGrabber.run(BACKWARD);
    delay(150);
    motorGrabber.run(RELEASE);
    
  
  } else if (buttonStateClose == HIGH) {
    Serial.println("Button Close");
    motorGrabber.run(FORWARD);
    delay(150);
    motorGrabber.run(RELEASE);
  }
}