Wall-E

In this tutorial we will teach you how to build a life-sized fully functional Wall-e prototype

IntermediateFull instructions provided18,653
Wall-E

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×2
1Sheeld
1Sheeld
×1
Aluminum Rods
×1
acrylic sheets
sheet (40*60)cm
×1
artelon
×1
timing belt
×1
DC motor (generic)
*2 for arm
×1
DC motor with warm gear
*2 for legs
×1
Servos (Tower Pro MG996R)
×1
Coating for legs
×1
pop rivets (generic)
×1
bearing
×1
Spray Paint (generic)
×1

Hand tools and fabrication machines

Pop riveter
Fume
(100*100) sheets
lockers

Story

Read more

Custom parts and enclosures

Mechanical components

estimated prices in EGP

Schematics

1shield and motors

a simple diagram on how to control motors using 1shield

bluetooth and motors

in this diagram showing the circuit of hc05 bluetooth module and motors connection

SD card and wall-e sound

using sd card to play wav audio files of wall-e

Code

Legs

Arduino
this code is for legs part and voice recognition
/*this code for Wall-E movements(legs)and talking with Wall-E.
 * 1Shield is our main controller with Arduino in our project, therfore there is a prif about it:
 * 1Shield is multi sheelds, you can connect it with your phone throw bluetooth and then you can access all your mobile sensors. 
     All you need the shield, library for programming and you can download it from thier website(http://1sheeld.com/) and the phone app you can download it from the play store.
     If you opened the 1Shield app on your phone, you'll see the shields that you can use.
     We are going to mention some of the shield we uesd.
     
 movements:
   we used gamepad shield from 1shield shields for movements control, it's like joy-stick except that it is on your phone.

 Talking with Wall-E:
   For talking with Wall-E there is two things, first how could Wall-E hear and understand our voices and how he would reply on us!!
   We used voice recognizer shield from 1Shield shields, we are going to explain how did we use it in the code.
   For replying, we used SD module for plying spicific voices that Wall-E was saying in the movie.


Created on 22/02/2017
by Makers team in pixels.
 */

//first you need to include 1Shield library and define the shields you are going to use, you can know more about this from 1shield examples.
#define CUSTOM_SETTINGS
#define INCLUDE_GAMEPAD_SHIELD
#define INCLUDE_VOICE_RECOGNIZER_SHIELD
#define INCLUDE_TERMINAL_SHIELD
#include <OneSheeld.h> 

//include SD library and music library.
#include <SPI.h>
#include <SD.h>
#include <TMRpcm.h>

/*for voice recognizer shield you need to define the word or the sentence that you want Wall-E to understand it.*/
//wall-e sentence (you can put any sentence or word you want).
const char NameOne[] = "name";
const char NameTwo[] = "what's your name";
const char NameThree[]= "tell me your name";

//eva sentence.
const char EvaOne[] = "what's her name";
const char EvaTwo[] = "eva";
const char EvaThree[] = "do you have a friend";
//song sentence.
const char SongCommand[] = "song";

/* The circuit for SD Module:
  * SD card attached to SPI bus as follows:
 ** MOSI - pin 11 on Arduino Uno/Duemilanove/Diecimila
 ** MISO - pin 12 on Arduino Uno/Duemilanove/Diecimila
 ** CLK - pin 13 on Arduino Uno/Duemilanove/Diecimila
 ** CS - depends on your SD card shield or module.
     Pin 4 or 3 used here for consistency with other Arduino examples*/
const int chipSelect = 3;

//define the music pin.
TMRpcm tmrpcm;

//define the Relays pin on Arduino.
#define MOTOR1_RELAY1 4
#define MOTOR1_RELAY2 5
#define MOTOR2_RELAY1 6
#define MOTOR2_RELAY2 7

//movement function.

//Stop moving.
void Stop() {
  digitalWrite( MOTOR1_RELAY1, HIGH);
  digitalWrite( MOTOR1_RELAY2, HIGH);
  digitalWrite( MOTOR2_RELAY1, HIGH);
  digitalWrite( MOTOR2_RELAY2, HIGH);}
  
// Move forward.
void forward () {
   digitalWrite( MOTOR1_RELAY1, HIGH);
   digitalWrite( MOTOR1_RELAY2, LOW);
   digitalWrite( MOTOR2_RELAY1, HIGH);
   digitalWrite( MOTOR2_RELAY2, LOW);}

//Move backward.
void backward() {
   digitalWrite( MOTOR1_RELAY1, LOW);
   digitalWrite( MOTOR1_RELAY2, HIGH);
   digitalWrite( MOTOR2_RELAY1, LOW);
   digitalWrite( MOTOR2_RELAY2, HIGH);}

//Move right.
void moveRight() {
   digitalWrite( MOTOR1_RELAY1,HIGH);
   digitalWrite( MOTOR1_RELAY2,LOW);
   digitalWrite( MOTOR2_RELAY1,LOW);
   digitalWrite( MOTOR2_RELAY2,HIGH);}

//Move left
void moveLeft() {
   digitalWrite( MOTOR1_RELAY1, LOW);
   digitalWrite( MOTOR1_RELAY2, HIGH);
   digitalWrite( MOTOR2_RELAY1, HIGH);
   digitalWrite( MOTOR2_RELAY2, LOW);}
   
void setup() {
  //begine 1Shield.
  OneSheeld.begin();
  VoiceRecognition.start();
  //define the Relays pin as output pin by for loop for reducing the code.
  for (int i = 4 ; i < 8 ; i++) {
    pinMode(i, OUTPUT); 
    digitalWrite(i,LOW);}
  //define the speaker pin you should put it on pwm pin.
  tmrpcm.speakerPin = 9;
  //the next steps are just for making sure that the SD card is ready and initialized.
  Serial.begin(115200);
  Serial.print("\nInitializing SD card...");
 
  if (!SD.begin(chipSelect)) {
    Serial.println("initialization failed. Things to check:");
    Serial.println("* is a card is inserted?");
    Serial.println("* Is your wiring correct?");
    Serial.println("* did you change the chipSelect pin to match your shield or module?");} 
  else {
     Serial.println("card initialized.");}
     tmrpcm.play("s.wav");
     Serial.print("f");}

void loop() {
 //starting the voice recognizer shield to receive commands.
 if(VoiceRecognition.isNewCommandReceived())
  //making comparing between the sentence you saved and the commands Arduino will receive from 1Shield.
  {if(!strcmp(NameOne,VoiceRecognition.getLastCommand())|| !strcmp(NameTwo,VoiceRecognition.getLastCommand())|| !strcmp(NameThree,VoiceRecognition.getLastCommand())){
      tmrpcm.play("Wall16.wav");}
   
    else if (!strcmp(EvaOne,VoiceRecognition.getLastCommand())||!strcmp(EvaTwo,VoiceRecognition.getLastCommand())||!strcmp(EvaThree,VoiceRecognition.getLastCommand()))
      {tmrpcm.play("eva1.wav");}
    
    else if (!strcmp(SongCommand,VoiceRecognition.getLastCommand())){
      tmrpcm.play("s.wav");}}

//moving orders using gamepad.
if(GamePad.isUpPressed())
  {forward();}
if(GamePad.isDownPressed())
  {backward();}
 if(GamePad.isLeftPressed())
  {moveLeft();}
if(GamePad.isRightPressed())
  {moveRight();}
if (GamePad.isRedPressed())
  {Stop();}}

Hand

Arduino
Arm movement
/*This code for Wall-E's arm movment.
   We used bluetooth module to control it by the mobile application on phone.
   Bluetooth module are connecting with the arduino throw serial communication.
   You can download any bluetooth app from play store.
   * Receives from the hardware serial(Bluetooth module), sends to software serial(Arduino).
   * Receives from software serial(Arduino), sends to hardware serial(Bluetooth module).


Created on 22/02/2017
by Makers team in pixels. 
*/

//include bluetooth library.
#include<SoftwareSerial.h>

//define the Relays pin on Arduino.
#define MOTORright_RELAY1 A1
#define MOTORright_RELAY2 A2
#define MOTORleft_RELAY1 A3
#define MOTORleft_RELAY2 A4

/* The circuit:
 * RX is digital pin 3 (connect to TX of bluetooth module).
 * TX is digital pin 5 (connect to RX of bluetooth module). */ 
SoftwareSerial HC05(3,5);// RX, TX
/* Firstly you should get the numbers for each button you are going to use in your mobile app, that TX is sending from bluetooth module to RX of Arduino.
 *  You can get the numbers from the SoftwareSerial example.
 *  Then you need to save it as int, therefore you need to define a int value.
*/
int x;


//movement function.
/* For moving the arms up and down, we used two buttons for each arm movement.
  * For moving right arm up we used upright, and For moving right arm down we used downright.
  * For moving left arm up we used upleft, and For moving left arm down we used downleft.
*/

//Stop moving.
void Stop() {
 digitalWrite(MOTORright_RELAY1, HIGH);
 digitalWrite(MOTORright_RELAY2, HIGH);
 digitalWrite(MOTORleft_RELAY1, HIGH);
 digitalWrite(MOTORleft_RELAY2, HIGH);}

//Move rirht arm Up.
void upright () {
  digitalWrite(MOTORright_RELAY1, LOW);
  digitalWrite(MOTORright_RELAY2, HIGH);}

//Move rirht arm Down.
void downright() {
  digitalWrite(MOTORright_RELAY1, HIGH);
  digitalWrite(MOTORright_RELAY2, LOW);}

//Move left arm Up.
void upleft () {
  digitalWrite( MOTORleft_RELAY1, LOW);
  digitalWrite( MOTORleft_RELAY2, HIGH);}

//Move left arm Down.
void downleft() {
  digitalWrite( MOTORleft_RELAY1, HIGH);
  digitalWrite( MOTORleft_RELAY2, LOW);}
  
void setup() {
  //begin he serial connection between the Arduino and Bluetooth module.
  Serial.begin(9600);
  HC05.begin(9600);

  //Define the Relays pins as Output.
  pinMode(A1, OUTPUT);
  pinMode(A2, OUTPUT);
  pinMode(A3, OUTPUT);
  pinMode(A4, OUTPUT); 
  //Define the Relays pins as High in the beginning of the code.
  digitalWrite(A1,HIGH);
  digitalWrite(A2,HIGH);
  digitalWrite(A3,HIGH);
  digitalWrite(A4,HIGH);}
  
void loop() {
  /*Start the loop code with if condition for start reading the incoming serial from the Bluetooth module throw RX on Arduino.
   * After that start checking x values and regarding for the coming number.
   */
if (HC05.available()){
   x = HC05.read();}
    if (x == 73){    
       Serial.println(x);
       upleft();}
    else if (x == 74){  
       downleft ();
       Serial.println(x);}
    else if (x == 71){  
        upright ();
        Serial.println(x);}
    else if (x == 72){  
        downright();
        Serial.println(x);}
    else if ((x != 73)||(x != 74)||(x != 72)||(x != 71)){ 
        Stop ();
        Serial.println(x);}}

Heart sensor code

Arduino
the original code from https://www.sparkfun.com/products/11574
/*
>> Pulse Sensor Amped 1.1 <<
This code is for Pulse Sensor Amped by Joel Murphy and Yury Gitman
    www.pulsesensor.com 
    >>> Pulse Sensor purple wire goes to Analog Pin 0 <<<
Pulse Sensor sample aquisition and processing happens in the background via Timer 2 interrupt. 2mS sample rate.
PWM on pins 3 and 11 will not work when using this code, because we are using Timer 2!
The following variables are automatically updated:
Signal :    int that holds the analog signal data straight from the sensor. updated every 2mS.
IBI  :      int that holds the time interval between beats. 2mS resolution.
BPM  :      int that holds the heart rate value, derived every beat, from averaging previous 10 IBI values.
QS  :       boolean that is made true whenever Pulse is found and BPM is updated. User must reset.
Pulse :     boolean that is true when a heartbeat is sensed then false in time with pin13 LED going out.

This code is designed with output serial data to Processing sketch "PulseSensorAmped_Processing-xx"
The Processing sketch is a simple data visualizer. 
All the work to find the heartbeat and determine the heartrate happens in the code below.
Pin 13 LED will blink with heartbeat.
If you want to use pin 13 for something else, adjust the interrupt handler
It will also fade an LED on pin fadePin with every beat. Put an LED and series resistor from fadePin to GND.
Check here for detailed code walkthrough:
http://pulsesensor.myshopify.com/pages/pulse-sensor-amped-arduino-v1dot1

Code Version 02 by Joel Murphy & Yury Gitman  Fall 2012
This update changes the HRV variable name to IBI, which stands for Inter-Beat Interval, for clarity.
Switched the interrupt to Timer2.  500Hz sample rate, 2mS resolution IBI value.
Fade LED pin moved to pin 5 (use of Timer2 disables PWM on pins 3 & 11).
Tidied up inefficiencies since the last version. 
*/


//  VARIABLES
int pulsePin = 0;                 // Pulse Sensor purple wire connected to analog pin 0
int blinkPin = 13;                // pin to blink led at each beat
int fadePin = 5;                  // pin to do fancy classy fading blink at each beat
int fadeRate = 0;                 // used to fade LED on with PWM on fadePin


// these variables are volatile because they are used during the interrupt service routine!
volatile int BPM;                   // used to hold the pulse rate
volatile int Signal;                // holds the incoming raw data
volatile int IBI = 600;             // holds the time between beats, the Inter-Beat Interval
volatile boolean Pulse = false;     // true when pulse wave is high, false when it's low
volatile boolean QS = false;        // becomes true when Arduoino finds a beat.


void setup(){
  pinMode(blinkPin,OUTPUT);         // pin that will blink to your heartbeat!
  pinMode(fadePin,OUTPUT);          // pin that will fade to your heartbeat!
  Serial.begin(115200);             // we agree to talk fast!
  interruptSetup();                 // sets up to read Pulse Sensor signal every 2mS 
   // UN-COMMENT THE NEXT LINE IF YOU ARE POWERING The Pulse Sensor AT LOW VOLTAGE, 
   // AND APPLY THAT VOLTAGE TO THE A-REF PIN
   //analogReference(EXTERNAL);   
}



void loop(){
  sendDataToProcessing('S', Signal);     // send Processing the raw Pulse Sensor data
  if (QS == true){                       // Quantified Self flag is true when arduino finds a heartbeat
        fadeRate = 255;                  // Set 'fadeRate' Variable to 255 to fade LED with pulse
        sendDataToProcessing('B',BPM);   // send heart rate with a 'B' prefix
        sendDataToProcessing('Q',IBI);   // send time between beats with a 'Q' prefix
        QS = false;                      // reset the Quantified Self flag for next time    
     }
  
  ledFadeToBeat();
  
  delay(20);                             //  take a break
}


void ledFadeToBeat(){
    fadeRate -= 15;                         //  set LED fade value
    fadeRate = constrain(fadeRate,0,255);   //  keep LED fade value from going into negative numbers!
    analogWrite(fadePin,fadeRate);          //  fade LED
  }


void sendDataToProcessing(char symbol, int data ){
    Serial.print(symbol);                // symbol prefix tells Processing what type of data is coming
    Serial.println(data);                // the data to send culminating in a carriage return
  }

Credits

PixelsTeam

PixelsTeam

1 project • 8 followers
Ahmed Hermas

Ahmed Hermas

1 project • 6 followers
Marwa Hany

Marwa Hany

1 project • 5 followers
Mohamed Yasser

Mohamed Yasser

1 project • 4 followers
Ahmed Elgahama

Ahmed Elgahama

1 project • 4 followers
Bio-medical engineer
Hassan Ezzat

Hassan Ezzat

1 project • 4 followers

Comments