12. Mechanical Design, Machine Design

This week, I worked on was making a PCB.

Group Task:

Group task

List of components:

Quantity Component Value / Model Description
1MicrocontrollerXIAO ESP32-s3Main microcontroller
2Motor driverA4988Stepper motor driver
1Voltage regulatorL78055V voltage converter
2Electrolytic capacitor100 µFPower filtering
1Electrolytic capacitor10 µFRegulator input capacitor
1Electrolytic capacitor22 µFRegulator output capacitor
2Resistor1 kΩPull-down for endstops
3ConnectorHeaderMotor outputs
1ConnectorHeaderBuzzer
2ConnectorHeaderEndstop inputs
1ConnectorHeaderZ-axis servo
2ConnectorHeaderEndstops 1 and 2
1ConnectorHeaderOLED display
1ConnectorHeaderExtra pin
1ConnectorHeaderCommon GND

schematic

  • First, I made the schematic.
image-machine image-machine

Traces

image-machine image-machine image-machine image-machine

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

image-machine

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.

image-machine image-machine image-machine image-machine image-machine

Soldering

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

image-machine image-machine

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

image-machine image-machine image-machine image-machine image-machine image-machine image-machine

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.

image-machine image-machine image-machine image-machine image-machine

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.

Get in touch

Follow