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 wanted to try out processing origanlly to try and learn something new but when I tried to download it this popped up:
Because of that 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:
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