8. Electronics Design¶
Assignment¶
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) Document your work on the group work page and reflect what you learned on your individual
Individual assignment:
Use an EDA tool to design a development board to interact and communicate with an embedded microcontroller
Group Assignment¶
Click here to group work.
The Oscilloscope in ChaiHuo¶
Left one is the function generator, which can generate various functions with freq and voltage and models (sin, triangle)
This is useful to simulate signals, like if you want to test a microcontroller how it’s react to certain signal, you can use this device to generate signals and pass to microcontrollers.
Oscilloscopes, other hand show you what kind of signal going to throw the pcb. So if you want to see signal insides a pcb, you can use it.
an example - were function generator, generate an signal and output it then the oscilloscope will read the signal and display;
My trial on an LED strip:
Components of an Oscilloscope: Display Screen: Shows the waveform of the signal being measured. Modern oscilloscopes use LCD or LED screens to display signals in a clear, high-resolution format.
Input Channels: Most oscilloscopes have multiple input channels (e.g., CH1, CH2) for measuring different signals simultaneously. Each channel has an input connector where the probe is attached.
Probes: These are used to connect the oscilloscope to the circuit being tested. Probes can be passive or active and are designed to accurately transmit the signal without significant distortion.
Vertical System: Controls the vertical deflection of the signal. It includes the vertical scale (volts per division) and vertical position controls.
Horizontal System: Controls the horizontal deflection of the signal. It includes the time base (seconds per division) and horizontal position controls.
Trigger System: Stabilizes repetitive waveforms and allows the user to capture single-shot waveforms. It includes controls for setting the trigger level and slope.
Control Panel: Contains various knobs and buttons for adjusting the oscilloscope settings, such as voltage scale, time base, trigger settings, and more.
Measurement System: Includes functions for measuring signal parameters such as amplitude, frequency, rise time, and more.
Connectors and Ports: For connecting to external devices, saving data, or connecting to a computer for further analysis.
Warning Labels: Safety labels indicating caution areas to avoid electrical shock and other hazards.
Multimeter in Chaihuo¶
A multimeter is a versatile instrument used to measure various electrical properties. Here are some common modes on a multimeter and their functions:
- Voltage Measurement (V) DC Voltage (V— or VDC): Measures direct current (DC) voltage. This mode is used to check batteries, power supplies, and any DC circuits. AC Voltage (V~ or VAC): Measures alternating current (AC) voltage. This mode is used to check household outlets, AC power supplies, and other AC circuits.
- Current Measurement (A) DC Current (A— or ADC): Measures direct current (DC) flowing through a circuit. Used for checking the current in DC circuits. AC Current (A~ or AAC): Measures alternating current (AC) flowing through a circuit. Used for checking the current in AC circuits.
- Resistance Measurement (Ω) Resistance (Ω): Measures the resistance of a component or circuit in ohms. Useful for checking resistors, the continuity of wires, and the condition of switches.
Individual Assignment¶
Note: PCB-101 - by Salman.
PCB Design Procedures¶
- Create Schematic
- Create Board Design
- Generate Gerber
- Convert Gerber to PNG
- Convert PNG to GCode
- CNC Mill the board
1 - Design Schematic Diagram¶
Components¶
For my final project - Night Lamp, I will include Xiao ESP32-C3, an LED strip (WS2812B), a temperature & humidity sensor Grove DHT11 and other components, for Xiao, we need to add Fab Electronics Library to Kicad.
LED Strip:¶
The black marked part is the compensation voltage, which is connected in series with the red part.(黑色标注部分是补偿电压,与红色部分串联关系)
This LED light strip is composed of WS2812B lamp beads connected in series.
How to connect onto the PCB Board¶
Since this component component can’t be found in Kicad, I remove it ,resolder it, combine it with 3 Pin header 2.54MM 1*40 2*40 P
, use connector(wire) to connect to the board. Like this:
Grove DHT11:¶
Grove¶
Interface of Grove modules¶
You may notice that Grove cables come in 4 different colours.
Pin 1 - Yellow (for example, SCL on I2C Grove Connectors)
Pin 2 - White (for example, SDA on I2C Grove Connectors)
Pin 3 - Red - VCC on all Grove Connectors
Pin 4 - Black - GND on all Grove Connectors
How to assemble on the board - Plan A¶
-
Physical Pin Header: Grove Female Header - DIP-4P-2.0mm-10 Pcs
-
Kicad Component: You gonna use
Conn_PinHeader_1x04_P2.54mm_Vertical_THT_D1.4mm
to drill on the board, so that to connect (solderring) to the PCB board. - Normal Grove Cable
How to assemble on the board - Plan B¶
I removed one end of the cable ends and connected it to the CONN HEADER SMD using a pin header.
For Pin Header : Pin header 2.54MM 140 240 P;
For CONN HEADER SMD 10POS 1.27MM;
Using Kicad¶
I am using Kicad to create my schematic for my final project.
We need to add Fab Electronics Library to Kicad.
Create a new project and double click to start working on the .sch (schematic) file.
Notice:
- This library includes all the electronics components listed in the official Fab Inventory.
- Warning! the library is under active development. Naming of components can change overnight. Make sure to
git pull
the latest version before doing work.
Clone with HTTPS / Download zip file
Copy Repo URL , git clone + URL
to download it.
- Go to “Preferences / Manage Symbol Libraries” and add fab.kicad_sym as symbol library.
- Go to “Preferences / Manage Footprint Libraries” and add fab.pretty as footprint library.
For Manage Footprint Libraries
:
Desgin starts! Click ‘Add Symbol’ - search for component - OK :
Added.The current mouse is in editing mode. You can press Esc to exit the editing mode.
Add other components:
fab:PinHeader_1x03_P2.54mm_Horizontal_SMD
fab:PinHeader_1x04_P2.54mm_Horizontal_SMD
For circuit testing, I also add components such as switch, resistors,LED. (following components are what I can find in the lab.)
Operation: to rotate the element¶
To Add Wire¶
To Delete Wire¶
My Schematic Diagram finish¶
Note:
2 - Design PCB¶
Switch to PCB Editor¶
Way 1:
Way 2 (if way1 fails to generate PCB design):
Modify direction if you need:
No ‘Mirror’ Operation :
Routing Tracks - Kicad Document¶
Before edit PCB, read this tutorial first.
For my project, I need to edit this prarameter:
Important : In each new project you need set again.¶
Board Setup
-Design Rules
- Constraints
- set these following parameters:
To Route Tracks:¶
To Add Text / emoji :¶
Select the font , double click it , you then can start edit fonts.
To Add Edge cut lines:¶
First initialize the thickness , in this case, I use 0.5 mm .
For your refference (just for inspiration,not a perfect demo):
Design Rules Checker¶
Very Important For the last step, run the inspection tool to fix all the errors until 0 errors are achieved.
Fix errors and warings.
Error Fixed!
Finish PCB Design:
Download My_schematic_pcbDesign
3 - Generate Gerber¶
File - Fabrication Outpus- Gerbers(.gbr)
4 - Convert Gerber to PNG¶
Choose Files:
Upload All Plot File:
Result:
Select the topTrace and TopCut to generate corresponding png files.
Select Top Trace - Click ‘Generate PNG’:
Select Top Cut - Click ‘Generate PNG’:
Download files:
No dills file in this case.
5 - Convert PNG to GCode¶
Visit mos ;
Read PNG : Upload png Trace File and set dpi as 1000.
V-bit calculator:
Set ‘tip diameter’ as 0.4 mm and click ‘send calculated settings’
mill raster 2D:
Click ‘calculate’:
It is needed to generate diffrent G-code files for trace cutting, outline cutting and drill.
For the trace file, the parameter needed to be set are as below
Always remember to set the dpi to 1000
For the v-bit, you can also change the parameter based on the real v-bit you have choosen instead of
using the default parameter to get a better PCB.
You can also preview the trace of cutting: For the outline file, the parameter needed to be set are as below: Always remember to set the dpi to 1000 use the default parameter is fine.
In case broke the tips of V-bits/ tapered bits, slow down the speed to 2mm/s:
You can also preview the trace of cutting:
Download My Gerber file Download My PCB GCode Fileext
6 - CNC Mill the board¶
For details , check Week04
SIZE:
It is about 40 mm x 45 mm.
The tracks should have at least 2mm spacing. My design was too close together and I could see that there were breaks in some places on the PCB.
Re-desiagn my PCB:
Resize :
Re-design again:
Download
Solder & Multimeter Test & Embedded Program Test¶
Finally, Tracks look good !!
Multimeter Test :
Testing for a short circuit with a multimeter is a straightforward process. Here’s a step-by-step guide on how to do it:
1. Prepare the Multimeter
Turn off the power: Ensure that the circuit or device you are testing is powered off. This is important to prevent any damage to the multimeter or the circuit and to ensure your safety.
Set the multimeter to continuity mode: Most digital multimeters have a continuity test mode, which is usually indicated by a diode symbol or sound wave symbol. If your multimeter doesn’t have a dedicated continuity mode, you can use the resistance (ohms) mode.
2. Test for Continuity
Connect the probes: Plug the black probe into the COM (common) port and the red probe into the VΩ (voltage/ohm) port.
Touch the probes together: Before testing the circuit, touch the two probes together. The multimeter should beep (in continuity mode) or show a reading close to 0 ohms (in resistance mode), indicating that the probes are working correctly.
3. Test the Circuit
Place the probes on the circuit: Touch the probes to the two points in the circuit where you want to check for a short. These points can be the two ends of a wire, the legs of a component, or specific points on a PCB.
4. Interpret the Results
Continuity mode: If there is a continuous path (short circuit) between the two points, the multimeter will beep, indicating continuity.
Resistance mode: If there is a short circuit, the resistance will be very low (close to 0 ohms). If there is no short circuit, the resistance will be very high or the multimeter will display "OL" (overload).
Lesson learn from issue¶
When I used a multimeter to test the circuit, I found that the circuit was broken;
The circuit was very thin, which was related to the distance between the V-bit and the copper layer when I was adjusting it: I adjusted the Z axis deeper into the board in the previous step. The correct way is: when the V-bit is adjusted to just touch the board surface (making a vibrating friction sound), you can stop adjusting.
Components¶
Quantity | Item
1 XIAO ESP32C3
1 Grove DHT11
1 CONN HEADER SMD 10POS 1.27MM
1 CONN HEADER SMD R/A 4POS 2.54MM
1 CONN HEADER SMD R/A 3POS 2.54MM
1 Tactile Switch SPST-NO Top Actuated Surface Mount
1 LED BLUE CLEAR 1206 SMD
1 RES 1K OHM 1% 1/4W 1206
1 RES 499K OHM 1% 1/4W 1206
Pay attention to the solder when welding. Insufficient solder can easily cause a short circuit.
Embedded Program - Enable the switch on my-design PCB board to control the LED light in it¶
Hardware overview - Pinout diagram
Schematic Diagram:
PCB Design:
Open Arduino, select board and port
Upload the code. If it fails , hold on ‘Boot’ button, and press ‘Reset’.
Upload successfully.
Source Code¶
Note - Why LED is on once the board is powered on.¶
I notice that before I upload the code to my PCB,the LED on the board is lighted up state, I guess maybe it’s because there is a weak potential in the circuit, so to clarify the effect of my experiment : I am going to enable the switch to contrl the state of the LED, so I set the LED as an Input, the LED as an output, Once switch is enabled, then turn off the LED. Here’s the source code :
const int switchPin = 8; // Pin connected to the switch (D8)
const int ledPin = 9; // Pin connected to the LED (D9)
int switchState = 0; // Variable to hold the state of the switch
void setup() {
pinMode(switchPin, INPUT); // Set switch pin as an input
pinMode(ledPin, OUTPUT); // Set LED pin as an output
digitalWrite(ledPin, LOW); // Ensure the LED is off at the start
}
void loop() {
switchState = digitalRead(switchPin); // Read the state of the switch
if (switchState == HIGH) { // If the switch is pressed
digitalWrite(ledPin, LOW); // Turn on the LED
} else { // If the switch is not pressed
digitalWrite(ledPin, HIGH); // Turn off the LED
}
}