Project tutorial
How to Build Sauron The Lord of the Robots

How to Build Sauron The Lord of the Robots © CC BY-NC-SA

A human-sized semi-humanoid robot that looks like Sauron from The Lord of the Rings movie series.

  • 6,581 views
  • 5 comments
  • 26 respects

Components and supplies

Necessary tools and machines

Lasercutter
Laser cutter (generic)

Apps and online services

About this project

Are you a fan of Lord Of The Rings movie series? If so for sure you know "Sauron"!

In this project we will build a human size semi-humanoid robot looks like Sauron :)

The robot has two 3 DOF arms and a 3 DOF head and a fixed base.Sauron the robot can operate in three modes and you can switch between these modes using two push buttons attached to two digital Input pins:

1. Standby Mode This mode for show casing the robot in any event, The robot perform sequence of movements to attract the attendees.

2. Game pad Mode In this mode the event attendee can control the robot using the Gamepad shield from 1Sheeld Application.

3. Imitation Mode In this mode the robot can imitates the event attendee movements like the kid in Real Steal Movie. So you will wear a gloves with your smart phone fixed on it and the Arduino will read your smart phone sensors values like orientation and gyroscope then use these values to control the robot's arms.

I have made this project to participate in New York Maker Faire to make children happy and inspire them to use modern technologies especially developing platforms such as Arduino and 1Sheeld to build their movie characters like ATOM in Real Steal movie or Sauron from The Lord Of The Rings movie series. I've included all the needed files ( CAD drawings, Circuits schematics and layouts, Arduino codes and dxf files for laser cutter) to help any one to build his own Sauron :)

Lets start building the Lord Of The Robots.

Step 1: Building the robot's head

To save time and effort I decided not to reinvent the wheel, so instead of designing a new robotic head I used this fantastic open source robotic head "Fritz" from xyzbot. I download their laser cutter files then I used a laser cutter in a nearby makerspace to cut the head parts.In my case I tried to reduce the time and the cost so I skipped 3D printing the eyes parts then I skipped the lips and the eyebrows.

I used 3mm plywood sheet to implement the head parts, after cutting these parts using the laser cutter please follow the attached video to assemble the kit but take care of these points:

1. You will skip assembling the base.

2. You will skip all the steps related to the 3D printed parts of the eyes.

3. You will skip all the steps related to the eyebrows and the lips.

Step 2: Building the robot's body

As usual I build my projects to be portable to be easily assembled in a short time if I will travel with it to attend an event like Maker Faire so I built the robot's body using Artelon rods and 3mm plywood sheets.

I used Tongue and Groove Joints to fix the chest with shoulders, neck and the back. Then I used 4mm x 20mm screws to fix the wooden frame with Artelon skeleton and 12mm x 30mm screw to fix the Artelon skeleton with the robot's base.I used 4mm x 10mm screw to fix the servo motors with wooden frame.The Artelon skeleton consists of 5 parts:

1. The basic rod is made of 50mm Artelon rod.

2. The Skeleton is made of 25mm Artelon rod.

3. The width rods -> the robot has 3 part to fix the chest with the back with the help of the Artelon skeleton, these parts are made of 15mm Artelon rod.

You can check the attached drawings for more information ab out the manufacturing all these parts.

Step 3: Creating the Robot's base

  • I used Solidworks to design this base to fix the robot to my desk, you can use the three screws to fix it to the desk or you can use two 4 inch C clamps.
  • I used 6mm sheet metal to manufacture this base, and I made these openings to reduce its weight.
  • I used 12mm x 30mm screw to fix the base with the Artelon skeleton.
  • You can use the attached .dxf file to implement yours.

Step 4: Building the robot's Arms

The robot's arms were the biggest challenging point in this project. I wanted them to be modular and easily assembled and dissembled as possible to be enable me to travel with the robot to United States.

I wanted these arms to be general purpose and I can modify them easily. If I wanted this robot to be a pirate I can use a sword and a hook and if I wanted the robot to be a boxer like Atom in Real Steal movie I can add two fists and I can add two grippers to make him a general purpose robot, So I designed the forearm joint for this purpose.

I used 3mm plywood sheets to implement the arm frame and aluminum pan tilt for the shoulder joints then I used Balsa sheets to cut the weapons the sword and the hook.

I used Solidworks to calculate the required torque and the result was that I need to use 3kg/cm servo motors but I used larger motors to make the robot to lift some thing.Instead of doing a lot of machining on the lathe to implement the forearm joints I used Autodesk 123D Make to split them into a rack of slices, then I used the laser cutter to cut them.

I attached the robotic arm design on Solidworks so you can make your modifications and calculate the torque.

Step 5: Sauron helmet and armor cosplay

Till now the robot looks like ATOM from real Steal movie, let help ATOM to be Sauron :D

My friend Kareem helped me to implement the cosplay we followed these fantastic instructables to build the robot's helmet and armor, but I modified them slightly to fit the robot dimensions.

http://www.instructables.com/id/Sauron-Cosplay/

http://www.instructables.com/id/Sauron-Cosplay-Hel...

If you have any questions about the cosplay part you can ask him via his FB page

Thanks to Nate Space.

Step 6: The Robot's Electronics

1. I used Arduino Mega with 1Sheeld to control the robot's arms and head servo motors.

2. I used 5V/5A power supply to power the motors and the Arduino.

3. I used small breadboard to connect all the motors Vcc and GND together with the power supply

4. I used 1Sheeld to control the robot using my smart phone.1Sheeld is a rapid prototyping platform for Arduino that allows you to tap into your smartphone's sensors and capabilities and lets you use them in your Arduino projects. Basically, It is a hardware shield that sits on top of your Arduino board and communicates over Bluetooth to this Android app, to transfer data between it and your smartphone.

1Sheeld Mobile Application has a long list of shields, you should select Gamepad shield, Orientation shield, Music Player shield, Terminal Shield and toggle button from this list.

1. Gamepad Shield which is a GUI on my smartphone that has some buttons like PlayStation joystick and connected to Arduino through Bluetooth and i used it control the servo motors manually. When you press on any button from Gamepad shield the application will send data to 1Sheeld then Arduino will control the servo motors of the robot's arms and head.

2. Orientation Shield: I wear a gloves with my smartphone fixed on it then I map the values from the smartphone sensors to send it as angles to the servo motors.

3. Music Player Shield: I use music player shield to play a sound track that has Sauron voice when he move his mouth up and down.

4. Toggle button Shield: I use this shield to choose the desired mode instead of adding physical push buttons

5. Terminal Shield: I use this shield instead of using Arduino IDE serial monitor because 1Sheeld can not communicate with the PC and the Bluetooth module at the same time.

Step 7: The Arduino Code

Step 1: Place your 1Sheeld on your Arduino board then plug the Arduino to your laptop or PC.

Step 2: Download 1Sheeld Application onto your smart phone. The app is available on the Google play store at http://1sheeld.com/app

Step 3: Download 1Sheeld library Download OneSheeld library to your computer through this link.

Step 4: Extract the folder, copy it, and paste it in your Arduino libraries directory.

Step 5: Open my Arduino Sketch ( you will find it in the attached files)

Step 6: Upload your sketch

Here comes the most important part of the whole tutorial, switch 1Sheeld to the Uploading-mode (this is the switch labeled UART Switch on the board) before you upload your sketch to the Arduino board to avoid serial conflicts between 1Sheeld and Arduino, then press the Upload button in the IDE.

Upload mode is turned on when the UART switch is pushed away from the 1Sheeld logo. Once you have completed your upload you need to switch 1Sheeld back to the operating mode.

Don’t forget! If you don’t switch the UART Switch back to the operating mode your project will not work properly as you will have no communication between 1Sheeld and the Arduino board. Operating mode is turned on when the UART switch is pushed closest to the 1Sheeld logo.

Step 7: Use 1Sheeld Application Open 1Sheeld application on your Android smart phone. The application will first scan over Bluetooth for your 1Sheeld, it will take a few seconds and the phone will find it. Once it appears on your screen as 1Sheeld #xxxx, you will be required to enter the pairing code (the default pairing code is 1234) and connect to 1Sheeld via Bluetooth.

NOTE: If you are having trouble please make sure the Bluetooth is turned on for your Android phone and that the Android phone is close to your 1Sheeld.

Step 8 : Select Gamepad Shield, Orientation Shield, Music Player Shield and Toggle button Shield and Terminal shield from the shields list and press on the multiple shields icon at the top right of the app.

Step 9: Once you power the robot, it will operate in the standby mode by default if you want to control it manually using Gamepad access the toggle button shield and choose pin 2 then press On. If you want to return back to the standby mode press OFF.

Step 10: If you want to control it manually using Orientation Sensor access the toggle button shield and choose pin 3 then press On. and make sure that pin 2 status is LOW.

Step 8: Sauron in Maker Faire New York

Now lets watch Sauron between his fans in Maker Faire New York :)

Step 9: Future Work

Regards this instructable: I will record a video for me wile assembling the robot then trying the three modes.

Regards the robot's head: In this iteration I decided to reduce the cost so I used only 3 motors in the head, In the next iteration I will add the rest of motors and I will 3D print the eyes parts like (eyelid, eyebracket, eyering, clevis pin, eyeball shell)

Regards the robot's base: I will replace the fixed base with a 4 mecanum wheel robot base to give the robot the ability to move freely.I finished designing the base on Solidworks but I have no time to merge it with the robot.

Code

Sauron Arduino CodeArduino
#define CUSTOM_SETTINGS
#define INCLUDE_GAMEPAD_SHIELD
#define INCLUDE_MUSIC_PLAYER_SHIELD
#define INCLUDE_TERMINAL_SHIELD
#define INCLUDE_ORIENTATION_SENSOR_SHIELD

/* Include 1Sheeld library. */
#include <OneSheeld.h>
#include <Servo.h>

Servo rightArm_Motor1;
Servo rightArm_Motor2;
Servo rightArm_Motor3;

Servo leftArm_Motor1;
Servo leftArm_Motor2;
Servo leftArm_Motor3;

Servo neckHorizontal;
Servo neckVertical;

Servo mouth;

const int modePin1 =  2;
const int modePin2 =  3;

volatile int modeState1 = LOW;
volatile int modeState2 = LOW;

volatile boolean gamepadMode_Enabled = false;
volatile boolean imitationMode_Enabled = false;

const int ledPin1 = A0;
const int ledPin2 = A1;
//------------------------------------------ void setup ---------------------------------------------------

void setup()
{
  // Start communication
  OneSheeld.begin();

  // Set some pins as output
  pinMode(modePin1, INPUT);
  pinMode(modePin2, INPUT);

  // Set Led as output and HIGH "Saurons Eye"
  pinMode(ledPin1,OUTPUT);
  pinMode(ledPin2,OUTPUT);
  digitalWrite(ledPin1,HIGH);
  digitalWrite(ledPin2,HIGH);
  
  // Digital Pins Usable For Interrupts when using Mega, Mega2560, MegaADK (2, 3, 18, 19, 20, 21)
  attachInterrupt(digitalPinToInterrupt(modePin1), gampadMode_ChangeISR, CHANGE);
  attachInterrupt(digitalPinToInterrupt(modePin2), imitationMode_ChangeISR, CHANGE);

  /* Connect signal pins(Orange) from the motors to the Arduino mega PWM pins directly
     then power the motors from the power supply NOT from the Arduino
     then connect both grounds of Arduino and power supply to each others
  */

  rightArm_Motor1.attach(4);
  rightArm_Motor2.attach(5);
  rightArm_Motor3.attach(6);

  leftArm_Motor1.attach(7);
  leftArm_Motor2.attach(8);
  leftArm_Motor3.attach(9);

  neckHorizontal.attach(10);
  neckVertical.attach(11);

  mouth.attach(12);

  // home position
  rightArm_Motor1.write(95);
  rightArm_Motor2.write(150);
  rightArm_Motor3.write(20);

  leftArm_Motor1.write(90);
  leftArm_Motor2.write(45);
  leftArm_Motor3.write(180);

  neckHorizontal.write(105);
  neckVertical.write(30);

  mouth.write(100);
}

//---------------------------------- void loop ---------------------------------------------------

void loop()
{
  modeState1 = digitalRead(modePin1);
  modeState2 = digitalRead(modePin2);

  // Always check the desired mode
  if (modeState1 == HIGH) {
    Terminal.println("GamePad Mode was selected");
    gamePadMode();
  } //Pin 12 = High --> Gamepad mode

  else if (modeState2 == HIGH) {
    Terminal.println("Imitation Mode was selected");
    imitationMode();
  } //Pin 13 = High -- > Imitation Mode

  else {
    Terminal.println("Standby Mode was selected");
    standbyMode();
  }

}//void loop


//----------------------------------------- void Standby Mode ---------------------------------------------

void standbyMode() {
  // Standby Mode
  Terminal.println("Standby mode activated");

  // home position
  Terminal.println("1st position");
  rightArm_Motor1.write(95);
  rightArm_Motor2.write(150);
  rightArm_Motor3.write(20);

  leftArm_Motor1.write(90);
  leftArm_Motor2.write(45);
  leftArm_Motor3.write(180);

  neckHorizontal.write(105);
  neckVertical.write(30);

  // Set the volume
//  MusicPlayer.setVolume(10);
  MusicPlayer.play();

  for (int i = 0; i <= 19; i++) {
    mouth.write(100);
    OneSheeld.delay(150);
    mouth.write(75);
    OneSheeld.delay(150);
  }//for

  MusicPlayer.pause();
  mouth.write(100);

  OneSheeld.delay(3000);

  //----------------------------------------------------

  // Always check the desired mode
  if (gamepadMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate GamePad Mode Now");
    gamePadMode();
  } //Pin 12 = High --> Gamepad mode

  else if (imitationMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate Imitation Mode Now");
    imitationMode();
  } //Pin 13 = High -- > Imitation Mode

  else { // Complete the rest of the sequence

    // Move head 90 --> 0 --> 180 --> 90
    Terminal.println("2nd position");
    rightArm_Motor1.write(95);
    rightArm_Motor2.write(150);
    rightArm_Motor3.write(20);

    leftArm_Motor1.write(90);
    leftArm_Motor2.write(45);
    leftArm_Motor3.write(180);

    neckHorizontal.write(105);
    OneSheeld.delay(1500);
    neckHorizontal.write(65);
    OneSheeld.delay(1500);
    neckHorizontal.write(140);
    OneSheeld.delay(1500);
    neckHorizontal.write(105);

    neckVertical.write(30);

    // Set the volume
//    MusicPlayer.setVolume(10);
    MusicPlayer.play();

    for (int i = 0; i <= 19; i++) {
      mouth.write(100);
      OneSheeld.delay(150);
      mouth.write(75);
      OneSheeld.delay(150);
    }//for

    MusicPlayer.pause();
    mouth.write(100);

    OneSheeld.delay(3000);
  }//else --> complete the rest of the sequence

  //----------------------------------------------------

  // Always check the desired mode
  if (gamepadMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate GamePad Mode Now");
    gamePadMode();
  } //Pin 12 = High --> Gamepad mode

  else if (imitationMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate Imitation Mode Now");
    imitationMode();
  } //Pin 13 = High -- > Imitation Mode

  else { // Complete the rest of the sequence

    // Move hands and head to 45 degree
    Terminal.println("3rd position");
    rightArm_Motor1.write(15);
    rightArm_Motor2.write(180);
    rightArm_Motor3.write(0);

    leftArm_Motor1.write(180);
    leftArm_Motor2.write(30);
    leftArm_Motor3.write(145);

    neckHorizontal.write(65);
    neckVertical.write(30);

    // Set the volume
//    MusicPlayer.setVolume(10);
    MusicPlayer.play();

    for (int i = 0; i <= 19; i++) {
      mouth.write(100);
      OneSheeld.delay(150);
      mouth.write(75);
      OneSheeld.delay(150);
    }//for

    MusicPlayer.pause();
    mouth.write(100);

    OneSheeld.delay(3000);
  }//else --> complete the rest of the sequence

  //-------------------------------------------------

  // Always check the desired mode
  if (gamepadMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate GamePad Mode Now");
    gamePadMode();
  } //Pin 12 = High --> Gamepad mode

  else if (imitationMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate Imitation Mode Now");
    imitationMode();
  } //Pin 13 = High -- > Imitation Mode

  else { // Complete the rest of the sequence

    // Move right hand and head to 135 degree
    Terminal.println("4th position");
    rightArm_Motor1.write(15);
    rightArm_Motor2.write(150);
    rightArm_Motor3.write(30);

    leftArm_Motor1.write(180);
    leftArm_Motor2.write(30);
    leftArm_Motor3.write(145);

    neckHorizontal.write(140);
    neckVertical.write(30);

    // Set the volume
//    MusicPlayer.setVolume(10);
    MusicPlayer.play();

    for (int i = 0; i <= 19; i++) {
      mouth.write(100);
      OneSheeld.delay(150);
      mouth.write(75);
      OneSheeld.delay(150);
    }//for

    MusicPlayer.pause();
    mouth.write(100);

    OneSheeld.delay(3000);
  }//else --> complete the rest of the sequence

  //---------------------------------------------------

  // Always check the desired mode
  if (gamepadMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate GamePad Mode Now");
    gamePadMode();
  } //Pin 12 = High --> Gamepad mode

  else if (imitationMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate Imitation Mode Now");
    imitationMode();
  } //Pin 13 = High -- > Imitation Mode

  else { // Complete the rest of the sequence

    // Move head to the center
    Terminal.println("5th position");
    rightArm_Motor1.write(15);
    rightArm_Motor2.write(150);
    rightArm_Motor3.write(30);

    leftArm_Motor1.write(180);
    leftArm_Motor2.write(30);
    leftArm_Motor3.write(145);

    neckHorizontal.write(105);
    neckVertical.write(30);

    // Set the volume
//    MusicPlayer.setVolume(10);
    MusicPlayer.play();

    for (int i = 0; i <= 19; i++) {
      mouth.write(100);
      OneSheeld.delay(150);
      mouth.write(75);
      OneSheeld.delay(150);
    }//for

    MusicPlayer.pause();
    mouth.write(100);

    OneSheeld.delay(3000);
  }//else --> complete the rest of the sequence

  //----------------------------------------------------

  // Always check the desired mode
  if (gamepadMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate GamePad Mode Now");
    gamePadMode();
  } //Pin 12 = High --> Gamepad mode

  else if (imitationMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate Imitation Mode Now");
    imitationMode();
  } //Pin 13 = High -- > Imitation Mode

  else { // Complete the rest of the sequence

    // Move hands up
    Terminal.println("6th position");
    rightArm_Motor1.write(110);
    rightArm_Motor2.write(0);
    rightArm_Motor3.write(45);

    leftArm_Motor1.write(90);
    leftArm_Motor2.write(180);
    leftArm_Motor3.write(145);

    neckHorizontal.write(105);
    neckVertical.write(30);

    // Set the volume
//    MusicPlayer.setVolume(10);
    MusicPlayer.play();

    for (int i = 0; i <= 19; i++) {
      mouth.write(100);
      OneSheeld.delay(150);
      mouth.write(75);
      OneSheeld.delay(150);
    }//for

    MusicPlayer.pause();
    mouth.write(100);

    OneSheeld.delay(3000);
  }//else --> complete the rest of the sequence

  //-------------------------------------------------

  // Always check the desired mode
  if (gamepadMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate GamePad Mode Now");
    gamePadMode();
  } //Pin 12 = High --> Gamepad mode

  else if (imitationMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate Imitation Mode Now");
    imitationMode();
  } //Pin 13 = High -- > Imitation Mode

  else { // Complete the rest of the sequence

    /* Move hands to sides        o
                               -- | --
                                  ^
    */

    Terminal.println("7th position");
    rightArm_Motor1.write(110);
    rightArm_Motor2.write(80);
    rightArm_Motor3.write(60);

    leftArm_Motor1.write(90);
    leftArm_Motor2.write(115);
    leftArm_Motor3.write(140);

    neckHorizontal.write(105);
    neckVertical.write(30);

    // Set the volume
//    MusicPlayer.setVolume(10);
    MusicPlayer.play();

    for (int i = 0; i <= 19; i++) {
      mouth.write(100);
      OneSheeld.delay(150);
      mouth.write(75);
      OneSheeld.delay(150);
    }//for

    MusicPlayer.pause();
    mouth.write(100);

    OneSheeld.delay(3000);
  }//else --> complete the rest of the sequence

  //---------------------------------------------------

  // Always check the desired mode
  if (gamepadMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate GamePad Mode Now");
    gamePadMode();
  } //Pin 12 = High --> Gamepad mode

  else if (imitationMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate Imitation Mode Now");
    imitationMode();
  } //Pin 13 = High -- > Imitation Mode

  else { // Complete the rest of the sequence

    // Strike right hand
    Terminal.println("8th position");
    rightArm_Motor1.write(0);
    rightArm_Motor2.write(0);
    rightArm_Motor3.write(45);

    leftArm_Motor1.write(90);
    leftArm_Motor2.write(45);
    leftArm_Motor3.write(180);

    OneSheeld.delay(500);

    rightArm_Motor1.write(180);
    rightArm_Motor2.write(0);
    rightArm_Motor3.write(45);

    OneSheeld.delay(1000);

    rightArm_Motor1.write(95);
    rightArm_Motor2.write(150);
    rightArm_Motor3.write(20);

    neckHorizontal.write(105);
    neckVertical.write(30);

    // Set the volume
//    MusicPlayer.setVolume(10);
    MusicPlayer.play();

    for (int i = 0; i <= 19; i++) {
      mouth.write(100);
      OneSheeld.delay(150);
      mouth.write(75);
      OneSheeld.delay(150);
    }//for

    MusicPlayer.pause();
    mouth.write(100);

    OneSheeld.delay(3000);
  }//else --> complete the rest of the sequence

  //--------------------------------------------------

  // Always check the desired mode
  if (gamepadMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate GamePad Mode Now");
    gamePadMode();
  } //Pin 12 = High --> Gamepad mode

  else if (imitationMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate Imitation Mode Now");
    imitationMode();
  } //Pin 13 = High -- > Imitation Mode

  else { // Complete the rest of the sequence

    // Strike left hand
    Terminal.println("9th position");
    rightArm_Motor1.write(95);
    rightArm_Motor2.write(150);
    rightArm_Motor3.write(20);

    leftArm_Motor1.write(90);
    leftArm_Motor2.write(180);
    leftArm_Motor3.write(110);

    OneSheeld.delay(500);

    leftArm_Motor1.write(0);
    leftArm_Motor2.write(180);
    leftArm_Motor3.write(110);

    OneSheeld.delay(1000);

    leftArm_Motor1.write(90);
    leftArm_Motor2.write(45);
    leftArm_Motor3.write(180);

    neckHorizontal.write(105);
    neckVertical.write(30);

    // Set the volume
//    MusicPlayer.setVolume(10);
    MusicPlayer.play();

    for (int i = 0; i <= 19; i++) {
      mouth.write(100);
      OneSheeld.delay(150);
      mouth.write(75);
      OneSheeld.delay(150);
    }//for

    MusicPlayer.pause();
    mouth.write(100);

    OneSheeld.delay(3000);
  }//else --> complete the rest of the sequence

  //-----------------------------------------------------

  // Always check the desired mode
  if (gamepadMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate GamePad Mode Now");
    gamePadMode();
  } //Pin 12 = High --> Gamepad mode

  else if (imitationMode_Enabled == true) {
    Terminal.println("System Was Interrupted And It Will Activate Imitation Mode Now");
    imitationMode();
  } //Pin 13 = High -- > Imitation Mode

  else { // Complete the rest of the sequence

    // Play Music Player and move the robot's mouth
    Terminal.println("Return to the home position");
    rightArm_Motor1.write(95);
    rightArm_Motor2.write(150);
    rightArm_Motor3.write(20);

    leftArm_Motor1.write(90);
    leftArm_Motor2.write(45);
    leftArm_Motor3.write(180);

    neckHorizontal.write(105);
    neckVertical.write(30);

    // Set the volume
//    MusicPlayer.setVolume(10);

    MusicPlayer.play();

    for (int i = 0; i <= 49; i++) {
      mouth.write(100);
      OneSheeld.delay(150);
      mouth.write(75);
      OneSheeld.delay(150);
    }//for

    MusicPlayer.pause();
    mouth.write(100);

    Terminal.println("Done");
  }//else --> complete the rest of the sequence

}// void standby mode

//----------------------------------------- void Gamepad Mode ---------------------------------------------

void gamePadMode() {

  Terminal.println("Gamepad mode activated");

  // Always check the status of gamepad buttons
  if (GamePad.isUpPressed())
  { // Move both hands up
    Terminal.println("Up is pressed");

    rightArm_Motor1.write(110);
    rightArm_Motor2.write(0);
    rightArm_Motor3.write(45);

    leftArm_Motor1.write(90);
    leftArm_Motor2.write(180);
    leftArm_Motor3.write(145);

    neckHorizontal.write(105);
    neckVertical.write(30);

    mouth.write(100);
  }//Up is pressed

  if (GamePad.isDownPressed())
  { // Move both hands up
    Terminal.println("Down is pressed");

    rightArm_Motor1.write(110);
    rightArm_Motor2.write(170);
    rightArm_Motor3.write(45);

    leftArm_Motor1.write(90);
    leftArm_Motor2.write(20);
    leftArm_Motor3.write(145);

    neckHorizontal.write(105);
    neckVertical.write(30);

    mouth.write(100);
  }//Down is pressed

  if (GamePad.isRightPressed())
  { // Move right hand side
    Terminal.println("Right is pressed");

    rightArm_Motor1.write(110);
    rightArm_Motor2.write(80);
    rightArm_Motor3.write(60);

    leftArm_Motor1.write(90);
    leftArm_Motor2.write(20);
    leftArm_Motor3.write(145);

    neckHorizontal.write(105);
    neckVertical.write(30);

    mouth.write(100);
  }//Right is pressed

  if (GamePad.isLeftPressed())
  { // Move left hand side
    Terminal.println("Left is pressed");

    rightArm_Motor1.write(110);
    rightArm_Motor2.write(170);
    rightArm_Motor3.write(45);

    leftArm_Motor1.write(90);
    leftArm_Motor2.write(115);
    leftArm_Motor3.write(140);

    neckHorizontal.write(105);
    neckVertical.write(30);

    mouth.write(100);
  }//Left is pressed



  if (GamePad.isRedPressed())
  { // Combo 1
    Terminal.println("Red is pressed");

    rightArm_Motor1.write(180);
    rightArm_Motor2.write(45);
    rightArm_Motor3.write(100);

    leftArm_Motor1.write(90);
    leftArm_Motor2.write(180);
    leftArm_Motor3.write(110);

    neckHorizontal.write(105);
    neckVertical.write(30);

    mouth.write(100);
  }//Red is pressed

  if (GamePad.isOrangePressed())
  { // Combo 2
    Terminal.println("Orange is pressed");

    rightArm_Motor1.write(15);
    rightArm_Motor2.write(100);
    rightArm_Motor3.write(0);

    leftArm_Motor1.write(180);
    leftArm_Motor2.write(100);
    leftArm_Motor3.write(180);

    neckHorizontal.write(105);
    neckVertical.write(30);

    mouth.write(100);
  }//Orange is pressed

  if (GamePad.isGreenPressed())
  { // Combo 3
    Terminal.println("Green is pressed");

    rightArm_Motor1.write(95);
    rightArm_Motor2.write(45);
    rightArm_Motor3.write(120);

    leftArm_Motor1.write(90);
    leftArm_Motor2.write(135);
    leftArm_Motor3.write(60);

    neckHorizontal.write(105);
    neckVertical.write(10);

    mouth.write(100);
  }//Green is pressed

  if (GamePad.isBluePressed())
  { // Combo 4
    Terminal.println("Blue is pressed");

    rightArm_Motor1.write(90);
    rightArm_Motor2.write(0);
    rightArm_Motor3.write(90);

    leftArm_Motor1.write(180);
    leftArm_Motor2.write(45);
    leftArm_Motor3.write(180);

    neckHorizontal.write(105);
    neckVertical.write(30);

    mouth.write(100);
  }//Blue is pressed

}// Gamepad mode


//----------------------------------------- void Imitation Mode -------------------------------------------

void imitationMode() {
  // Imitation mode
  Terminal.println("Imitation mode activated");

  if (OrientationSensor.getY() > -90 && OrientationSensor.getY() <= 90) {
    leftArm_Motor1.write(map(OrientationSensor.getY(), -90, 90, 0, 180));
  }

  if (OrientationSensor.getZ() > -70 &&  abs(OrientationSensor.getZ()) <= 70) {
    leftArm_Motor2.write(map(OrientationSensor.getZ(), 0, 60, 100, 160));
    leftArm_Motor3.write(map(OrientationSensor.getZ(), 0, 60, 160, 100));
  }

}// void imitation mode

//-----------------------------------------------------------------------------------------------------------
//-------------------------------------------- Modes ISR ----------------------------------------------------
//-----------------------------------------------------------------------------------------------------------

void gampadMode_ChangeISR() {
  if (gamepadMode_Enabled && !imitationMode_Enabled) {
    gamepadMode_Enabled = false;
    imitationMode_Enabled = false;
  }
  else {
    gamepadMode_Enabled = true;
    imitationMode_Enabled = false;
  }

}//gampadMode_ChangeISR

//------------------------------------------------------------------------------------------------------------

void imitationMode_ChangeISR() {
  if (imitationMode_Enabled && !gamepadMode_Enabled) {
    gamepadMode_Enabled = false;
    imitationMode_Enabled = false;
  }
  else {
    gamepadMode_Enabled = false;
    imitationMode_Enabled = true;
  }
}//imitationMode_ChangeISR

Schematics

Sauron Fritzing File
Atom%20circuit bb

Comments

Similar projects you might like

Super Easy to Build 1Sheeld 2 Wheel Drive Robot

Project tutorial by Garry Gerwer and Ahmed Hamdy

  • 16,684 views
  • 3 comments
  • 32 respects

SMS based Home Automation system using 1SHEELD

Project tutorial by Tanishq Jaiswal

  • 27,240 views
  • 11 comments
  • 63 respects

Arduino can hear and understand your voice with 1Sheeld !

Project tutorial by Alessandro Didonna

  • 2,965 views
  • 1 comment
  • 10 respects

DIY Safe using Pattern lock Shield

Project showcase by Mahmoud Ahmed

  • 2,215 views
  • 0 comments
  • 15 respects

OttoDIY Build Your Own Robot in One Hour!

Project tutorial by Camilo Parra Palacio

  • 104,203 views
  • 128 comments
  • 296 respects

Unlock your door with a knock

Project tutorial by Ashraf Nabil

  • 22,827 views
  • 12 comments
  • 60 respects
Add projectSign up / Login