12. Mechanical Design, Machine Design
This week, I worked on was making a PCB.
Group Task:
Group taskList of components:
Quantity | Component | Value / Model | Description |
---|---|---|---|
1 | Microcontroller | XIAO ESP32-s3 | Main microcontroller |
2 | Motor driver | A4988 | Stepper motor driver |
1 | Voltage regulator | L7805 | 5V voltage converter |
2 | Electrolytic capacitor | 100 µF | Power filtering |
1 | Electrolytic capacitor | 10 µF | Regulator input capacitor |
1 | Electrolytic capacitor | 22 µF | Regulator output capacitor |
2 | Resistor | 1 kΩ | Pull-down for endstops |
3 | Connector | Header | Motor outputs |
1 | Connector | Header | Buzzer |
2 | Connector | Header | Endstop inputs |
1 | Connector | Header | Z-axis servo |
2 | Connector | Header | Endstops 1 and 2 |
1 | Connector | Header | OLED display |
1 | Connector | Header | Extra pin |
1 | Connector | Header | Common GND |
schematic
- First, I made the schematic.


Traces




In the PCB, I marked the bridges that I used to connect the components. To make these bridges, I used 0-ohm resistors.

Using the MonoFab
First, I drilled the holes, engraved the PCB, and cut the contour. To see the specifications, you can check my Electronics Production task.





Soldering
First ,I soldered the resistors like a bridges and then the other components.


Time to do the tests
I was nervous because I didn’t know how the PCB would react, so I started by moving a servo. Then, I moved the motors.
This is the code for the stepper motors:
#define STEP1 6
#define DIR1 7
#define STEP2 8
#define DIR2 9
void setup() {
pinMode(STEP1, OUTPUT);
pinMode(DIR1, OUTPUT);
pinMode(STEP2, OUTPUT);
pinMode(DIR2, OUTPUT);
}
void loop() {
// Motor 1 - Una vuelta completa (400 pasos en 1/2 paso)
digitalWrite(DIR1, HIGH);
for (int i = 0; i < 400; i++) {
digitalWrite(STEP1, HIGH);
delayMicroseconds(800);
digitalWrite(STEP1, LOW);
delayMicroseconds(800);
}
delay(1000);
// Motor 2 - Una vuelta completa (400 pasos en 1/2 paso)
digitalWrite(DIR2, LOW);
for (int i = 0; i < 400; i++) {
digitalWrite(STEP2, HIGH);
delayMicroseconds(800);
digitalWrite(STEP2, LOW);
delayMicroseconds(800);
}
delay(2000);
}
Some Complications with the final code
- Most boards have a switch to choose whether they are powered by an external source or by USB, in case both are connected at the same time. But the XIAO doesn't have one, so what happened was that we powered the XIAO with both the external source and the computer, and the XIAO burned out.
- However, the rest of the board was intact, so we had to solder a new XIAO. We also cut the 5V power line from the external source to the XIAO and only kept the power from the computer to avoid voltage issues.
Making a Case for My PCB and the Power Supply







Finally, to mount the LCD, I made a 3D piece. To secure the board to the case, I made screws. I used a Prusa printer.





Files
Conclusion🛸🛸
It was a challenge to understand how a CNC works, including each of its parts and the electronic components that make it work. As a team, we also learned things we didn't know about, like the problem with the XIAO, which will be useful in future projects.