For this week's group assignment, we explored our machine specifications and capabilities. We also tried to estimate how much it could cost to produce different PCBs.
For the individual assignment, I designed and cut a PCB so I could use it for the input and output devices weeks.
Here is a hero shot of the finished PCB:
To do my assignment, I used the Roland SRM-20, as it is the one available in our lab.
To design my PCB, I used KiCad software, which I used in the electronics design week and felt comfortable with.
Here are the steps to design the PCB:
My idea was to create an expansion board for the Xiao Seeed ESP32C3. Here are the details of the design:
After finishing the design, I exported the cutting files for the CNC machine. Here are the steps:
You can download the KiCad files and the cutting files for my PCB design: Download PCB Design Files
After exporting the cutting files, I had to prepare them for cutting on the CNC machine using the MODS website.
Here are the steps to prepare the files for cutting:
After that, I had to change some settings such as:
As you can see, this path isn't correct; it is cutting the path instead of what's around it.
To fix this issue, I had to press "invert" in "convert SVG image" block
Now recalculate and see the new simulation.
As you can see, the cutting paths are now correct and it is cutting around the traces instead of cutting the traces.
Now you can recalculate and the file will be downloaded automatically.
Redo the same steps for the other layer.
You can download the prepared files for CNC cutting: Download Prepared CNC Files
and here is the Inkscape files: Download Inkscape Files
After preparing the files, I set up the machine for cutting the PCB. Here are the steps:
To prepare the board, I had to cut it into smaller pieces that fit the machine and are easier to work with.
So I have now a flat board that make the cutting in all point equal.
Then, I started the cutting process by running the first file for the F.Cu layer.
After cutting the PCB, I soldered the components to the board. Here are the steps:
Here is the finished PCB:
Here is an example of how I can use this PCB to connect a sensor to the Xiao ESP32C3 microcontroller:
Here is the physical connection:
Here is the connection diagram using Wokwi:
Here is the code I used :
// Ultrasonic Sensor Code for Xiao Seeed ESP32-C3
#define TRIG_PIN 2
#define ECHO_PIN 3
#define LED_PIN 4
long duration;
float cm, inches;
void setup() {
Serial.begin(115200); // ESP32 usually uses higher baud
pinMode(TRIG_PIN, OUTPUT);
pinMode(ECHO_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
}
void loop() {
// Clean trigger
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(5);
// Send pulse
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
// Read echo
duration = pulseIn(ECHO_PIN, HIGH);
// Convert to distance
cm = (duration / 2.0) / 29.1;
inches = (duration / 2.0) / 74.0;
// LED control
if (cm < 18) {
digitalWrite(LED_PIN, HIGH);
} else {
digitalWrite(LED_PIN, LOW);
}
// Print
Serial.print(inches);
Serial.print(" in, ");
Serial.print(cm);
Serial.print(" cm");
Serial.println();
delay(250);
}
I took this code from this reference above to test the sensor and change the pin numbers to match the Xiao Seeed ESP32-C3.
You could download the full code from here.
Before I upload the code to the board, I simulated the behavior using Wokwi.
You could see the simulation from here.
After simulating the code, I uploaded it to the board .