Electronics_Design
March 19, 2024
Challenge
-
Group assignment:
- Use the test equipment in your lab to observe the operation of a microcontroller circuit board (as a minimum, you should demonstrate the use of a multimeter and oscilloscope).
- Send a PCB out to a board house.
- Document your work on the group work page and reflect what you learned on your individual page.
-
Individual assignments:
- Use an EDA tool to design a development board to interact and communicate with an embedded microcontroller.
Group Assignment:
This week Was about using the debugging tools of Electronics (Multimeter and oscilloscope) components we have in the lab to observe the signals coming from the microcontroller and what is going to it from the sensor and its values.
This process is so helpful in understanding the working signals of MCU (How it looks) and how to understand the error from the value or the shape of the signal.
More about the process please refer to this LINK.
Individual Assignment
This week assignment is to design and fabricate a board (Any board)
For me I will be designing a board containing (ESP) for IOT purposes, 1 Input component and 1 output component, In addition to adding headers to be linked with the MCU.
The decision based on what I have in mind is to use the (XIAO ESP32C3) , DHT temperature and humidity sensor, button, and LED’s.
As for the designing tool I’ll be using (KICAD).
Designing
It’s important before designing we need to make sure that we know all the component we want to use.
- XIAO ESP32C3
Tiny MCU board with Wi-Fi and Bluetooth5.0
Knowing the dimension of an object is necessary before start designing to understand the PCB dimension.
Then its important to know the pin-out of your component so you can understand the orientation you want to have on your PCB in addition to what kind of other component can be linked together.
For more details about the Board check this documentation –> Link
- DHT 22
The DHT22 is a basic, low-cost digital temperature and humidity sensor.
For more details check this datasheet –> Link
- Button (SMT)
Surface mount switch
For more details check this datasheet –> Link
Those are the main big component to use the others are quite simple to use.
Now let Us go ahead to KICAD to start the schematic and then the design.
KICAD
When opening KICAD the window will show us the current or previous project you worked on
- Now we need to start new project.
You can simply press (ctrl+N).
- Then After you name it and select the location you will have 2 files (Schematic and PCB).
Now you will see the new project you have created.
Now I’m Ready to build my schematic
- So I will double click on the (.kicad_sch) to open it or simply press on the schematic editor.
- This is the window of the schematic sheet.
Its Important to check all the available options and settings before starting the design process.
-
Now lets start adding our component. I will start by adding the (XIAOESP32C3)
-
To add component you can press on (A) button or press on the add component logo.
- Let me search for the XIAOESP32C3.
Now Just press (OK) and then place the block diagram wherever on the sheet
Now we can see that the pins are not like what the real MCU looks like so we just need simply to understand where each pin is cross-ponds to.
- I have wrote this for me to understand what each pin is.
-
Now I want to add a header and I want to connect all the analog pins to it in addition to the I2C pins.
-
I will choose a female through hole header with 6 Pins.
-
SO again I need to add a new component so I will press on (A), and then search for the header I want.
- Now I will connect the pins together using Global label.
- Then I will connect a new 6 pin female SMD connector for the UART communication.
Check Datasheet –> Link
- Then I will connect 2 LED’s to the pins of the MCU.
- Then I will connect the LEDs with Resistors and then to the ground.
- Now I will add the Ground which is a power unit in KICAD.
Just Press (P) and choose the power option you want.
- Then I will connect it to the resistor and the LED.
- Now I will add global Label for the TX and RX and I will connect them with the Female Connector.
- Then I will connect the power lines to the connector.
- Now I need also to connect the power lines to the MCU.
XIAO ESP32 has 3 pins for power (5V , 3.3V , and GND)
- Now I will add the DHT 22 and I will connect it to the MCU.
I have connected a pull up resistor between the Data bin and the input pin of the MCU as per data sheet (Section 5) the value can be from 1K to 10K.
- Now I will connect a button with a pull down resistor.
- Then I will connect LED to the Last PIN.
Now My Circuit Schematic is Ready
Now I have to Run the Electrical Rules checker (ERC) to check for Errors
All the errors are because of the floating pins (Not connected pins).
- Now I can Annotate the schematic to move to PCB Design Page.
- Let’s Go to the PCB Page.
PCB Design
After we move to the PCB design Page this screen will appear
As seen the page is empty and there is no component to route.
- To add the component we need to update the Design page from the schematic.
- Then place the component.
Now we are ready to start routing the component together.
-
After placing the component I will Draw edge line as the board outline.
-
My Board is going to be 41 by 51 mm (My component has to be within this boarder)
- Then double click on the rectangle to choose its settings (Height, width, and on which layer).
- Then I will start sorting my component within this rectangle.
While Sorting you will recognize that the components are moving with big step so you can change this by changing the grid step.
- Now after finishing the sorting I will choose the track width and I will set the minimum distance between tracks.
- Then I will set My constrains.
- Now I will set the track width to 0.5 mm and start routing.
- Let Me start Routing my first Track.
- Let me complete all the routing.
- Now I will Check the Design (Design Rule Checker).
- Now I will create a refill area to reduce the machining time.
This will create a common zone on the top board layer (For me its gonna be Ground).
- Run DRC Again to fill the Zone.
- Now We can Export the Files for the fabrication process.
- I will choose gerbers and I will only choose the (F.CU –> The top layer and the Edge.Cut –> Board outline).
-
Then I will Press on Plot and generate the files.
-
Now I will Generate the Drilling file by pressing on generate drill file.
Now we are ready to generate the toolpath and fabricate the board on the CNC.
For the Generation of the Toolpath and the machine process I will go through it fast but you can refer to this LINK for more Details.
Board Fabrication
Toolpath generation
-
I will Use Flat-Cam to generate the CNC files.
-
I will Import the files and do the needed settings (Choosing the bit size , Feed rate and spindle speed).
-
I will use 0.1 mm V bit (20 degree).
- V-Bit (0.1mm)(20 degree)
Setting | Milling ------------------ | -------------- Feed x-y: | 150 mm\min Spindle speed: | 8000RPM Plunge rate: | 60mm\min Depth of cut: | 0.0532mm & 0.1mm
-
Then I will generate the Drill file (I will use 0.8 mm Drill bit )
- End-Mill (0.8mm) (Drilling bit)
Setting | Drilling ------------------ | -------------- Feed x-y: | 1000 mm\min Spindle speed: | 8000RPM Plunge rate: | 300mm\min Depth of cut: | 1.8mm
-
Then I will Generate the Cutout file (I will use 1 mm bit)
- End-Mill (1mm) (2-flute)
Setting | Cutout ------------------ | -------------- Feed x-y: | 200 mm\min Spindle speed: | 8000RPM Plunge rate: | 100 mm\min Depth of cut: | Multi-depth (0.4-1.8)mm
-
Now the Files are ready to be machined.
Machine Process
-
For setting up the machine please refer to this LINK (on How to Zero the axis and what to use as software)
-
Now the machine is fabricating the board.
- Then we drill
- And at the end we will cut-out the board.
- Here We go the board is ready.
- After cleaning the board.
Soldering The Board
- I will now solder all the component.
- Lets Start Soldering from small component to big component.
Testing the Board
I will blink the LED’s on the board.
Code
#define LED1 21
#define LED2 20
#define LED3 10
void setup() {
// put your setup code here, to run once:
pinMode(LED1,OUTPUT);
pinMode(LED2,OUTPUT);
pinMode(LED3,OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
digitalWrite(LED1,HIGH);
digitalWrite(LED2,LOW);
digitalWrite(LED3,LOW);
delay(1000);
digitalWrite(LED1,LOW);
digitalWrite(LED2,HIGH);
digitalWrite(LED3,LOW);
delay(1000);
digitalWrite(LED1,LOW);
digitalWrite(LED2,LOW);
digitalWrite(LED3,HIGH);
delay(1000);
}
Raw Files
Issues faced
-
One of the issues I have faced is the milling of the board as I’m using V-bits to mill {I found recently that the bed was not 100% percent aligned} , So I had to re-surface the bed and re-mill the board, In addition to this I had to increase the depth of cut in the copper so instead of 0.05 mm I change it to 0.1 mm in addition to this I added more passes to insure the routes are isolated.
-
This is the board after changing the depth.
- This is Before.