Introduction: Bernard the Robot-Dog

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 help you recreate my Robot-Dog, as I go over all the components of my project, discuss the programming and 3-D parts.

Step 1: Components

  • 1 x Arduino Uno
  • 2 x Red LEDs
  • 1 x HC-SR04 Ultrasonic Ranging Module
  • 2 x SG90 9G Servo Motors
  • 1 x Breadboard
  • 1 x Loctite Super Glue
  • 1 x J-B WELD Kwikwood Epoxy
  • 1 x Blue Acrylic Paint
  • 1 x Black Acrylic Paint
  • 1 x Slab of Acrylic
  • 2 x 220 Ohm Resistors
  • 1 x 9V Battery
  • 2 x Servo Arms with Screws

Note: Many female and male wires. Will also need a power drill and soldering iron to solder ohm resistors with LEDs. .

Step 2: 3-D Parts

For my 3-D modeling I only used SOLIDWORKS 2016 to create my robotic-dog, and the material of my project was printed as PLA. However, as you can see from the photos, the entirety of my project was 3-D printed. The only piece that I didn't 3-D print was the back plate which is made of acrylic and was cut using a laser cutter. I also included the back plate just to protect the servo motors and LED lights found the head of the dog. Below I included the STL zip folder of all of my parts and my assembly to help you recreate this project.

It's also keen to know that for each ear I designed it so that the hub of each servo motor could fit into the ear. This is not only effective when rotating the ears, but it makes it easier to screw the hub to the shaft of the servo motor.

Step 3: Arduino Code

# include <HCSR04.h> // the library needed for the proximity sensor
# include <Servo.h> //this is the library needed to activate the servo motors

Servo Motor1;
Servo Motor2;

#define echo 8 // proximity sensor has its echo pin attached to pin 8 on the board, this sends a pulse out
#define trigger 9// pin 9 being the trigger pin triggers the proximity sensor when the pulse gets back to the sensor
#define servopin 5 // this defines the pin that connects the Servo Motor 1 with the arduino board
#define servopin2 12 // pin 12 is connected to Servo Motor 2
#define ledpin 4 // pin that both LED eyes are connected to

const int leftLow = 0; // this is the start angle of the ear and servo motor when turned on
const int rightLow = 180; // this is the beginning angle of Servo Motor 2 to have the same movement as Motor 1
const int leftHigh = 60; // the ending angle of Servo Motor 1 to avoid any damage to the structure of the ear/head
const int rightHigh = 120; // ending angle of Servo Motor when triggered

void setup() {
pinMode(4,OUTPUT); // refers to the LEDs as they light up
pinMode(8,INPUT); // pulse being sent out
pinMode(9,OUTPUT); // pulse coming back to the sensor

Motor1.attach(servopin); // defining which pin Servo Motor 1 goes to on the arduino board
Motor2.attach(servopin2); // defining which pin Servo Motor 2 goes to on the arduino board

Serial.begin(9600); // sets the data rate in bps

digitalWrite(ledpin, LOW);

Motor1.write(leftLow); //indicate which servo motor it is, so it displays the right degree in change
Motor2.write(rightLow);
}

void loop() {
digitalWrite(trigger, HIGH); //motors and leds are running
delayMicroseconds(10); //delay
digitalWrite(trigger, LOW); //motors are primed back to 0/180 deg and eyes are turned off after delay

float distance = pulseIn(echo, HIGH); //shoots pulse out
distance = distance/58; //distance in cm

if (distance < 10) {
digitalWrite(ledpin, HIGH); // led eyes on
Motor1.write(leftHigh); // Motor 1 is on and rotates to 180 degree from 0
Motor2.write(rightHigh); //Motor 2 is on and rotates to 120 degrees from 180
delay(1500);
Serial.println("hi"); // used to see if the proximity sensor is sending out a pulse and whether it detects anything
}

else {digitalWrite(ledpin, LOW); // the trigger doesn't receive a pulse as the distance > 10 cm, leds are off
Motor1.write(leftLow); // Motor 1 stays at 0 degrees
Motor2.write(rightLow); // Motor 2 stays at 180 degrees
}
}

Step 4: Control System and Electrical Schematics

Looking at my block diagram it's easy to see what roles each object has in my project. My proximity sensor is connected to my arduino board and once it's triggered by a pulse, both servo motors and LEDs turn on and function and then go back to its initial state (rest). The fritzing diagram doesn't exactly match my arduino sketch, regarding pins, but it is used to see where the power is coming from and where to connect the motors, sensors and LEDs. Both servo motors are connected to the ground/power rail and whichever pin I chose for them on the arduino board. The proximity sensor is also connected to the ground/power rail and the pins I chose for echo and trigger on the arduino board. My project was powered by a 9V battery which lasted a good amount of time. Lastly the fritzing diagram shows my two red LEDs with their resistors and how they're connected to a pin on my arduino board.

Above I've also included images of how my breadboard and arduino appeared in the final project.

Step 5: Final Assembly

The final process of putting my parts and boards together was a bit overwhelming. At first my idea of this project, was to have my dog head with two individual heads and the ears in between them perfectly spaced. However, due to a print being recalculated three different times the back of the dog head couldn't be used. With this one dog head I managed to mount two servo motors inside the heads and have them function perfectly. I also attached two LED lights to the eyes, and due to the board being quite far from the ends of the LED, I soldered the resistors to the red LEDs then soldered wires to those ends and connected them to the boards. To then protect the innards of Bernard, I then asked one of my TA's to help me laser cut some acrylic to fit over the back of my project. Another difficult step to overcome was mounting the ears onto the dog, as I had to sand each ear since they were slightly hitting the edge of the head. I then finally painted Bernard using black and dark blue acrylic paint to make his red eyes shine.

Overall, this project and course were a complete blast. I was introduced to new things such as programming and soldering, which can be extremely beneficial to me in the future. Above I uploaded photos of the final project and a video of Bernard at work!