6. Design our own PCB¶
This week we delved deeper into the world of Electronics and Circuit Design, through designing our own 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 these boards, and the overall circuit design process.
I also made progress with my Final project by 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!
Assignments for this week (Feb 26 - Mar 4):
Group assignment:
- Observe the operation of a microcontroller circuit board using test equipment 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 the different ways Test Equipments can help us in debugging our PCB boards.
If our boards have defects like open circuits, short circuits, etc, this could cause costly damages to expensive equipments/parts when connected. Testing the board beforehand saves us from wasting time, cost and materials, while improving the quality and reliability of the final product down the line.
We can do this by probing our boards with various test equipments; this allow 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. A PCB is a general-purpose board used for connecting electronic components.
My goal for this week was to design my own 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. Understanding the Basics of Electronic Circuits
2. Deciding on Board Concept and Requirements
3A. Creating a Schematic Diagram on the EDA
3B. Deciding the Board Layout on the EDA
1. Basics of Electronic Circuits¶
An electrical circuit is simply electricity going around a closed loop. Electricity is generated by an adequate power supply, which drive the movement of electrons in the loop, from a negative terminal to a positive terminal, which create charges that can power various devices.
When various electronic components are placed in the circuit, they work to control the flow of this electric charge, 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
Passive components are electronic 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.
*Resistors, Capacitors, Inductors, transformers, diodes, thermistors* are key examples of passive components.
Active Components
Active components are electronic 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. *Diodes, Transistors, Integrated Circuits* are key examples of passive components.
These components are connected via conductive material through which electric charge can flow, such as wires or copper traces.
Reference: geeksforgeeks (https://www.geeksforgeeks.org/electronic-components/)
If anyone reading this documentation is interested in better understanding electronic components, I found this documentation page to be a very comprehensive source of information.
2. Design Planning¶
Board Concept and Requirements¶
For this week, I decided to prototype a board that would help me prototype the spice rack, and laid out the preliminary requirements for this board;
- Bottle Placement Recognition: Awareness of when, where, which spice bottle(s) were 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 so much of an issue for now, as long as it can fit behind the punching board/rack
For full documentation please look at Final Projects page (to be updated later)
As I will outline shortly, the microncontroller available in 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.
My strategy¶
- Use 2 Multiplexers (1 for analog input and 1 for digital output) to enable more pins
- Make special Pin Header for I2C to enable scalability (This board will be a slave board), but they will be used as GPIOs until we need to prototype the scaling part.
- Debugging features: Only Debugging LED due to limited pins and there is already a Boot button and Test button
- I will try to create a Power bus to relay power to other boards (again for scalability)
Choosing the Microcontroller¶
For the brain of my board, the Microcontroller, I was 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 eventually settled on Xiao ESP32C3.
Since the board needs to be compatible with this microcontroller, my first step was to examine the Features and Pin out Diagram carefully:
These are the specs for 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 |
Rough sketch of board¶
Ideally, this type of sketch should be made at the start, before opening KiCad, but not knowing the workflow, I admit I only produced sketch when I got to the board layout part. (When I started struggling to remember the whole layout).
When sketching, it’s helpful to draw the power lines (VCC) in thick red, and Ground lines in thick black, as they cannot cross (as that 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
.
A. 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 in later stages.
I started to make a Schematic diagram by referring to this tutorial.
The below hotkeys were useful in 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
At first, I attempted to make a schematic that includes some Multiplexers, 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 simpler board that would be compatible with Multiplexers down the line.
Power
The first component to add in the schematic is 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.
Multiplexers
Since the 3 Analog pins available on the Xiao board won’t be not enough, I decided to add Multiplexers to enable more I/Os. 1 Multiplexer will be for analog input, to receive information from input sensors, and 1 will be for LED (digital) output.
Apparently, 3 Analog pins can enable an 8-channel Analog multiplexer.
Since these will need to connect to Ground, I also added 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.
Wire Connections
Once happy with the overall schematic, I connected wires to each pins and added corresponding labels.
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.
After this step, normally I would need to associate the components with 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.
But I had checked during component placement in the footprint preview that all the correct footprints are assigned already (this is the main benefit of using fab components; that the appropriate footprints are already associated).
If for some reason we are using components without footprints, we would open Footprint Assignment Tool and assign them manually.
B. 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.
The first thing to do before starting on updating the layout is to set the “Design Rules” based on the milling process, such as minimum trace width, clearance, etc. For example, since we are using a 1/64 inch (=0.396875mm) endmill to mill our trace lines, we need set the minimum trace width to >0.4mm. Also, minimum clearance should be set to > 0.4mm to prevent shorts, ensure signal integrity, minimize electromagnetic interference (EMI), and allow for proper manufacturing and assembly.
Also ,the Power lines need to be set thicker, so they can carry the larger current. Thicker lines also have less resistance, which helps prevent overheating issues and board damage, and reduce the voltage drop.
To set these design rules I pressed the “Board Setup” icon and updated the “Constraints” and “Net Classes” as below.
To make 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 done, my instructors gave me some feedback, so I changed some parts.
- 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
When working on the Board layout, I did some extra reading up to understand key layout considerations for ensuring the board functions correctly and at optimum performance, while meeting production requirements (milling, assembly, etc), and also minimising unnecessary costs. I will keep these in mind especially when designing more complex boards;
- Component placement and routing: Take into account how the board will be used and packaged. In my case, I wanted to connect to multiplexers on both sides of the board, and have I2C and Power bus at the bottom.
- Power Distribution: To deliver clean and stable power to all parts of the board, try best to;
- Minimise voltage drops across the board, through effective placement of components and routing
- Reduce excessive noise and EMI, and other power related issues
Thermal Management: Prevent overheating, thermal stress on components and ensure consistent performance across different environmental conditions. This will ensure consistent performance, reliability and lifespan of the electronic components.
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?
Assignment Checklist:¶
- [x] Linked to the group assignment page
- [x] Documented what I have learned in electronics design
- [x] Checked my board can be fabricated
- [x] Explained problems and how I fixed them
- [x] Included original design files (Eagle, KiCad, etc.)
- [x] Included a ‘hero shot’