Final Project

Inspiration

I really liked the boston dynamics robot dog and I ever the genius think I can make a smaller verison of it. I also have a really fast dog and I want to understand why she is so fast.

For an overall base of what Im going to build this robot off I found this pervious Fab Final Project which was of a more spiderlike robot

Sketch

This week I worked on defining my final project idea and started to getting used to the documentation process. My final project is based off my dog on the front page. She is very fast. So fast that I cant keep up with her, but I wanted to see if I could build something to compete with her. The idea for the project is a robot similar to the boston dynamics dog that uses servos to move its limbs.

This is a rough draft of what I think it will look like

This is just an AI generated design to give a better perscpetive becuase I not a good artist

Midterm Review

As a part of the midterm, I planed out the rest of the stuff I needed to do for the final and put together my bill of materials for it.

Bill of Materials

Item # Component Description Quantity Where to Buy
1 Double-Sided Copper PCB Blank PCB for custom milling 1 Adafruit
2 Servo Motor (SG90) Micro servos 5 Amazon
3 ESP32-S3 Microcontroller Main controller board 1 Seeed Studio
4 PLA Filament 3D printing material 1 spool Polymaker on Amazon
5 5V 5A Power Supply DC power adapter 1 Amazon

Gantt Chart

Planing

For this to project to work I went through several design options, the first idea was to make it a remote control dog using a web server as the controller the next was to try and put ai in it to act like a dog you could interact with through a touch sensor, what I landed on though was making simple versions of both that could be swapped out. This way I could do both versions of the dog I wanted to do, without having to make two models. To acomplish this, I used an esp32s3 for the autonoumus/controlable mode where the only thing the person would need to do is upload a diffrent code to swithc between modes. Once I had this idea in mind, I figured out what my biggest issues were. These issues summed up into one category was legs. This included making them, moving them and probably the biggest challenge balance.

Weekly Assignments

2D and 3D Modeling

Electronic Production

Heres what the two sides looked like in Bantam

This is the parts I put into my F cuts, I left the outline out since when I did try to put the edge cuts on the outline, the tracks went over the edge cuts

PCB and Rivets

Heres what my board looks like on the front and back

Heres the machine I used to have current flow to the bottom of the board. I used rivets which were in the holes that I had through hole drilled.

These rivets are really small, so I used tweezers to put them into the holes

Interface

Learing about interfaces

I have already had previous experience using the esp32 web servers since I had used one for a porject in school a few months prior. Heres a link to that experiance. Because of that, I was able to make an interface quickly for controlling a servo. I used my output board to test out my interface.

I decided to make another web server on httml using the esp32c3 on my output board. Heres what the board looked like for refrence:

Heres what the interface looks like:

Code

#include <WiFi.h>
#include <ESP32Servo.h>

const char* ssid = "YOUR_SSID";
const char* password = "YOUR_PASSWORD";

Servo myServo;
const int servoPin = 3;  // Servo on GPIO 3
WiFiServer server(80);

void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);

    while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.println("Connecting to WiFi...");
}

Serial.print("Connected. IP: ");
Serial.println(WiFi.localIP());

myServo.setPeriodHertz(50);  // Standard 50Hz servo
myServo.attach(servoPin, 500, 2400);  // Calibrate for your servo
myServo.write(90);  // Start centered

server.begin();
}

void wagTail() {
for (int i = 0; i < 2; i++) {
myServo.write(60);  // Move to one side
delay(200);
myServo.write(120);  // Move to the other side
delay(200);
}
myServo.write(90);  // Return to center
}

void loop() {
WiFiClient client = server.available();
if (client) {
String req = client.readStringUntil('\r');
client.flush();

if (req.indexOf("angle=") != -1) {
  int angleIndex = req.indexOf("angle=") + 6;
  int angle = req.substring(angleIndex).toInt();
  angle = constrain(angle, 0, 180);
  myServo.write(angle);  // Move servo to mapped angle
}

if (req.indexOf("/wag") != -1) {
  wagTail();
}

String html = R"rawliteral(
  <html><head>
  <style>
    body { text-align: center; font-family: sans-serif; }
    #joystick {
      width: 200px; height: 200px;
      border: 2px solid #555;
      border-radius: 50%;
      margin: 30px auto;
      position: relative;
      touch-action: none;
    }
    #stick {
      width: 50px; height: 50px;
      background: #2196F3;
      border-radius: 50%;
      position: absolute;
      top: 75px; left: 75px;
      touch-action: none;
      cursor: pointer;
    }
    button {
      padding: 10px 20px;
      font-size: 16px;
      margin-top: 20px;
    }
  </style>
  </head><body>
    <h2>ESP32-C3 Servo Joystick</h2>
    <div id="joystick"><div id="stick"></div></div>
    <button onclick="fetch('/wag')">🐶 Wag Tail</button>

    <script>
      const joystick = document.getElementById("joystick");
      const stick = document.getElementById("stick");
      const radius = 100;
      const center = { x: radius, y: radius };
      let dragging = false;

      function updateStick(clientX, clientY) {
        const rect = joystick.getBoundingClientRect();
        const dx = clientX - rect.left - center.x;
        const dy = clientY - rect.top - center.y;
        const dist = Math.min(Math.sqrt(dx * dx + dy * dy), radius - 25);
        const angleRad = Math.atan2(dy, dx);
        const angle360 = (angleRad * 180 / Math.PI + 360) % 360;
        const mapped = Math.round(angle360 / 2);  // 360° → 180°
        fetch("/?angle=" + mapped);

        const x = center.x + dist * Math.cos(angleRad) - 25;
        const y = center.y + dist * Math.sin(angleRad) - 25;
        stick.style.left = `${x}px`;
        stick.style.top = `${y}px`;
      }

      function resetStick() {
        stick.style.left = "75px";
        stick.style.top = "75px";
        fetch("/?angle=90");
      }

      // Mouse
      stick.addEventListener("mousedown", e => { dragging = true; e.preventDefault(); });
      document.addEventListener("mousemove", e => { if (dragging) updateStick(e.clientX, e.clientY); });
      document.addEventListener("mouseup", () => { if (dragging) { dragging = false; resetStick(); } });

      // Touch
      stick.addEventListener("touchstart", e => { dragging = true; e.preventDefault(); });
      document.addEventListener("touchmove", e => { if (dragging) updateStick(e.touches[0].clientX, e.touches[0].clientY); });
      document.addEventListener("touchend", () => { if (dragging) { dragging = false; resetStick(); } });
    </script>
  </body></html>
)rawliteral";

client.print("HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n");
client.print(html);
client.stop();
}
}

Video

Test with Simple Code

Final Code Test

System Intergration

Dog Body Design

I used Fusion 360 to design my body since I wanted to laser cut test the body and the parameter button would allow me to use the same design for different material. The first model is very simple, it has 5 holes: two on each long side for the legs and then one in the back for the tail. Besides that everything else is part of my press fit design. I made it about the size of a portable charger since thats how Im currently trying to power my electronics and then about double the width of a portable charger to try and account for the pcb. Heres the fusion design:

And heres the first test cut in cardboard:

After seeing how poorly that came out I decided to switch over to a 3D printed. I used calipers to measure the board and its componets to make a 3 part body. The middle would be where all the electronics would be located. I have places for the servo wires to run where they will end up at a open up part of the body for the servo to move. The top part is the cover for the electronics, it covers up all the running wires and PCB, while also having a jetted out slot for the step responce touch point. The bottom part of the body is the holder for the portable charger thats powering the servos and board. Heres the current design I have:

And heres the pieces printed out:

Board Design

This week I also worked on designing my board for the final project. I took what I learned from Output and Machine Week to make the board. It has 4 pinheaders that are 3x1 for the legs and another 3x1 for the tail servo. I also have two pinheaders that are 2x1. One is for the external power supply and the other is for the rx and tx pinouts for the step responce. Finally I have the ESP32C3 as my microcontroller as it gives easy access to a web server and I have been using them for all the weeks up to now.

Heres the schematic view:

Heres the PCB Design

PCB

For my final project I knew that the board needed to be double sided, the issue was that the fab lab had gone through all the double sided pcbs during machine week. My solution was simple, I took a single sided pcb and milled both sides of the board as two different pieces. This meant they were the same size and had the holes in the same place. Once they were both milled this is what they looked like side by side:

After looking at them and test lining them up I was able to see through both holes to the other side. Once that was acomplished, I used hot glue to press the boards together. Afterwards, I soldered a wire through the holes so that the boards were connected. Finally I soldered on the pinheaders for all my external electronics. This is what both sides looked like:

Now that the board was finished I was able to plug in all my servos into the board and the once very messy breadboard filled with wires became this:

Heres a wide view of the servos connected to the board:

I made a new design with large holes in vacant areas of the board for screws so the board is locked into the body of the dog. Heres what the new design looks like:

Final Project Requeirements

What does it do?

Its a quadroped robot that is controled using a web server that can be interacted with through a copper board that has step responce imbeded into it

Who’s done what beforehand?

This Fab Final Project by Karam Kharis is similar to mine but he made his more spiderlike as his final product

What did you design?

I desgined a pcb where the ESP32C3 would send signals to the servos, the leg attachment on the servos and the body that all of the electornics are put in. The PCB was designed in KiCAD and the Body and Leg were designed in Fusion360

What sources did you use?

What materials and components were used?

I used a double sided PCB, Bambu PLA and Servos for a majority of the project

Where did they come from?

The PLA came from the Bambu Website, the servos came from _ and the Double Sided PCB came from _

How much did they cost?

The project curretly will cost $46.44 dollars. This acounts for the board, microcontroller, servos, and power trigger. Since I’m using PLA and Wood thats at the Lab in a unique amount, I dont know how to add that to the cost

What parts and systems were made?

What processes were used?

I have milled to make the board, an interface to control the robot, addatice manufacuting to make the body and legs along with 3D design to create them.

What questions were answered?

What worked? What didn’t?

How was it evaluated?

What are the implications?