Skip to content

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

alt text

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:
alt text



alt text
alt text

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

alt text A multimeter is a versatile instrument used to measure various electrical properties. Here are some common modes on a multimeter and their functions:

  1. 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.
  2. 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.
  3. 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

  1. Create Schematic
  2. Create Board Design
  3. Generate Gerber
  4. Convert Gerber to PNG
  5. Convert PNG to GCode
  6. 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:

alt text
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. alt text

How to connect onto the PCB Board

alt text 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:
alt text

Grove DHT11:

alt text

Grove

alt text

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

alt text

  • Physical Pin Header: Grove Female Header - DIP-4P-2.0mm-10 Pcs alt text

  • 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. alt text

  • Normal Grove Cable alt text
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.

alt text

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.
alt text

Notice:

alt text

  • 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.

alt text

Clone with HTTPS / Download zip file
Copy Repo URL , git clone + URL to download it. alt text

  • 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.

alt text

For Manage Footprint Libraries:
alt text alt text

Desgin starts! Click ‘Add Symbol’ - search for component - OK : alt text

Added.The current mouse is in editing mode. You can press Esc to exit the editing mode.
alt text

Add other components:
fab:PinHeader_1x03_P2.54mm_Horizontal_SMD
alt text

fab:PinHeader_1x04_P2.54mm_Horizontal_SMD alt text

For circuit testing, I also add components such as switch, resistors,LED. (following components are what I can find in the lab.)

alt text alt text alt text

Operation: to rotate the element

alt text

To Add Wire

alt text

To Delete Wire

alt text

My Schematic Diagram finish

alt text

Note:
alt text

2 - Design PCB

Switch to PCB Editor

Way 1: alt text

Way 2 (if way1 fails to generate PCB design):
alt text

Modify direction if you need:
alt text

No ‘Mirror’ Operation : alt text

Routing Tracks - Kicad Document

Before edit PCB, read this tutorial first.

Modify Tracks in Kicad

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:
alt text

To Route Tracks:

alt text

To Add Text / emoji :

Select the font , double click it , you then can start edit fonts.

alt text alt text

To Add Edge cut lines:

First initialize the thickness , in this case, I use 0.5 mm . alt text

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.

alt text alt text
alt text

Fix errors and warings. alt text

Error Fixed!

Finish PCB Design:
alt text

Download My_schematic_pcbDesign

3 - Generate Gerber

File - Fabrication Outpus- Gerbers(.gbr) alt text

alt text

4 - Convert Gerber to PNG

Convert Gerber to PNG

Choose Files:
alt text

Upload All Plot File:
alt text

Result:
alt text

Select the topTrace and TopCut to generate corresponding png files.

Select Top Trace - Click ‘Generate PNG’:
alt text Select Top Cut - Click ‘Generate PNG’:
alt text

Download files:
alt text

No dills file in this case.

5 - Convert PNG to GCode

Visit mos ;

Read PNG : Upload png Trace File and set dpi as 1000. alt text

V-bit calculator:
Set ‘tip diameter’ as 0.4 mm and click ‘send calculated settings’ alt text

mill raster 2D:
Click ‘calculate’: alt text

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.

alt text

You can also preview the trace of cutting: alt text alt text 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:

alt text

You can also preview the trace of cutting: alt text

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.
alt text

alt text alt text

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:
alt text Resize : alt text

Re-design again:
alt text Download

Solder & Multimeter Test & Embedded Program Test

alt text alt text alt text

Finally, Tracks look good !!

alt text

Multimeter Test : alt text

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;
alt text

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.
alt text alt text

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.

alt text

Embedded Program - Enable the switch on my-design PCB board to control the LED light in it

Hardware overview - Pinout diagram alt text

Schematic Diagram: alt text

PCB Design:
alt text

Open Arduino, select board and port
alt text

Upload the code. If it fails , hold on ‘Boot’ button, and press ‘Reset’. alt text

Upload successfully. alt text

Source Code

Note - Why LED is on once the board is powered on.

alt text 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
  }
}

Hero Shot / Result