Introduction: Wall-E Arduino Audio Project

This instructable was created in fulfillment of the project

requirement of the Makecourse at the University of South Florida (www.makecourse.com)

This instructable will cover the necessary steps in order to create my Wall-E project. My Wall-E project only performs two actions: turning its head and making sounds. Due to this, it is a very simple Arduino project that people of all ages can enjoy. All the files necessary for this project will be in the instructable. This includes the code, STLs, SD card formatting software, TMRpcm library, and audio files.

Step 1: Tools & Equipment

Hardware:

· Arduino Uno (Any other Arduino except Duo will work)

· Micro-SD card adapter

· 8-ohm speaker

· Micro-SD Card

· Mini Breadboard

· 1M Ohm Resistor

· Male-to-male jumpers

· IR Sensor

· IR remote

· 9V battery

· Servo

Software:

· Arduino IDE (Latest version is recommended).

· SD Association’s SD Formatter tool.

· TMRpcm library

· IR remote library

Tools:

· 3-D printer

· Solidworks or Inventor

· Hot glue gun

· Aux cord

· Arduino Cord

· Acrylic paint or Spray paint

· Sandpaper

Step 2: 3-D Printed Parts and Assembly

Every part of Wall-E’s exterior is 3-D printed. This model

is composed of a two-piece head, two small wheels, two large wheels, a wheel base, two fitted doors, neck rod, four nuts, two arms, and a body. The STLs for this project will be linked below.

The assembly procedure is fairly straight forward. The order of parts can be figured out by looking at the exploded view image above. I attached the wheel base to the body of the robot using a hot glue gun. I also hot glued the nuts to the wheel base to prevent the wheels from slipping off. The neck rod was also hot glue to the tip of the servo (there is pocket in the design to support a servo exactly under the neck rod).

For aesthetics, I did two coats of acrylic paint. Spray paint could also accomplish the same design.

Note: Due to some tolerance variances, some pieces may need to be sanded down. I had this issue with the neck rod and the fitted doors.

Step 3: Hardware

Here is a basic break down of the wiring and electrical

components involved in this project. The controlled is powered by a 9V battery. Signals are sent from the IR remote to the IR sensor, and then the Arduino receives these signals and makes commands based on the information received. There are 3 commands that can be made for this project. The first command is to rotate the servo to 60 degrees and back to it’s original position. The other commands are making the speaker play a track (specifically “WALLE_1.wav” and “Whoa.wav”).

There are two ways to connect the jumper wires to the speaker wires. You can either break down the speaker wires or use an aux cord. If the speaker wires are broken down, the jumper connected to ground must connect to the speaker ground wire. The jumper connected to pin 9 should also be connected to the positive speaker wire. (This is all assuming the speaker has positive and ground wires).

If you are using an aux cord, the jumpers must be placed in specific positions on the aux head. The pin 9 jumper needs to on top of the ring closest to the base, while the ground jumper needs to be on top of the aux tip. To keep these wires in place, I used a hot glue gun. A soldering iron would work just as well.

These are the exact pins used for this project:

SD Card Adapter

· GND---ground

· VCC---5V

· MISO---12

· MOSI---11

· SCK---13

· CS---10

IR output pin---4

Servo pin---7

Speaker pin---9 (must use pin 9; it is included in library)

Step 4: Prepare SD Card

The SD card must be prepared with an installer to be used

for this project. The file for this application is linked below. Connect your SD card to the PC, and open the SD formatter. Once the application is opened, select the drive of the SD card then click on format. Once the process is finished, you can your audio files to the drive. These are also linked below.

Step 5: Add Library to Arduino

The TMRpcm library must be used to connect to the speaker.

Download the file below. Once the download is complete, open the Arduino software. Click in the order of Sketch >> Include Library >> Add zip Library. Select "TMRpcm.zip" that is in zip folder, and now the library can be accessed for this project.

Step 6: Code

The code for this project includes the Servo library,

IRremote library, and TMRpcm library.

/*
*Final code for Wall-E robot. *Created by Melanise Gadsden. December 5, 2017. ************** * Lets get started: The IR sensor's pins are attached to Arduino as so: Pin 1 to Vout (pin 4 on Arduino) Pin 2 to GND Pin 3 to Vcc (+5v from Arduino) Button 1 = 2962 Button 2 = 527250 Button 3 = 265106 Right Button = 256914 Left Button = 912274 *

********************* CODE BEGINS HERE *************************/

#include 
#include #include
#include "SD.h"
#include "TMRpcm.h"
#include "SPI.h"
#define SD_ChipSelectPin 10 // define CS pin
int IRpin = 4; // Signal Pin of IR receiver to Arduino Digital Pin 4
int ServoPin = 7; // Pin used for Servo control lead
int myposition = 0;    // variable to store the servo position 
byte position = 90; // range 0-180
IRrecv irrecv(IRpin); // create instance of 'irrecv'
decode_results results; // create instance of 'decode_results'
Servo myservo;  // instantiate a Servo object named 'myservo' 
TMRpcm tmrpcm; // create an object for speaker library
void setup()
{
  tmrpcm.speakerPin=9; //define speaker pin. 
                       //you must use pin 9 of the Arduino Uno and Nano
                       //the library is using this pin
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  myservo.attach(ServoPin);  // attaches the servo on pin 13 to the servo object
  if(!SD.begin(SD_ChipSelectPin)) // see if the card is present and can be initialized
{
  Serial.println("SD fail"); // returned failed if there is an error
  return;
}
tmrpcm.setVolume(6); // 0 to 7. Set volume level
}
void loop()
{
  
  
if (irrecv.decode(&results)) // have we received an IR signal?
  {
    switch(results.value)
    {
      case 2962: // button 1 pressed
                tmrpcm.play("WALLE_1.wav"); // sound will play each time button is pressed
                delay(5000); 
                break;
                
      case 527250: // button 2 pressed
                Serial.println(results.value, DEC); // Print the Serial 'results.value'
                myposition = 60;
                myservo.write(60); // servo moves to range of motion (60 degrees)
                delay(1000); 
                myposition = -60;
                myservo.write(-60); // servo moves to range of motion (60 degrees)
                delay(1000);
                break;
                
      case 265106: // button 3 pressed
                tmrpcm.play("Whoa.wav"); // sound will play each time button is pressed
                delay(5000); 
                break;
                
      
    }
     irrecv.resume(); // receive the next value
  }
} //******* end main loop **********

Note: Any IR remote can be used for this project. However, the command values for this code will not match with your remote. You need to find the values for the buttons on your IR remote control, and use those values in the code.

Step 7: Final Product

Once all the pieces and hardware is connected, you should

have a fully functional talking robot. Happy making!