6. Design my own PCB¶
This week we delved deeper into the world of Electronics and Circuit Design, and learnt how to design a custom PCB (Printed Circuit Board) using an EDA (Electronic Design Automation) tool. I started to get a better idea of the key electronic components that make up a circuit board, and the overall circuit design process.
I also made progress with my Final project, considering what kind of PCB board might function behind my spice rack; how it would recognise spice bottle placement, light up LEDs, communicate with the separate microphone device, etc.
I am looking forward to actually producing this board in 2 weeks in the Electronics Production week!
Group assignment:
- Observe the operation of a microcontroller circuit board using test equipments in my lab.
(As a minimum, demonstrate the use of a multimeter and oscilloscope)
Individual assignment:
- Design a development board that uses parts from the inventory to interact and communicate with an embedded microcontroller, using an EDA tool
Group assignment:¶
In this week’s group assignment, we learnt about the different ways Test Equipments can help us in debugging our PCB boards.
If our boards have defects like open circuits, short circuits, etc, connecting the board could cause costly damages to equipments/parts. Testing the board beforehand saves us from wasting time, cost and materials, improving the quality and reliability of the final product down the line.
The way we test our boards is by probing our boards with various test equipments; these equipments enable us to measure, observe or monitor signals on the board, giving us insight into how the circuit/component/device is operating (or failing to).
For example, a multimeter can test;
- Components' resistance, capacitance, and semiconductor properties - verifying if individual components are functioning within their specified parameters.
- Continuity of circuits, and Current measurements - to check if current is flowing between 2 points; abnormal current draw can indicate issues like short circuits, broken connections, or faulty components.
- Voltage measurements at various points on the board - to ensure components are receiving the correct power and signals.
Link to documentation is here.
Designing my own Development board:¶
👉A Development board is a specialized type of Printed Circuit Board (PCB) designed for prototyping and developing electronic systems. It usually contains a microcontroller (or microprocessor), as well as peripherals such as LED, sensors, pin headers, etc. Using this board, we can quickly test and iterate our hardware designs.
PCB: is a general-purpose board used for connecting different electronic components.
My goal for this week was to design a custom Development board that can help me whilst prototyping my Final project.
Before actually designing the PCB, with great help from my instructors, I tried to understand the basic mechanisms of Electronic Circuits, and also clarify the requirements and overall architecture of my Final project.
These were the steps I took for designing the board;
1. Understand the Basics of Electronic Circuits
2. Outline the Board’s Concept and Requirements
3A. Create the Schematic Diagram
3B. Draw the Board’s Layout
1. Learning the Basics of Electronic Circuits¶
👉What’s an Electronic Circuit?
An “electrical circuit” is simply electricity going around a closed loop. This happens when electricity is generated by an adequate power supply, driving movement of electrons in a loop from a negative terminal to a positive terminal, creating charges.
When various Electronic components are placed in an electrical circuit, the flow of electric charge can be controlled, and by designing this flow, we can enable different devices to perform different functions.
Electronic components can be classified into “Active” and “Passive” Components;
- Passive Components: are devices that don’t need an external power source to operate actively. They mainly resist, store, or control the flow of electric current or voltage in a circuit, without actively amplifying or generating signals. Without these components, assembly of electronic circuit is not possible.
- Key examples: Resistors, Capacitors, Inductors, transformers, diodes, thermistors.Active Components: are devices that need an external power source to work. They actively control and manipulate the flow of electric current in a circuit, such as amplification, rectification and switching. - Key examples: Diodes, Transistors, Integrated Circuits.
On a PCB, these components are connected via conductive material through which electric charge can flow, such as wires or copper traces. Reference: geeksforgeeks
If you are interested in gaining better understanding of electronic components, this documentation page was a very comprehensive source of information for me.
2. Design Planning¶
Since I was still confused about what exactly are Development Boards and what are my specific goals, I started by looking at what other people had done in the past. I found Adrian’s documentations to be very easy to understand for a beginner like me. I decided to focus this week on creating something as basic as his Fab Xiao, but tweaking it so it would be useful for prototyping my spice rack.
2.1 Board Concept and Requirements¶
I started by laying out the preliminary requirements for this board;
- Bottle Placement Recognition: Awareness of when, where, which spice bottle(s) are placed. Ideally at least about 10 bottles per board (but the more the better!).
- Wireless communication: Ability to receive user request data from smart-microphone device, about which item has been requested (possibly Bluetooth?). Also to communicate with the online database (via Wi-fi?).
- LED output: Send signals to appropriate LED light(s) at the front of punching board, to signal the location of spice(s)
- Debugging feature: A test LED and button, (and some additional useful feature for debugging, if I can think of any useful ones in time)
- Scalability: Ability to scale up with minimal effort in terms of communication, power supply, etc.
- I am not expecting to need a DAC (which is not on ESP32C3).
- Size is not a priority for now, as long as it can fit behind the punching board/rack
As I will outline shortly, the microncontroller available to us at FabLab Kamakura’s inventory was Xiao ESP32C3 which has limited number of pins, so I needed to think carefully how I could achieve above concept.
2.2 My strategy¶
- Bottle Placement: Since the Xiao ESP32C3 only has 3 Analog pins, I will use 2 Multiplexers (1 for analog input and 1 for digital(LED) output) to enable more I/Os.
*I initially planned to make a board with Multiplexers intact, but my instructors told me it is not a good idea to fabricate complex boards before testing the circuit (to check component connections and electrical functionality). Considering the limited time, I decided to make a simple board that would be compatible with Multiplexers down the line. - Scalability: Make special Pin Header for I2C (This board will be a slave board), but they will be used as GPIOs until we need to prototype the scaling part. I will also try to create a Power bus to relay power to other boards.
- Debugging features: Only Debugging LED due to limited pins and there is already a Boot button and Test button on the Xiao
2.3 Component Specifics¶
Since this week’s board was very basic, the only component I really needed to choose was the Microcontroller, which is the brain of my board. I was initially drawn to a chip Rico suggested; the newly released Xiao ESP32S3 Plus, for its many pins, battery charging capability, low energy consumption, and relatively high performance. However we eventually realised that the footprint may be too complex (it’s 1.5 layers) for a beginner, and besides, the footprint data was not released yet (which meant I would have to draw it from scratch).
So for the purpose of this week’s task, I settled on Xiao ESP32C3 which was provided to FabLab Kamakura students for free.
Since I need to design a board that is compatible with this microcontroller, my first step was to examine the Features and Pin out Diagram carefully:
These are the specs of the Xiao ESP32C3;
Microcontroller | Xiao ESP32C3 (Datasheet) |
---|---|
MPU | Single-core 32 bit RISC-V, @160MHz |
Memory (ROM/SRAM/Flash) | 384kB/400kB/4MB onboard Flash |
GPIO | 11 digital I/O, 3 Analog I/O that can be used as ADC pins |
Other Interfaces | 1xI2C, 1xSPI, 2xUART, 11xGPIO(PWM), 4xADC, 1xJTAG bonding pad interface |
Power Pins | 5V out from the USB port (Can also use this as a voltage input but you must have some sort of diode b/2 external power source and this pin with anode to battery, cathode to 5V pin.) / 3V3 (the regulated output from the onboard regulator. Can draw 700mA) / GND |
Battery charging pad | Supports lithium battery charge and discharge management |
Built-in Button & LED | Reset Button, Bootloader Button, Charge LED |
Energy consumption in deep sleep mode | 43μA |
Wi-Fi | Complies with IEEE 802.11b/g/n protocol and supports Station mode, SoftAP mode, SoftAP + Station mode, and promiscuous mode. Includes external antenna to increase the signal strength. |
Bluetooth | BLE 5.0 & Bluetooth Mesh |
Not included | DAC, Touch Sensors |
Dimensions | 21x17.8mm Single board |
Language | Arduino / MicroPython |
Price | $4.99 |
2.4 Rough sketch of board¶
It’s always helpful have the board layout sketched out on paper, before starting designs on the EDA. (although I admit that this time, I only produced this sketch when I got to the board layout part and started getting confused.)
When drawing these sketches, it’s helpful to draw the power lines (VCC) in thick red, and Ground lines in thick black, to make sure they are not crossing (which would create a short circuit💀).
3. Board Design using an EDA tool¶
👉EDA (Electronic Design Automation) is a software that assists in designing circuit boards.
This week we used KiCad, which is a free and open-source suite of EDA. It supports schematic design, PCB layout, and circuit simulation.
First I downloaded KiCad Ver. 8 and FabLab’s Library of Footprints and symbols and added them to my library.
Steps: On KiCad, go to Preferences
> Manage Symbol Libraries
> Add existing library
> select the file, fab.kicad_sym
. Do the same for fab.pretty
.
3.1 Creating a Schematic Diagram¶
👉A schematic diagram is a symbolic representation of the circuit, outlining all the components used and how they are connected. It does not represent the physical layout of the board, which will be updated later.
I referred to this tutorial to draw the Schematic diagram.
The below hotkeys were useful to know when creating the schematic.
hotkeys:
A Add a new symbol to the sheet
R Rotate
M Move (wires will be disconnected)
G Grab and move a symbol while keeping wires connected
L add a Label
W Start drawing a Wire
V edit Value
E PropErties
3.1.1 Adding Components to the Schematic¶
Power
The first component to add in the schematic is the PWR_FLAG, to inform KiCad where the power (and GND) comes from.
These are the Power pins available on Xiao ESP32C3;
- 5V - The 5v out from the USB port. This can also be used as a voltage input but you must have some sort of diode (schottky, signal, power) between my external power source and this pin with anode to battery, cathode to 5V pin.
- 3V3 - The regulated output from the onboard regulator. I can draw 700mA.
- 1 GND - Power/data/signal ground
Generally, it’s good practice to draw the Power flag at the top of the screen, and Ground at the bottom.
Pins for Multiplexers
Apparently, 3 Analog pins can enable an 8-channel Analog multiplexer, so created 2 sets of Headers.
Since these will need to connect to Ground, I created a couple of Ground Pin headers.
I also created Power out for each of the Multiplexers.
I2C
For communication with the Master board, I initially added SPI connectors but Rico told me I2C is more appropriate.
So I made a special Pin Header for I2C connection. I also added some more Power input, which can hopefully be used to scale with Power bus.
During the prototyping phase when I2C is not being used, these pin can also be used as GPIOs.
Debugging LED
There was one remaining IO Pin, so I decided to assign a debugging LED. I added LED and resistor components, and for the resistor; set a value of 470mA.
3.1.2 Bill of Materials (BOM)¶
1 x Seeed Studio Xiao ESP32C3
2 x 4 row Vertical Pin Header (For I/O)
2 x 3 row Horizontal Pin Header (For Power )
1 x LED for Debugging
1 x 499Ω Resistor
3.1.3 Drawing Wire Connections¶
Once happy with the overall schematic, I connected wires to each pins and added corresponding labels.
3.1.4 Electrical Rules Check (ERC)¶
After completing the schematic, it is important to double-check that it is complete and accurate before moving onto designing the physical layout.
For this I pressed “Electrical Rules Check” and debugged the schematic. I got one error that was to do with missing the Power Flag on my Ground, which I added. There was also one warning about D7 and D8 being connected. I checked and indeed there was a unnecessary wire connecting the 2, so deleted it.
3.1.5 Assigning footprints¶
👉 A footprint is the graphic representation of where the components will touch the copper pad on the PCB. These are the areas upon which components will be soldered onto.
Since I only used fab components, which usually have all the foot prints correctly assigned already, I could skip this step.
If we are using components without footprints, we would open Footprint Assignment Tool and assign them manually.
3.2 Creating the Board Layout¶
Once there are no remaining errors, I can start making the board layout, by laying out each parts, and drawing in the traces between them.
👉Traces are the conductive pathways, typically thin lines of copper, that allow electrical current to flow along them, enabling communication and power delivery between different components such as resistors, capacitors, Integrated Circuits. - PCBgogo
First we press the F8 key, which will open the Layout editor with the schematic design reflected.
Before starting on updating the layout, we need to set the “Design Rules”, such as minimum trace width, clearance, etc. This is to ensure that the board works correctly and at optimum performance, while meeting the constraints of our lab’s machines;
- Minimum Trace Width: >0.4mm, since we will be using a 1/64 inch (=0.396875mm) endmill to mill our trace lines.
- Minimum clearance: also > 0.4mm, to prevent shorts, ensure signal integrity, minimize noise and electromagnetic interference (EMI), and allow for proper manufacturing and assembly.
- The Power and Ground lines >0.6mm. Power lines need to be set thicker, in order to 1. minimise voltage drops, in order to deliver clean and stable power to all parts of the board, and 2. to minimise resistance, which helps prevent common power-related issues such as overheating, and board damage. This will ensure consistent performance, reliability and lifespan of the electronic components.
To set these design rules I pressed the “Board Setup” icon and updated the “Constraints” and “Net Classes” as below.
When making the Trace connections, these hotkeys are useful to know;
- X > draw trace lines
- D > move component with trace connections, or reshape trace lines
An important consideration when making the layout and connections is making sure the Power and Ground lines wouldn’t cross (as this would create a short circuit). My design required some complex maneuvering to ensure this, and I ended up going back to the schematic to reorder the VCC and Ground pins to make the layout more practical to wire.
Once completed, my instructors gave me some feedback, so I fixed them;
- Pin Headers: Changed from through-hole (THT) to surface-mount-type (SMD), as these are more recommended for FabAcademy
- Power lines and Ground lines: Try to make them more far apart to prevent short-circuits
- Pin Headers: Separate Power headers and IO headers into separate Headers to avoid connection mistakes
- Make the connection lines cleaner - avoid small squiggly lines as much as possible
Once happy with the layout, I performed a Design Rules Check to ensure there are no errors.
Finally, I moved to the Edge Cuts layer and cut out the board edge. I decided to make one corner rounded to indicate the analog side.
Design Files:¶
Useful links:¶
Reflections:¶
This week I managed to understand the basics workings of Circuit boards. There were lots of concepts and vocabulary to cover (and yet I’ve only covered the bare basics!). These two Introductory books were especially helpful for me.
I also learnt how to use KiCad to design my own custom Circuit Board, which was really not that hard and quite enjoyable once I got the hang of it.
I also made good progress with my Final Project and came up with some more questions such as;
- How to deploy magnets on the rack while preventing EMI??
- How can I enable the circuit to automatically switch to Deep sleep mode?
- For Power source, I was initially hoping to use a rechargeable battery to avoid too many Power chords on the Kitchen counter, but I will need to do a Power Budgeting. Also, how to achieve power bus?
- What are “PWM” Pins?
- Benefits of Neo-Pixel type LED over normal LED?
Further Questions:
We spent quite a lot of time in class discussing the difference between microcontrollers, MCUs (Microcontroller Units), Development Boards, and where Xiao boards sit, which is in between.
One requirement of our Final Project is to use our own custom-designed development boards (we are not allowed to use pre-fabricated Development boards like Arduino, Raspberry pies or ESP32DevKits). However, we are allowed to use Xiao boards, which arguably is a basic kind of Development board.
Now that I’ve learnt how to make a Dev board with a Xiao, I’d like to one day take on the challenging of making one with more basic MCUs (such as ATtiny 412, ATting 3216, SAMD21, AVR, ettc), and understand what that entails.
Assignment Checklist:¶
- Linked to the group assignment page
- Documented what I have learned in electronics design
- Checked my board can be fabricated
- Explained problems and how I fixed them
- Included original design files (Eagle, KiCad, etc.)
- Included a ‘hero shot’